Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into develop
# Conflicts: # sf_base/security/ir.model.access.csv # sf_base/views/mrs_common_view.xml # sf_route_workcenter/models/workcenter.py
This commit is contained in:
@@ -23,6 +23,22 @@ class ResMrpRoutingWorkcenter(models.Model):
|
||||
|
||||
company_id = fields.Many2one('res.company', compute="get_company_id", related=False)
|
||||
|
||||
# 工单对应的工作中心,根据工序中的工作中心去匹配,
|
||||
# 如果只配置了一个工作中心,则默认采用该工作中心;
|
||||
# 如果有多个工作中心,
|
||||
# 则根据该工作中心的工单个数进行分配(优先分配给工单个数最少的);
|
||||
def get_workcenter(self, workcenter_ids):
|
||||
if workcenter_ids:
|
||||
if len(workcenter_ids) == 1:
|
||||
return workcenter_ids[0]
|
||||
elif len(workcenter_ids) >= 2:
|
||||
# workcenter_ids_str = ','.join([str(s) for s in workcenter_ids])
|
||||
self.env.cr.execute("""
|
||||
SELECT workcenter_id FROM mrp_workorder where workcenter_id
|
||||
in %s group by workcenter_id
|
||||
order by count(*),workcenter_id asc limit 1 """, [tuple(workcenter_ids)])
|
||||
return self.env.cr.dictfetchall()[0].get('workcenter_id')
|
||||
|
||||
|
||||
class ModelTypeRoutingSort(models.Model):
|
||||
_name = 'sf.model.type.routing.sort'
|
||||
|
||||
@@ -14,6 +14,12 @@ access_mrs_materials_model,mrs_materials_model,model_mrs_materials_model,base.gr
|
||||
access_mrs_processing_technology,mrs_processing_technology,model_mrs_processing_technology,base.group_user,1,1,1,1
|
||||
access_sf_tray,sf_tray,model_sf_tray,base.group_user,1,1,1,1
|
||||
access_cnc_processing,cnc_processing,model_cnc_processing,base.group_user,1,1,1,1
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
access_sf_model_type,sf_model_type,model_sf_model_type,base.group_user,1,1,1,1
|
||||
access_sf_model_type_routing_sort,sf_model_type_routing_sort,model_sf_model_type_routing_sort,base.group_user,1,1,1,1
|
||||
|
||||
>>>>>>> a33b16cf78ac96c7254fa26cd71610cc3aef97fa
|
||||
|
||||
|
||||
|
||||
|
||||
|
Can't render this file because it has a wrong number of fields in line 17.
|
@@ -17,27 +17,49 @@
|
||||
</record>
|
||||
|
||||
#-----------------工单-------------------
|
||||
<record model="ir.ui.view" id="view_mrp_workorder_form_inherit_sf">
|
||||
<field name="name">mrp.workorder.form.inherit.sf</field>
|
||||
<record model="ir.ui.view" id="view_mrp_production_workorder_form_inherit_sf">
|
||||
<field name="name">mrp.production.workorder.form.inherit.sf</field>
|
||||
<field name="model">mrp.workorder</field>
|
||||
<field name="inherit_id" ref="mrp.mrp_production_workorder_tree_view"/>
|
||||
<field name="inherit_id" ref="mrp.mrp_production_workorder_form_view_inherit"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="production_id" position="after">
|
||||
<field name="processing_panel" readonly="1"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- <record model="ir.ui.view" id="view_mrp_production_workorder_tree_inherit_sf">-->
|
||||
<!-- <field name="name">mrp.production.workorder.tree.inherit.sf</field>-->
|
||||
<!-- <field name="model">mrp.workorder</field>-->
|
||||
<!-- <field name="inherit_id" ref="mrp.mrp_production_workorder_tree_view"/>-->
|
||||
<!-- <field name="arch" type="xml">-->
|
||||
<!-- <field name="workcenter_id" position="replace">-->
|
||||
<!-- <filter name="workcenter_ids" string="工作中心" />-->
|
||||
<!-- </field>-->
|
||||
<!-- </field>-->
|
||||
<!-- </record>-->
|
||||
|
||||
<!-- <record model="ir.ui.view" id="view_mrp_production_workorder_filter_inherit_sf">-->
|
||||
<!-- <field name="name">mrp.production.workorder.filter.inherit.sf</field>-->
|
||||
<!-- <field name="model">mrp.workorder</field>-->
|
||||
<!-- <field name="inherit_id" ref="mrp.view_mrp_production_workorder_form_view_filter"/>-->
|
||||
<!-- <field name="arch" type="xml">-->
|
||||
<!-- <xpath expr="//filter[@name='work_center']" position="replace">-->
|
||||
<!-- <filter name="work_center" string="工作中心" context="{'group_by': 'workcenter_ids'}"/>-->
|
||||
<!-- </xpath>-->
|
||||
<!-- </field>-->
|
||||
<!-- </record>-->
|
||||
|
||||
#-----------------制造订单里的工单-------------------
|
||||
<record model="ir.ui.view" id="view_mrp_production_workorder_tree_editable_inherit_sf">
|
||||
<field name="name">mrp.production.workorder.tree.editable.inherit.sf</field>
|
||||
<field name="model">mrp.workorder</field>
|
||||
<field name="inherit_id" ref="mrp.mrp_production_workorder_tree_editable_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="after">
|
||||
<field name="processing_panel"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
#-----------------制造订单-------------------
|
||||
<!-- <record model="ir.ui.view" id="view_mrp_production_form_inherit_sf">-->
|
||||
<!-- <field name="name">mrp.production.form.inherit.sf</field>-->
|
||||
<!-- <field name="model">mrp.production</field>-->
|
||||
<!-- <field name="inherit_id" ref="mrp.mrp_production_form_view"/>-->
|
||||
<!-- <field name="arch" type="xml">-->
|
||||
<!-- <field name="workorder_ids" position="after">-->
|
||||
|
||||
<!-- </field>-->
|
||||
<!-- </field>-->
|
||||
<!-- </record>-->
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -277,10 +277,26 @@
|
||||
</record>
|
||||
|
||||
#------------------托盘------------------
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
<record id="action_sf_tray" model="ir.actions.act_window">
|
||||
<field name="name">托盘</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.tray</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
创建托盘吧
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
>>>>>>> a33b16cf78ac96c7254fa26cd71610cc3aef97fa
|
||||
<record id="view_sf_tray_search" model="ir.ui.view">
|
||||
<field name="name">sf.tray.search</field>
|
||||
<field name="model">sf.tray</field>
|
||||
<field name="arch" type="xml">
|
||||
<<<<<<< HEAD
|
||||
<!-- <group>-->
|
||||
|
||||
|
||||
@@ -293,6 +309,12 @@
|
||||
<filter name="state" string="状态" domain="[]" context="{'group_by': 'state'}"/>
|
||||
</group>
|
||||
<!-- </group>-->
|
||||
=======
|
||||
<search string="托盘">
|
||||
<field name="name" string="名称" filter_domain="[('name','ilike',self)]"/>
|
||||
<field name="code" string="编码" filter_domain="[('code','ilike',self)]"/>
|
||||
</search>
|
||||
>>>>>>> a33b16cf78ac96c7254fa26cd71610cc3aef97fa
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -312,7 +334,9 @@
|
||||
<field name="name">sf.tray.form</field>
|
||||
<field name="model">sf.tray</field>
|
||||
<field name="arch" type="xml">
|
||||
<header><field name = 'state' widget="radio" options="{'horizontal': True}"/></header>
|
||||
<header>
|
||||
<field name='state' widget="radio" options="{'horizontal': True}"/>
|
||||
</header>
|
||||
<form string="托盘">
|
||||
<group string="基本信息" name="group1">
|
||||
<group>
|
||||
@@ -326,6 +350,7 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<<<<<<< HEAD
|
||||
<record id="action_sf_tray" model="ir.actions.act_window">
|
||||
<field name="name">托盘</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
@@ -337,6 +362,8 @@
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
=======
|
||||
>>>>>>> a33b16cf78ac96c7254fa26cd71610cc3aef97fa
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -11,3 +11,5 @@ class ResMrpWorkOrder(models.Model):
|
||||
|
||||
workcenter_id = fields.Many2one('mrp.workcenter', required=False)
|
||||
processing_panel = fields.Char('加工面')
|
||||
|
||||
|
||||
|
||||
@@ -31,10 +31,6 @@ class MrpProduction(models.Model):
|
||||
|
||||
# 重载根据工序生成工单的程序:如果产品BOM中没有工序时,
|
||||
# 根据产品对应的模板类型中工序,去生成工单;
|
||||
# 工单对应的工作中心,根据工序中的工作中心去匹配,
|
||||
# 如果只配置了一个工作中心,则默认采用该工作中心;
|
||||
# 如果有多个工作中心,
|
||||
# 则根据该工作中心的工单个数进行分配(优先分配给工单个数最少的);
|
||||
# CNC加工工序的选取规则:
|
||||
# 如果自动报价有带过来预分配的机床,
|
||||
# 则根据设备找到工作中心;否则采用前面描述的工作中心分配机制;
|
||||
@@ -68,17 +64,17 @@ class MrpProduction(models.Model):
|
||||
'operation_id': operation.id,
|
||||
'state': 'pending',
|
||||
}]
|
||||
# 根据加工面板的面数及对应的工序模板生成工序
|
||||
# 根据加工面板的面数及对应的工序模板生成工单
|
||||
for k in (production.product_id.processing_panel.split(',')):
|
||||
for route in production.product_id.model_type_id.routing_tmpl_ids:
|
||||
if route.route_workcenter_id:
|
||||
if route:
|
||||
workorders_values_str = [0, '', {
|
||||
'product_uom_id': production.product_uom_id.id,
|
||||
'qty_producing': 0,
|
||||
'operation_id': False,
|
||||
'name': route.route_workcenter_id.name,
|
||||
'processing_panel': k,
|
||||
'workcenter_id': False,
|
||||
'workcenter_id': self.env['mrp.routing.workcenter'].get_workcenter(route.workcenter_ids.ids),
|
||||
'date_planned_start': False,
|
||||
'date_planned_finished': False,
|
||||
'duration_expected': 60,
|
||||
|
||||
@@ -8,8 +8,14 @@ import qrcode
|
||||
|
||||
from io import BytesIO
|
||||
from odoo import api, fields, models
|
||||
<<<<<<< HEAD
|
||||
|
||||
from pystrich.code128 import Code128Encoder
|
||||
=======
|
||||
import barcode
|
||||
# from barcode.writer import ImageWriter
|
||||
# from pystrich.code128 import Code128Encoder
|
||||
>>>>>>> a33b16cf78ac96c7254fa26cd71610cc3aef97fa
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
Reference in New Issue
Block a user