[REF] stock: quant's company_id

A quant's company_id is now related to the company_id of its location.
We make it store so that filters can work with it. We remove the default
because the location's company_id has one, and it's possible that we
introduce quants in some non-internal locations (like intercompany
transit) that do not have a company_id set.
This commit is contained in:
Fabien Pinckaers
2017-07-18 15:45:44 +02:00
committed by Simon Lejeune
parent a665cab858
commit 669cbe3c36
+2 -5
View File
@@ -19,11 +19,8 @@ class StockQuant(models.Model):
product_uom_id = fields.Many2one(
'product.uom', 'Unit of Measure',
readonly=True, related='product_id.uom_id')
company_id = fields.Many2one(
'res.company', 'Company',
default=lambda self: self.env['res.company']._company_default_get('stock.quant'),
help='The company to which the quants belong',
readonly=True, required=True)
company_id = fields.Many2one(related='location_id.company_id',
string='Company', store=True, readonly=True)
location_id = fields.Many2one(
'stock.location', 'Location',
auto_join=True, ondelete='restrict', readonly=True, required=True)