Skip to content

Commit

Permalink
[IMP] stock: quant_package owner and company
Browse files Browse the repository at this point in the history
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
  • Loading branch information
pimodoo committed Aug 9, 2018
1 parent 23415c2 commit e01620c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions addons/stock/models/stock_quant.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ def _compute_package_info(self):
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']
Expand Down

0 comments on commit e01620c

Please sign in to comment.