增加自动化产线的零件供货路线初始化为自动化产线加工
This commit is contained in:
@@ -22,6 +22,9 @@ class SaleOrder(models.Model):
|
|||||||
|
|
||||||
def confirm_to_supply_method(self):
|
def confirm_to_supply_method(self):
|
||||||
self.state = 'supply method'
|
self.state = 'supply method'
|
||||||
|
for line in self.order_line:
|
||||||
|
if line.product_id.auto_machining:
|
||||||
|
line.supply_method = 'automation'
|
||||||
|
|
||||||
def action_confirm(self):
|
def action_confirm(self):
|
||||||
if self._get_forbidden_state_confirm() & set(self.mapped('state')):
|
if self._get_forbidden_state_confirm() & set(self.mapped('state')):
|
||||||
@@ -192,14 +195,12 @@ class SaleOrderLine(models.Model):
|
|||||||
return super(SaleOrderLine, self).write(vals)
|
return super(SaleOrderLine, self).write(vals)
|
||||||
|
|
||||||
cancel_auto_machining = fields.Boolean('是否取消自动化加工', compute='_compute_cancel_auto_machining', store=True)
|
cancel_auto_machining = fields.Boolean('是否取消自动化加工', compute='_compute_cancel_auto_machining', store=True)
|
||||||
cancel_auto_machining_reason = fields.Char('非自动化加工原因')
|
cancel_auto_machining_reason = fields.Char('更改供货原因')
|
||||||
|
|
||||||
|
@api.depends('product_id', 'supply_method')
|
||||||
def _compute_cancel_auto_machining(self):
|
def _compute_cancel_auto_machining(self):
|
||||||
for line in self:
|
for line in self:
|
||||||
line.cancel_auto_machining = True if line.product_id.auto_machining \
|
line.cancel_auto_machining = True if line.product_id.auto_machining \
|
||||||
and line.supply_method != 'automation' else False
|
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'
|
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
<xpath expr="//field[@name='order_line']/tree/field[@name='glb_url']" position="before">
|
<xpath expr="//field[@name='order_line']/tree/field[@name='glb_url']" position="before">
|
||||||
<field name="part_number" optional="show" class="section_and_note_text"/>
|
<field name="part_number" optional="show" class="section_and_note_text"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
<xpath expr="//field[@name='order_line']/tree/field[@name='remark']" position="before">
|
||||||
|
<field name="cancel_auto_machining" invisible="1"/>
|
||||||
|
<field name="cancel_auto_machining_reason" optional="show" attrs="{'required': [('cancel_auto_machining', '=', True),('state', 'not in', ['draft', 'sent'])]}"/>
|
||||||
|
</xpath>
|
||||||
|
|
||||||
<!-- <xpath expr="//header/button[@name='action_cancel']" position="attributes"> -->
|
<!-- <xpath expr="//header/button[@name='action_cancel']" position="attributes"> -->
|
||||||
<!-- <attribute name="attrs">{'invisible': [('state', '!=', 'draft')]}</attribute> -->
|
<!-- <attribute name="attrs">{'invisible': [('state', '!=', 'draft')]}</attribute> -->
|
||||||
|
|||||||
Reference in New Issue
Block a user