增加非自动化原因
This commit is contained in:
@@ -190,3 +190,16 @@ class SaleOrderLine(models.Model):
|
||||
if vals['supply_method'] == 'purchase' and line.is_incoming_material:
|
||||
raise UserError('当前(%s)产品为客供料,不能选择外购' % ','.join(line.mapped('product_id.name')))
|
||||
return super(SaleOrderLine, self).write(vals)
|
||||
|
||||
cancel_auto_machining = fields.Boolean('是否取消自动化加工', compute='_compute_cancel_auto_machining', store=True)
|
||||
cancel_auto_machining_reason = fields.Char('非自动化加工原因')
|
||||
|
||||
def _compute_cancel_auto_machining(self):
|
||||
for line in self:
|
||||
line.cancel_auto_machining = True if line.product_id.auto_machining \
|
||||
and line.supply_method != 'automation' else False
|
||||
|
||||
@api.onchange('product_id')
|
||||
def _onchange_product_id_set_supply_method(self):
|
||||
if self.product_id.auto_machining:
|
||||
self.supply_method = 'automation'
|
||||
|
||||
Reference in New Issue
Block a user