选择工序时,排除已经选择的工序
This commit is contained in:
@@ -75,7 +75,7 @@ class ManualProductModelTypeRoutingSort(models.Model):
|
|||||||
_description = '成品工序排序(人工线下加工)'
|
_description = '成品工序排序(人工线下加工)'
|
||||||
|
|
||||||
sequence = fields.Integer('Sequence')
|
sequence = fields.Integer('Sequence')
|
||||||
route_workcenter_id = fields.Many2one('mrp.routing.workcenter')
|
route_workcenter_id = fields.Many2one('mrp.routing.workcenter', domain=[('routing_type', 'in', ['人工线下加工'])])
|
||||||
is_repeat = fields.Boolean('重复', related='route_workcenter_id.is_repeat')
|
is_repeat = fields.Boolean('重复', related='route_workcenter_id.is_repeat')
|
||||||
routing_type = fields.Selection(string="工序类型", related='route_workcenter_id.routing_type')
|
routing_type = fields.Selection(string="工序类型", related='route_workcenter_id.routing_type')
|
||||||
workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
|
workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
|
||||||
|
|||||||
@@ -94,4 +94,10 @@ class ResMrpRoutingWorkcenter(models.Model):
|
|||||||
route_ids.append(t.route_id.surface_technics_id.id)
|
route_ids.append(t.route_id.surface_technics_id.id)
|
||||||
domain = [('id', 'not in', route_ids), ('routing_tag', '=', 'special')]
|
domain = [('id', 'not in', route_ids), ('routing_tag', '=', 'special')]
|
||||||
return self._search(domain, limit=limit, access_rights_uid=name_get_uid)
|
return self._search(domain, limit=limit, access_rights_uid=name_get_uid)
|
||||||
|
if self._context.get('is_duplicate') and self._context.get('model_type'):
|
||||||
|
# 查询出已经选择的工序
|
||||||
|
model_type = self.env[self._context.get('model_type')].search_read([],['route_workcenter_id'])
|
||||||
|
route_workcenter_ids = [item['route_workcenter_id'][0] if item['route_workcenter_id'] else False for item in model_type]
|
||||||
|
domain = args + [('id', 'not in', route_workcenter_ids)]
|
||||||
|
return self._search(domain, limit=limit, access_rights_uid=name_get_uid)
|
||||||
return super()._name_search(name, args, operator, limit, name_get_uid)
|
return super()._name_search(name, args, operator, limit, name_get_uid)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
<field name='product_routing_tmpl_ids'>
|
<field name='product_routing_tmpl_ids'>
|
||||||
<tree editable='bottom'>
|
<tree editable='bottom'>
|
||||||
<field name="sequence" widget="handle" string="序号"/>
|
<field name="sequence" widget="handle" string="序号"/>
|
||||||
<field name="route_workcenter_id" string="工序" options="{'no_create': True}"/>
|
<field name="route_workcenter_id" string="工序" options="{'no_create': True}" context="{'is_duplicate': True, 'model_type': 'sf.product.model.type.routing.sort'}"/>
|
||||||
<field name="routing_type" string="类型"/>
|
<field name="routing_type" string="类型"/>
|
||||||
<field name="is_repeat" string="重复"/>
|
<field name="is_repeat" string="重复"/>
|
||||||
<field name="workcenter_ids" string="工作中心" widget="many2many_tags"/>
|
<field name="workcenter_ids" string="工作中心" widget="many2many_tags"/>
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
<field name='manual_product_routing_tmpl_ids'>
|
<field name='manual_product_routing_tmpl_ids'>
|
||||||
<tree editable='bottom'>
|
<tree editable='bottom'>
|
||||||
<field name="sequence" widget="handle" string="序号"/>
|
<field name="sequence" widget="handle" string="序号"/>
|
||||||
<field name="route_workcenter_id" string="工序" options="{'no_create': True}"/>
|
<field name="route_workcenter_id" string="工序" options="{'no_create': True}" context="{'is_duplicate': True, 'model_type': 'sf.manual.product.model.type.routing.sort'}}"/>
|
||||||
<field name="routing_type" string="类型"/>
|
<field name="routing_type" string="类型"/>
|
||||||
<field name="is_repeat" string="重复"/>
|
<field name="is_repeat" string="重复"/>
|
||||||
<field name="workcenter_ids" string="工作中心" widget="many2many_tags"/>
|
<field name="workcenter_ids" string="工作中心" widget="many2many_tags"/>
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
<field name='embryo_routing_tmpl_ids'>
|
<field name='embryo_routing_tmpl_ids'>
|
||||||
<tree editable='bottom'>
|
<tree editable='bottom'>
|
||||||
<field name="sequence" widget="handle" string="序号"/>
|
<field name="sequence" widget="handle" string="序号"/>
|
||||||
<field name="route_workcenter_id" string="工序" options="{'no_create': True}"/>
|
<field name="route_workcenter_id" string="工序" options="{'no_create': True}" context="{'is_duplicate': True, 'model_type': 'sf.embryo.model.type.routing.sort'}}"/>
|
||||||
<field name="routing_type" string="类型"/>
|
<field name="routing_type" string="类型"/>
|
||||||
<field name="is_repeat" string="重复"/>
|
<field name="is_repeat" string="重复"/>
|
||||||
<field name="workcenter_ids" string="工作中心" widget="many2many_tags"/>
|
<field name="workcenter_ids" string="工作中心" widget="many2many_tags"/>
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
<field name='surface_technics_routing_tmpl_ids' style="white-space: pre-wrap;">
|
<field name='surface_technics_routing_tmpl_ids' style="white-space: pre-wrap;">
|
||||||
<tree editable='bottom'>
|
<tree editable='bottom'>
|
||||||
<field name="sequence" widget="handle" string="序号"/>
|
<field name="sequence" widget="handle" string="序号"/>
|
||||||
<field name="route_workcenter_id" string="工序" options="{'no_create': True}"/>
|
<field name="route_workcenter_id" string="工序" options="{'no_create': True}" context="{'is_duplicate': True, 'model_type': 'sf.surface_technics.model.type.routing.sort'}}"/>
|
||||||
<field name="routing_type" string="类型"/>
|
<field name="routing_type" string="类型"/>
|
||||||
<field name="is_repeat" string="重复"/>
|
<field name="is_repeat" string="重复"/>
|
||||||
<field name="workcenter_ids" string="工作中心" widget="many2many_tags"/>
|
<field name="workcenter_ids" string="工作中心" widget="many2many_tags"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user