[FIX] stock_account: valuation report needs company_owned in context
When calculating the stock_value of a product, the system will take into account all the locations that have this company as company. (that way if owner_id is not set, the company_id on the location is the owner (virtual: not set)) The Qty on Hand field takes into account however the quantities that are in the warehouses. This could lead to weird situations where the Quantity On Hand is 0 and so the record is not shown, while the stock value is positive. (e.g. stock in Transit) In order to use the same logic for both fields, we pass company_owned=True in the context.
This commit is contained in:
@@ -95,7 +95,7 @@
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_id" ref="view_stock_product_tree2"/>
|
||||
<field name="domain">[('type', '=', 'product'), ('qty_available', '!=', 0)]</field>
|
||||
<field name="context">{}</field>
|
||||
<field name="context">{'company_owned': True}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
If there are products, you will see its name and valuation.
|
||||
|
||||
@@ -24,7 +24,7 @@ class StockQuantityHistory(models.TransientModel):
|
||||
'name': _('Products'),
|
||||
'res_model': 'product.product',
|
||||
'domain': "[('type', '=', 'product'), ('qty_available', '!=', 0)]",
|
||||
'context': dict(self.env.context, to_date=self.date),
|
||||
'context': dict(self.env.context, to_date=self.date, company_owned=True),
|
||||
}
|
||||
return action
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user