[IMP] stock: quant_package owner and company

When all quants in a package have the same owner and/or company, the
field owner and/or company on quant_package will have the same value as
the one on quants.

TASK-60709
This commit is contained in:
Pierre Masereel
2018-08-09 13:30:39 +02:00
parent 23415c2b52
commit e01620ce02
+4
View File
@@ -353,6 +353,10 @@ class QuantPackage(models.Model):
values = {'location_id': False, 'company_id': self.env.user.company_id.id, 'owner_id': False}
if package.quant_ids:
values['location_id'] = package.quant_ids[0].location_id
if all(q.owner_id == package.quant_ids[0].owner_id for q in package.quant_ids):
values['owner_id'] = package.quant_ids[0].owner_id
if all(q.company_id == package.quant_ids[0].company_id for q in package.quant_ids):
values['company_id'] = package.quant_ids[0].company_id
package.location_id = values['location_id']
package.company_id = values['company_id']
package.owner_id = values['owner_id']