Accept Merge Request #1054: (feature/修复报价选择已有产品确认问题 -> develop)

Merge Request: 修复报价选择已有产品确认问题

Created By: @杨金灵
Reviewed By: @马广威
Approved By: @马广威 
Accepted By: @杨金灵
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1054?initial=true
This commit is contained in:
杨金灵
2024-05-30 16:52:27 +08:00
committed by Coding
3 changed files with 14 additions and 1 deletions

View File

@@ -379,6 +379,12 @@ class MrpProduction(models.Model):
workorders_values.append(
self.env['mrp.workorder'].json_workorder_str('', production, route))
production.workorder_ids = workorders_values
if production_programming.programming_state == '已编程':
logging.info("production_programming: %s" % production_programming.name)
production.workorder_ids.filtered(lambda t: t.routing_type == 'CNC加工').write({
'cnc_ids': production_programming.workorder_ids.filtered(
lambda
t1: t1.routing_type == 'CNC加工').cnc_ids})
for workorder in production.workorder_ids:
workorder.duration_expected = workorder._get_duration_expected()

View File

@@ -1337,6 +1337,13 @@ class WorkPieceDelivery(models.Model):
obj = super(WorkPieceDelivery, self).create(vals)
return obj
@api.constrains('name')
def _check_name(self):
if self.type == '运送空料架':
wd = self.sudo().search([('name', '=', self.name), ('id', '!=', self.id)])
if wd:
raise UserError("该名称已存在")
def action_delivery_history(self):
return {
'name': _('配送历史'),

View File

@@ -667,7 +667,7 @@
<field name="name">空料架配送</field>
<field name="model">sf.workpiece.delivery</field>
<field name="arch" type="xml">
<tree string="工件配送" editable="bottom" class="center" delete="0">
<tree string="工件配送" editable="bottom" class="center" delete="0" create="1">
<header>
<button name="button_delivery" type="object" string="配送" class="oe_highlight"/>
</header>