修改制造订单的状态字段以及与排程单的交互逻辑,优化一些翻译

This commit is contained in:
mgw
2024-01-08 19:02:59 +08:00
parent bc4a4df53e
commit fbaa81fe7a
6 changed files with 93 additions and 7 deletions

View File

@@ -12,14 +12,30 @@ class sf_production_plan(models.Model):
_name = 'sf.production.plan'
_description = 'sf_production_plan'
_inherit = ['mail.thread']
_order = 'state desc, write_date desc'
# _order = 'state desc, write_date desc'
state = fields.Selection([
('draft', '待排程'),
('done', '已排程'),
('processing', '加工'),
('processing', '加工'),
('finished', '已完成')
], string='工单状态', tracking=True)
state_order = fields.Integer(compute='_compute_state_order', store=True)
@api.depends('state')
def _compute_state_order(self):
order_mapping = {
'draft': 1,
'done': 2,
'processing': 3,
'finished': 4
}
for record in self:
record.state_order = order_mapping.get(record.state, 0)
_order = 'state_order asc, write_date desc'
name = fields.Char(string='工单编号')
active = fields.Boolean(string='已归档', default=True)
# selected = fields.Boolean(default=False)
@@ -51,6 +67,11 @@ class sf_production_plan(models.Model):
sequence = fields.Integer(string='序号', copy=False, readonly=True, index=True)
current_operation_name = fields.Char(string='当前工序名称', size=64, default='生产计划')
@api.onchange('state')
def _onchange_state(self):
if self.state == 'finished':
self.production_id.schedule_state = '已完成'
# @api.model
# def _search(self, args, offset=0, limit=None, order=None, count=False, access_rights_uid=None):
# """