mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
Merge pull request #120 from Antiun/imp-mrp_project_analytic_parent
[8.0][IMP][mrp_project] If production come from a sale order, set project parent
This commit is contained in:
@@ -17,10 +17,17 @@ class MrpProduction(models.Model):
|
||||
|
||||
@api.model
|
||||
def _prepare_project_vals(self, production):
|
||||
# If this production come from a sale order and that order
|
||||
# has an analytic account assigned, then project is child of
|
||||
# that analytic account
|
||||
parent_id = False
|
||||
if 'sale_id' in production._fields:
|
||||
parent_id = production.sale_id.project_id.id
|
||||
return {
|
||||
'name': production.name,
|
||||
'use_tasks': True,
|
||||
'automatic_creation': True,
|
||||
'parent_id': parent_id,
|
||||
}
|
||||
|
||||
@api.model
|
||||
|
||||
Reference in New Issue
Block a user