修改坯料冗余
This commit is contained in:
@@ -93,7 +93,11 @@ class sf_production_plan(models.Model):
|
||||
|
||||
@api.model
|
||||
def search_read(self, domain=None, fields=None, offset=0, limit=None, order=None):
|
||||
|
||||
"""
|
||||
修改搜索方法,只有制造订单状态为待排程时才显示
|
||||
"""
|
||||
domain = domain or []
|
||||
domain.append(('production_id.state', '!=', 'confirmed'))
|
||||
info = super(sf_production_plan, self).search_read(domain, fields, offset, limit, order)
|
||||
return info
|
||||
|
||||
@@ -446,8 +450,12 @@ class MrpProductionInheritForPlan(models.Model):
|
||||
def toggle_active(self):
|
||||
# 调用父类方法切换 active 状态
|
||||
res = super(MrpProductionInheritForPlan, self).toggle_active()
|
||||
stage_active = self.filtered('active')
|
||||
stage_inactive = self - stage_active
|
||||
self.env['sf.production.plan'].search(
|
||||
[('production_id', '=', self.id), '|', ('active', '=', False), ('active', '=', True)]).write(
|
||||
{'active': self.active})
|
||||
|
||||
[('production_id', 'in', stage_active.ids)]).write(
|
||||
{'active': True})
|
||||
self.env['sf.production.plan'].search(
|
||||
[('production_id', 'in', stage_inactive.ids)]).write(
|
||||
{'active': False})
|
||||
return res
|
||||
|
||||
Reference in New Issue
Block a user