Skip to content
Snippets Groups Projects
Commit d5162f81 authored by William Henrotin's avatar William Henrotin
Browse files

[FIX] stock_account: open layer form from list


Since e4988b70, the record openned from the stock valuation layer
list view will depend on the stock move parent's document. If, the move
has a picking_id set, the record will be the stock picking.

This implies in some cases (a stock move linked to a picking or a
manufacturing order) we cannot access the stock valuation form view and
thus the accounting entries are not reachable from there.

This commit adds a button in the list view to open the layer form view.

closes odoo/odoo#105452

Signed-off-by: default avatarArnold Moyaux (arm) <arm@odoo.com>
parent e1474c91
No related branches found
No related tags found
No related merge requests found
......@@ -68,6 +68,15 @@ class StockValuationLayer(models.Model):
fields.remove('unit_cost')
return super().read_group(domain, fields, groupby, offset, limit, orderby, lazy)
def action_open_layer(self):
self.ensure_one()
return {
'res_model': self._name,
'type': 'ir.actions.act_window',
'views': [[False, "form"]],
'res_id': self.id,
}
def action_open_reference(self):
self.ensure_one()
if self.stock_move_id:
......
......@@ -46,6 +46,7 @@
action="action_open_reference" type="object">
<field name="create_date" string="Date" />
<field name="reference"/>
<button name="action_open_layer" icon="fa-arrow-right" title="Open Valuation Layer" type="object"/>
<field name="product_id" />
<field name="company_id" groups="base.group_multi_company"/>
<field name="quantity" string="Moved Quantity"/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment