选择工序时,排除已经选择的工序
This commit is contained in:
@@ -94,9 +94,9 @@ class ResMrpRoutingWorkcenter(models.Model):
|
||||
route_ids.append(t.route_id.surface_technics_id.id)
|
||||
domain = [('id', 'not in', route_ids), ('routing_tag', '=', 'special')]
|
||||
return self._search(domain, limit=limit, access_rights_uid=name_get_uid)
|
||||
if self._context.get('is_duplicate') and self._context.get('model_type'):
|
||||
if self._context.get('is_duplicate') and self._context.get('model_name'):
|
||||
# 查询出已经选择的工序
|
||||
model_type = self.env[self._context.get('model_type')].search_read([],['route_workcenter_id'])
|
||||
model_type = self.env[self._context.get('model_name')].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)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<data>
|
||||
#------------------模型类型------------------
|
||||
|
||||
<record model="ir.ui.view" id="search_sf_model_type_view">
|
||||
<record model="ir.ui.view" id="search_sf_model_name_view">
|
||||
<field name="name">search.sf.model.type</field>
|
||||
<field name="model">sf.model.type</field>
|
||||
<field name="arch" type="xml">
|
||||
@@ -14,7 +14,7 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="tree_sf_model_type_view">
|
||||
<record model="ir.ui.view" id="tree_sf_model_name_view">
|
||||
<field name="name">tree.sf.model.type</field>
|
||||
<field name="model">sf.model.type</field>
|
||||
<field name="arch" type="xml">
|
||||
@@ -24,7 +24,7 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="form_sf_model_type">
|
||||
<record model="ir.ui.view" id="form_sf_model_name">
|
||||
<field name="name">form.sf.model.type</field>
|
||||
<field name="model">sf.model.type</field>
|
||||
<field name="arch" type="xml">
|
||||
@@ -37,7 +37,7 @@
|
||||
<field name='product_routing_tmpl_ids'>
|
||||
<tree editable='bottom'>
|
||||
<field name="sequence" widget="handle" string="序号"/>
|
||||
<field name="route_workcenter_id" string="工序" options="{'no_create': True}" context="{'is_duplicate': True, 'model_type': 'sf.product.model.type.routing.sort'}"/>
|
||||
<field name="route_workcenter_id" string="工序" options="{'no_create': True}" context="{'is_duplicate': True, 'model_name': 'sf.product.model.type.routing.sort'}"/>
|
||||
<field name="routing_type" string="类型"/>
|
||||
<field name="is_repeat" string="重复"/>
|
||||
<field name="workcenter_ids" string="工作中心" widget="many2many_tags"/>
|
||||
@@ -48,7 +48,7 @@
|
||||
<field name='manual_product_routing_tmpl_ids'>
|
||||
<tree editable='bottom'>
|
||||
<field name="sequence" widget="handle" string="序号"/>
|
||||
<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="route_workcenter_id" string="工序" options="{'no_create': True}" context="{'is_duplicate': True, 'model_name': 'sf.manual.product.model.type.routing.sort'}"/>
|
||||
<field name="routing_type" string="类型"/>
|
||||
<field name="is_repeat" string="重复"/>
|
||||
<field name="workcenter_ids" string="工作中心" widget="many2many_tags"/>
|
||||
@@ -59,7 +59,7 @@
|
||||
<field name='embryo_routing_tmpl_ids'>
|
||||
<tree editable='bottom'>
|
||||
<field name="sequence" widget="handle" string="序号"/>
|
||||
<field name="route_workcenter_id" string="工序" options="{'no_create': True}" context="{'is_duplicate': True, 'model_type': 'sf.embryo.model.type.routing.sort'}}"/>
|
||||
<field name="route_workcenter_id" string="工序" options="{'no_create': True}" context="{'is_duplicate': True, 'model_name': 'sf.embryo.model.type.routing.sort'}"/>
|
||||
<field name="routing_type" string="类型"/>
|
||||
<field name="is_repeat" string="重复"/>
|
||||
<field name="workcenter_ids" string="工作中心" widget="many2many_tags"/>
|
||||
@@ -70,7 +70,7 @@
|
||||
<field name='surface_technics_routing_tmpl_ids' style="white-space: pre-wrap;">
|
||||
<tree editable='bottom'>
|
||||
<field name="sequence" widget="handle" string="序号"/>
|
||||
<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="route_workcenter_id" string="工序" options="{'no_create': True}" context="{'is_duplicate': True, 'model_name': 'sf.surface_technics.model.type.routing.sort'}"/>
|
||||
<field name="routing_type" string="类型"/>
|
||||
<field name="is_repeat" string="重复"/>
|
||||
<field name="workcenter_ids" string="工作中心" widget="many2many_tags"/>
|
||||
@@ -81,7 +81,7 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_sf_model_type" model="ir.actions.act_window">
|
||||
<record id="action_sf_model_name" model="ir.actions.act_window">
|
||||
<field name="name">模型类型</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.model.type</field>
|
||||
@@ -96,11 +96,11 @@
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
id="menu_sf_model_type"
|
||||
id="menu_sf_model_name"
|
||||
name="模型类型"
|
||||
parent="mrp.menu_mrp_configuration"
|
||||
sequence="9"
|
||||
action="action_sf_model_type"
|
||||
action="action_sf_model_name"
|
||||
/>
|
||||
</data>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user