Fix on_change_* methods

This commit is contained in:
Jes?s Mart?n Jim?nez 2016-07-05 13:24:17 +02:00
parent 47608418d0
commit 82de887b04
2 changed files with 4 additions and 10 deletions

View File

@ -35,11 +35,9 @@ class ProductBom:
@fields.depends('process', 'bom', 'route') @fields.depends('process', 'bom', 'route')
def on_change_process(self): def on_change_process(self):
res = {}
if self.process: if self.process:
res['bom'] = self.process.bom.id self.bom = self.process.bom
res['route'] = self.process.route.id self.route = self.process.route
return res
@classmethod @classmethod
def create(cls, vlist): def create(cls, vlist):

View File

@ -369,15 +369,11 @@ class Production:
@fields.depends(*(BOM_CHANGES + ['process', 'route', 'operations'])) @fields.depends(*(BOM_CHANGES + ['process', 'route', 'operations']))
def on_change_process(self): def on_change_process(self):
res = {}
if self.process: if self.process:
self.bom = self.process.bom self.bom = self.process.bom
res['bom'] = self.bom.id
self.route = self.process.route self.route = self.process.route
res['route'] = self.route.id self.on_change_route()
res.update(self.update_operations()) self.explode_bom()
res.update(self.explode_bom())
return res
@classmethod @classmethod
def compute_request(cls, product, warehouse, quantity, date, company): def compute_request(cls, product, warehouse, quantity, date, company):