[FIX] mrp : prevent error when creating new record of mrp.workorder in tree view
while we are creating a new record of the mrp.workorder from the editable list view (mrp_production_workorder_tree_editable_view), we are getting the singleton error, as it is not taking any production record. by applying this commit, it will resolve that singleton error sentry - 3982694755 closes odoo/odoo#115862 X-original-commit: 91e7d36a48d58aea1d63999dd150b543983aeba1 Signed-off-by: Tiffany Chang <tic@odoo.com>
This commit is contained in:
@@ -433,9 +433,10 @@ class MrpWorkorder(models.Model):
|
||||
|
||||
@api.onchange('finished_lot_id')
|
||||
def _onchange_finished_lot_id(self):
|
||||
res = self.production_id._can_produce_serial_number(sn=self.finished_lot_id)
|
||||
if res is not True:
|
||||
return res
|
||||
if self.production_id:
|
||||
res = self.production_id._can_produce_serial_number(sn=self.finished_lot_id)
|
||||
if res is not True:
|
||||
return res
|
||||
|
||||
def write(self, values):
|
||||
if 'production_id' in values and any(values['production_id'] != w.production_id.id for w in self):
|
||||
|
||||
Reference in New Issue
Block a user