更新制造订单生成工单时的工序字段
This commit is contained in:
@@ -82,7 +82,7 @@ class MrpWorkOrder(models.Model):
|
||||
_inherit = 'mrp.workorder'
|
||||
_description = '工单'
|
||||
|
||||
tray_ids = fields.One2many('sf.tray', 'workorder_id', string='托盘')
|
||||
|
||||
# def get_tray_info(self):
|
||||
# @api.onchange('X_axis', 'Y_axis', 'Z_axis')
|
||||
# def get_center_point(self):
|
||||
@@ -241,7 +241,7 @@ class MrpWorkOrder(models.Model):
|
||||
productions = self.production_id
|
||||
self.env['stock.move'].sudo().create(productions._get_moves_raw_values())
|
||||
self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
|
||||
productions.create_workorder1(self.processing_panel)
|
||||
productions._create_workorder2(self.processing_panel)
|
||||
return ""
|
||||
|
||||
def fetchCNC(self):
|
||||
@@ -279,7 +279,26 @@ class MrpProduction(models.Model):
|
||||
'user_id': production.user_id.id}
|
||||
return production_values_str
|
||||
|
||||
def create_workorder1(self, k):
|
||||
def _reset_work_order_sequence1(self,k):
|
||||
for rec in self:
|
||||
current_sequence = 1
|
||||
for work in rec.workorder_ids:
|
||||
if work.processing_panel == '':
|
||||
work.sequence = current_sequence
|
||||
current_sequence += 1
|
||||
for work in rec.workorder_ids:
|
||||
if work.processing_panel == k:
|
||||
work.sequence = current_sequence
|
||||
current_sequence += 1
|
||||
for work in rec.workorder_ids:
|
||||
if work.processing_panel != k and work.processing_panel != "":
|
||||
work.sequence = current_sequence
|
||||
current_sequence += 1
|
||||
|
||||
|
||||
|
||||
|
||||
def _create_workorder1(self, k):
|
||||
for production in self:
|
||||
if not production.bom_id or not production.product_id:
|
||||
continue
|
||||
@@ -320,10 +339,12 @@ class MrpProduction(models.Model):
|
||||
i += 1
|
||||
for route in routingworkcenter:
|
||||
|
||||
if route.routing_type == 'CNC加工':
|
||||
workorders_values.append(
|
||||
self.env['mrp.workorder'].json_workorder_str(k, production, route))
|
||||
|
||||
if route.routing_type == '后置三元质量检测':
|
||||
workorders_values.append(
|
||||
self.env['mrp.workorder'].json_workorder_str(k, production, route)
|
||||
)
|
||||
if route.routing_type == 'CNC加工':
|
||||
workorders_values.append(
|
||||
self.env['mrp.workorder'].json_workorder_str(k, production, route))
|
||||
|
||||
@@ -331,6 +352,11 @@ class MrpProduction(models.Model):
|
||||
for workorder in production.workorder_ids:
|
||||
workorder.duration_expected = workorder._get_duration_expected()
|
||||
|
||||
def _create_workorder2(self, k):
|
||||
res = self._create_workorder1(k)
|
||||
self._reset_work_order_sequence1(k)
|
||||
return res
|
||||
|
||||
|
||||
class Attachment(models.Model):
|
||||
_inherit = 'ir.attachment'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<odoo>
|
||||
<data>
|
||||
<!-- 托盘码打印尺寸-->
|
||||
<!-- 托盘码打印尺寸-->
|
||||
<record id="sf_tray1" model="report.paperformat">
|
||||
<field name="name">Dymo Label Sheet</field>
|
||||
<field name="default" eval="True"/>
|
||||
@@ -16,7 +16,7 @@
|
||||
<field name="dpi">96</field>
|
||||
</record>
|
||||
|
||||
<!-- 托盘码打印动作-->
|
||||
<!-- 托盘码打印动作-->
|
||||
<record id="label_sf_tray_code" model="ir.actions.report">
|
||||
<field name="name">打印条形码</field>
|
||||
<field name="model">sf.tray</field>
|
||||
@@ -28,7 +28,7 @@
|
||||
<field name="paperformat_id" ref="sf_route_workcenter.sf_tray1"/>
|
||||
|
||||
</record>
|
||||
<!-- 托盘码打印模板-->
|
||||
<!-- 托盘码打印模板-->
|
||||
<template id="sf_tray_template">
|
||||
<t t-call="web.html_container">
|
||||
<t t-call="web.external_layout">
|
||||
@@ -65,10 +65,11 @@
|
||||
<t t-call="web.external_layout">
|
||||
<t t-foreach="docs" t-as="o">
|
||||
<div class="page">
|
||||
|
||||
<div t-field="o.production_id.name"
|
||||
t-options="{'widget': 'barcode', 'width': 600, 'height': 100, 'img_style': 'width:350px;height:60px'}"/>
|
||||
<div t-field="o.production_id" style="text-align: center"/>
|
||||
|
||||
<div t-field="o.name" style="text-align: center"/>
|
||||
|
||||
</div>
|
||||
|
||||
</t>
|
||||
@@ -78,8 +79,5 @@
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
@@ -247,12 +247,21 @@
|
||||
</xpath>
|
||||
<xpath expr="//page[last()]" position="after">
|
||||
<page string="解除装夹" attrs='{"invisible": [("routing_type","!=","解除装夹")]}' >
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<group>
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<button type="object" class="oe_highlight" name="unbindtray" string="解除装夹"
|
||||
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<button type="action" class="oe_highlight" name="sf_route_workcenter.label_sf_tray_code1" string="打印标签"
|
||||
|
||||
/>
|
||||
</div>
|
||||
</group>
|
||||
|
||||
|
||||
</page>
|
||||
|
||||
</xpath>
|
||||
|
||||
Reference in New Issue
Block a user