diff --git a/jikimo_sale_multiple_supply_methods/__init__.py b/jikimo_sale_multiple_supply_methods/__init__.py
index e7a30879..62b89387 100644
--- a/jikimo_sale_multiple_supply_methods/__init__.py
+++ b/jikimo_sale_multiple_supply_methods/__init__.py
@@ -7,11 +7,16 @@ from odoo import api, SUPERUSER_ID
def _data_install(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})
# 获取所有需要设置的产品模板
- env.ref('jikimo_sale_multiple_supply_methods.product_product_purchase').product_tmpl_id.write({'active': False})
- env.ref('jikimo_sale_multiple_supply_methods.product_product_manual_processing').product_tmpl_id.write({'active': False, 'single_manufacturing': True})
- env.ref('jikimo_sale_multiple_supply_methods.product_product_default').product_tmpl_id.write({'active': False})
- env.ref('jikimo_sale_multiple_supply_methods.product_product_raw_material_customer_provided').product_tmpl_id.write({'active': False})
- env.ref('jikimo_sale_multiple_supply_methods.product_product_outsourcing').product_tmpl_id.write({'active': False})
+ env.ref('jikimo_sale_multiple_supply_methods.product_template_purchase').product_variant_id.write({'active': False, 'is_bfm': True})
+ env.ref('jikimo_sale_multiple_supply_methods.product_template_manual_processing').product_variant_id.write({'active': False, 'single_manufacturing': True, 'is_bfm': True})
+ env.ref('jikimo_sale_multiple_supply_methods.product_template_default').product_variant_id.write({'active': False, 'is_bfm': True})
+ env.ref('jikimo_sale_multiple_supply_methods.product_template_raw_material_customer_provided').product_variant_id.write({'active': False})
+ env.ref('jikimo_sale_multiple_supply_methods.product_template_outsourcing').product_variant_id.write({'active': False, 'is_bfm': True})
+ env.ref('sf_dlm.product_embryo_sf_self_machining').product_tmpl_id.write({'categ_type': '坯料'})
+ env.ref('sf_dlm.product_template_sf').product_tmpl_id.write({'categ_type': '成品'})
+ env.ref('sf_dlm.product_embryo_sf_outsource').product_tmpl_id.write({'categ_type': '坯料'})
+ env.ref('sf_dlm.product_embryo_sf_purchase').product_tmpl_id.write({'categ_type': '坯料'})
+
# 为三步制造增加规则
warehouse = env['stock.warehouse'].search([('company_id', '=', env.company.id)], limit=1)
product_route_id = warehouse.pbm_route_id
diff --git a/jikimo_sale_multiple_supply_methods/__manifest__.py b/jikimo_sale_multiple_supply_methods/__manifest__.py
index b39d70a8..a7d39ac7 100644
--- a/jikimo_sale_multiple_supply_methods/__manifest__.py
+++ b/jikimo_sale_multiple_supply_methods/__manifest__.py
@@ -6,7 +6,7 @@
'author': 'fox',
'website': '',
'category': '',
- 'depends': ['product', 'sf_dlm', 'sale_stock', 'sf_sale'],
+ 'depends': ['sf_dlm', 'sale_stock', 'sf_sale'],
"data": [
'security/ir.model.access.csv',
'data/stock_routes.xml',
diff --git a/jikimo_sale_multiple_supply_methods/controllers/main.py b/jikimo_sale_multiple_supply_methods/controllers/main.py
index 17a8c9a4..9127f80e 100644
--- a/jikimo_sale_multiple_supply_methods/controllers/main.py
+++ b/jikimo_sale_multiple_supply_methods/controllers/main.py
@@ -19,7 +19,8 @@ class JikimoSaleRoutePicking(Sf_Bf_Connect):
res = {'status': 1, 'factory_order_no': ''}
# _logger.info('get_bfm_process_order_list:%s' % kw['order_number'])
try:
- product_id = request.env.ref('jikimo_sale_multiple_supply_methods.product_product_default').sudo()
+ product_id = request.env.ref('jikimo_sale_multiple_supply_methods.product_template_default').with_context(active_test=False).sudo().product_variant_id
+ _logger.info('product_id:%s' % product_id)
company_id = request.env.ref('base.main_company').sudo()
bfm_process_order_list = json.loads(kw['bfm_process_order_list'])
order_id = request.env['sale.order'].with_user(request.env.ref("base.user_admin")).sale_order_create(
diff --git a/jikimo_sale_multiple_supply_methods/data/product_data.xml b/jikimo_sale_multiple_supply_methods/data/product_data.xml
index 40c8ca63..dc9b70a7 100644
--- a/jikimo_sale_multiple_supply_methods/data/product_data.xml
+++ b/jikimo_sale_multiple_supply_methods/data/product_data.xml
@@ -1,7 +1,7 @@
-
+
人工线下加工模板
@@ -15,11 +15,11 @@
true
serial
- true
+
true
-
+
成品外购模板
@@ -30,10 +30,10 @@
- true
+
-
+
成品委外加工模板
@@ -44,10 +44,10 @@
- true
+
-
+
成品初始化模板
@@ -57,7 +57,7 @@
- true
+
@@ -65,7 +65,7 @@
-
+
坯料客供料模板
@@ -79,12 +79,20 @@
+
-
- 坯料加工模板(人工线下加工)
+
true
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jikimo_sale_multiple_supply_methods/models/quick_easy_order.py b/jikimo_sale_multiple_supply_methods/models/quick_easy_order.py
index d61d3a6f..89d3a6d8 100644
--- a/jikimo_sale_multiple_supply_methods/models/quick_easy_order.py
+++ b/jikimo_sale_multiple_supply_methods/models/quick_easy_order.py
@@ -56,7 +56,7 @@ class QuickEasyOrder(models.Model):
'part_name': '',
})
company_id = self.env.ref('base.main_company').sudo()
- product_id = self.env.ref('jikimo_sale_multiple_supply_methods.product_product_default').sudo()
+ product_id = self.env.ref('jikimo_sale_multiple_supply_methods.product_template_default').sudo().with_context(active_test=False).product_variant_id
# user_id = request.env.ref('base.user_admin').sudo()
order_id = self.env['sale.order'].sale_order_create(company_id, 'XXXXX', 'XXXXX', 'XXXXX',
str(datetime.now()), '现结', '支付宝', state='draft')
diff --git a/jikimo_sale_multiple_supply_methods/models/sale_order.py b/jikimo_sale_multiple_supply_methods/models/sale_order.py
index 822958ec..27cecac6 100644
--- a/jikimo_sale_multiple_supply_methods/models/sale_order.py
+++ b/jikimo_sale_multiple_supply_methods/models/sale_order.py
@@ -21,25 +21,28 @@ class SaleOrder(models.Model):
self.state = 'supply method'
def action_confirm(self):
+ # 判断是否所有产品都选择了供货方式
+ filter_line = self.order_line.filtered(lambda line: not line.supply_method)
+ if filter_line:
+ raise UserError('当前订单内(%s)产品未选择路线,请选择后重试' % ','.join(filter_line.mapped('product_id.name')))
+
for line in self.order_line:
- if not line.supply_method:
- raise UserError('请先选择供货方式')
bom_type = ''
# 根据供货方式修改成品模板
if line.supply_method == 'automation':
bom_type = 'normal'
- product_template_id = self.env.ref('sf_dlm.product_template_sf').sudo()
+ product_template_id = self.env.ref('sf_dlm.product_template_sf').sudo().product_tmpl_id
elif line.supply_method == 'outsourcing':
bom_type = 'subcontract'
- product_template_id = self.env.ref('jikimo_sale_multiple_supply_methods.product_product_outsourcing').sudo()
+ product_template_id = self.env.ref('jikimo_sale_multiple_supply_methods.product_template_outsourcing').sudo()
elif line.supply_method == 'purchase':
- product_template_id = self.env.ref('jikimo_sale_multiple_supply_methods.product_product_purchase').sudo()
+ product_template_id = self.env.ref('jikimo_sale_multiple_supply_methods.product_template_purchase').sudo()
elif line.supply_method == 'manual':
bom_type = 'normal'
- product_template_id = self.env.ref('jikimo_sale_multiple_supply_methods.product_product_manual_processing').sudo()
+ product_template_id = self.env.ref('jikimo_sale_multiple_supply_methods.product_template_manual_processing').sudo()
# 复制成品模板上的属性
- line.product_id.product_tmpl_id.copy_template(product_template_id.product_tmpl_id)
+ line.product_id.product_tmpl_id.copy_template(product_template_id)
order_id = self
product = line.product_id
@@ -63,10 +66,10 @@ class SaleOrder(models.Model):
# 当成品上带有客供料选项时,生成坯料时选择“客供料”路线
if line.is_incoming_material:
# 将成品模板的内容复制到成品上
- customer_provided_embryo = self.env.ref('jikimo_sale_multiple_supply_methods.product_product_raw_material_customer_provided').sudo()
+ customer_provided_embryo = self.env.ref('jikimo_sale_multiple_supply_methods.product_tempalte_raw_material_customer_provided').sudo()
# 创建坯料,客供料的批量不需要创建bom
material_customer_provided_embryo = self.env['product.template'].sudo().no_bom_product_create(
- customer_provided_embryo,
+ customer_provided_embryo.with_context(active_test=False).product_variant_id,
item,
order_id, 'material_customer_provided', 0, product)
# 成品配置bom
diff --git a/jikimo_sale_multiple_supply_methods/views/sale_order_views.xml b/jikimo_sale_multiple_supply_methods/views/sale_order_views.xml
index c5a1766c..2ea9a835 100644
--- a/jikimo_sale_multiple_supply_methods/views/sale_order_views.xml
+++ b/jikimo_sale_multiple_supply_methods/views/sale_order_views.xml
@@ -22,7 +22,7 @@
confirm_to_supply_method
-
+
draft,sent,supply method,sale
@@ -30,17 +30,14 @@
-
-
-
-
- jikimo.sale.order.search.inherit.quotation
- sale.order
- primary
-
-
-
-
+
+ {'invisible': [('state', '!=', 'draft')]}
+
+
+ {'invisible': [('state', '!=', 'draft')]}
+
+
+ {'invisible': ['|','&',('check_status', '!=', 'approved'),('state', 'in', ['draft','cancel','supply method']),'&',('check_status', '=', 'approved'),('state', 'in', ['sale','cancel','supply method'])]}
@@ -51,8 +48,8 @@
primary
-
-
+
+ [('state', 'in', ('draft', 'sent')), ('user_id', '=', uid)]
@@ -60,8 +57,8 @@
-
-
+
+
@@ -69,6 +66,7 @@
ir.actions.act_window
sale.order
tree,kanban,form,calendar,pivot,graph,activity
+
{'search_default_supply_method': 1}
diff --git a/sf_dlm_management/views/product_template_management_view.xml b/sf_dlm_management/views/product_template_management_view.xml
index 59f2c0a1..7f0e9ad5 100644
--- a/sf_dlm_management/views/product_template_management_view.xml
+++ b/sf_dlm_management/views/product_template_management_view.xml
@@ -65,6 +65,9 @@
attrs="{'invisible': [('categ_type', '!=', '夹具')],'required': [('categ_type', '=', '夹具')]}"
domain="[('fixture_model_id','=',fixture_model_id)]"/>
+
+
+
diff --git a/sf_manufacturing/models/model_type.py b/sf_manufacturing/models/model_type.py
index 9058e005..d08b024b 100644
--- a/sf_manufacturing/models/model_type.py
+++ b/sf_manufacturing/models/model_type.py
@@ -10,7 +10,7 @@ class ModelType(models.Model):
product_routing_tmpl_ids = fields.One2many('sf.product.model.type.routing.sort', 'product_model_type_id',
'成品工序模板(自动化产线加工')
embryo_routing_tmpl_ids = fields.One2many('sf.embryo.model.type.routing.sort', 'embryo_model_type_id',
- '坯料工序模板')
+ '坯料工序模板(人工线下加工)')
surface_technics_routing_tmpl_ids = fields.One2many('sf.surface_technics.model.type.routing.sort',
'surface_technics_model_type_id',
'表面工艺工序模板')
diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py
index 031515a5..d042db55 100644
--- a/sf_manufacturing/models/mrp_production.py
+++ b/sf_manufacturing/models/mrp_production.py
@@ -307,8 +307,7 @@ class MrpProduction(models.Model):
precision_rounding=move.product_uom.rounding or move.product_id.uom_id.rounding)
for move in production.move_raw_ids if move.product_id):
production.state = 'progress'
- elif not production.technology_design_ids:
- production.state = 'technology_to_confirmed'
+
# 新添加的状态逻辑
if (
production.state == 'to_close' or production.state == 'progress') and production.schedule_state == '未排':
@@ -810,6 +809,7 @@ class MrpProduction(models.Model):
if td_ids:
work.sequence = td_ids[0].sequence
+
def _reset_work_order_sequence_1(self):
"""
工单工序排序方法(旧)
@@ -1331,17 +1331,17 @@ class MrpProduction(models.Model):
return production_values_str
# 增加制造订单类型
- production_type = fields.Selection(
- [('自动化产线加工', '自动化产线加工'), ('人工线下加工', '人工线下加工')],
- string='制造类型',
- compute='_compute_production_type',
- store=True
- )
+ # production_type = fields.Selection(
+ # [('自动化产线加工', '自动化产线加工'), ('人工线下加工', '人工线下加工')],
+ # string='制造类型',
+ # compute='_compute_production_type',
+ # store=True
+ # )
- @api.depends('product_id.is_manual_processing')
- def _compute_production_type(self):
- for production in self:
- production.production_type = '自动化产线加工' if not production.product_id.is_manual_processing else '人工线下加工'
+ # @api.depends('product_id.is_manual_processing')
+ # def _compute_production_type(self):
+ # for production in self:
+ # production.production_type = '自动化产线加工' if not production.product_id.is_manual_processing else '人工线下加工'
class sf_detection_result(models.Model):
diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py
index f293ef64..baf0c1b5 100644
--- a/sf_manufacturing/models/product_template.py
+++ b/sf_manufacturing/models/product_template.py
@@ -859,7 +859,7 @@ class ResProductMo(models.Model):
item['model_width'] + model_type.embryo_tolerance) * (
item['model_height'] + model_type.embryo_tolerance),
'product_model_type_id': model_type.id,
- # 'model_processing_panel': 'R',
+ 'model_processing_panel': item['processing_panel_detail'],
'model_machining_precision': item['model_machining_precision'],
'model_code': item['barcode'],
'length': item['model_long'],
@@ -934,6 +934,7 @@ class ResProductMo(models.Model):
# if surface_technology:
# no_bom_copy_product_id.route_ids |= surface_technology
no_bom_copy_product_id.product_tmpl_id.active = True
+ logging.info('no_bom_copy_product_id[is_manual_processing]:%s' % no_bom_copy_product_id.is_manual_processing)
materials_id = self.env['sf.production.materials'].search(
[('materials_no', '=', item['texture_code'])])
materials_type_id = self.env['sf.materials.model'].search(
@@ -959,7 +960,7 @@ class ResProductMo(models.Model):
'materials_type_id': materials_type_id.id,
'single_manufacturing': product_id.single_manufacturing,
'is_bfm': True,
- 'active': True
+ 'active': True,
}
# 外协和采购生成的坯料需要根据材料型号绑定供应商
if route_type == 'subcontract' or route_type == 'purchase':
diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py
index a0787477..b3d80e47 100644
--- a/sf_manufacturing/models/stock.py
+++ b/sf_manufacturing/models/stock.py
@@ -66,358 +66,358 @@ class stockWarehouse(models.Model):
class StockRule(models.Model):
_inherit = 'stock.rule'
- @api.model
- def _run_pull(self, procurements):
- logging.info(procurements)
- moves_values_by_company = defaultdict(list)
- mtso_products_by_locations = defaultdict(list)
+ # @api.model
+ # def _run_pull(self, procurements):
+ # logging.info(procurements)
+ # moves_values_by_company = defaultdict(list)
+ # mtso_products_by_locations = defaultdict(list)
- # To handle the `mts_else_mto` procure method, we do a preliminary loop to
- # isolate the products we would need to read the forecasted quantity,
- # in order to to batch the read. We also make a sanitary check on the
- # `location_src_id` field.
+ # # To handle the `mts_else_mto` procure method, we do a preliminary loop to
+ # # isolate the products we would need to read the forecasted quantity,
+ # # in order to to batch the read. We also make a sanitary check on the
+ # # `location_src_id` field.
- # list1 = []
- # for item in procurements:
- # num = int(item[0].product_qty)
- # if num > 1:
- # for no in range(1, num+1):
- #
- # Procurement = namedtuple('Procurement', ['product_id', 'product_qty',
- # 'product_uom', 'location_id', 'name', 'origin',
- # 'company_id',
- # 'values'])
- # s = Procurement(product_id=item[0].product_id,product_qty=1.0,product_uom=item[0].product_uom,
- # location_id=item[0].location_id,
- # name=item[0].name,
- # origin=item[0].origin,
- # company_id=item[0].company_id,
- # values=item[0].values,
- # )
- # item1 = list(item)
- # item1[0]=s
- #
- # list1.append(tuple(item1))
- # else:
- # list1.append(item)
+ # # list1 = []
+ # # for item in procurements:
+ # # num = int(item[0].product_qty)
+ # # if num > 1:
+ # # for no in range(1, num+1):
+ # #
+ # # Procurement = namedtuple('Procurement', ['product_id', 'product_qty',
+ # # 'product_uom', 'location_id', 'name', 'origin',
+ # # 'company_id',
+ # # 'values'])
+ # # s = Procurement(product_id=item[0].product_id,product_qty=1.0,product_uom=item[0].product_uom,
+ # # location_id=item[0].location_id,
+ # # name=item[0].name,
+ # # origin=item[0].origin,
+ # # company_id=item[0].company_id,
+ # # values=item[0].values,
+ # # )
+ # # item1 = list(item)
+ # # item1[0]=s
+ # #
+ # # list1.append(tuple(item1))
+ # # else:
+ # # list1.append(item)
- for procurement, rule in procurements:
- if not rule.location_src_id:
- msg = _('No source location defined on stock rule: %s!') % (rule.name,)
- raise ProcurementException([(procurement, msg)])
+ # for procurement, rule in procurements:
+ # if not rule.location_src_id:
+ # msg = _('No source location defined on stock rule: %s!') % (rule.name,)
+ # raise ProcurementException([(procurement, msg)])
- if rule.procure_method == 'mts_else_mto':
- mtso_products_by_locations[rule.location_src_id].append(procurement.product_id.id)
+ # if rule.procure_method == 'mts_else_mto':
+ # mtso_products_by_locations[rule.location_src_id].append(procurement.product_id.id)
- # Get the forecasted quantity for the `mts_else_mto` procurement.
- forecasted_qties_by_loc = {}
- for location, product_ids in mtso_products_by_locations.items():
- products = self.env['product.product'].browse(product_ids).with_context(location=location.id)
- forecasted_qties_by_loc[location] = {product.id: product.free_qty for product in products}
+ # # Get the forecasted quantity for the `mts_else_mto` procurement.
+ # forecasted_qties_by_loc = {}
+ # for location, product_ids in mtso_products_by_locations.items():
+ # products = self.env['product.product'].browse(product_ids).with_context(location=location.id)
+ # forecasted_qties_by_loc[location] = {product.id: product.free_qty for product in products}
- # Prepare the move values, adapt the `procure_method` if needed.
- procurements = sorted(procurements, key=lambda proc: float_compare(proc[0].product_qty, 0.0,
- precision_rounding=proc[
- 0].product_uom.rounding) > 0)
- list2 = []
- for item in procurements:
- num = int(item[0].product_qty)
+ # # Prepare the move values, adapt the `procure_method` if needed.
+ # procurements = sorted(procurements, key=lambda proc: float_compare(proc[0].product_qty, 0.0,
+ # precision_rounding=proc[
+ # 0].product_uom.rounding) > 0)
+ # list2 = []
+ # for item in procurements:
+ # num = int(item[0].product_qty)
- product = self.env['product.product'].search(
- [("id", '=', item[0].product_id.id)])
- product_tmpl = self.env['product.template'].search(
- ["&", ("id", '=', product.product_tmpl_id.id), ('single_manufacturing', "!=", False)])
- if product_tmpl:
- if num > 1:
- for no in range(1, num + 1):
- Procurement = namedtuple('Procurement', ['product_id', 'product_qty',
- 'product_uom', 'location_id', 'name', 'origin',
- 'company_id',
- 'values'])
- s = Procurement(product_id=item[0].product_id, product_qty=1.0, product_uom=item[0].product_uom,
- location_id=item[0].location_id,
- name=item[0].name,
- origin=item[0].origin,
- company_id=item[0].company_id,
- values=item[0].values,
- )
- item1 = list(item)
- item1[0] = s
+ # product = self.env['product.product'].search(
+ # [("id", '=', item[0].product_id.id)])
+ # product_tmpl = self.env['product.template'].search(
+ # ["&", ("id", '=', product.product_tmpl_id.id), ('single_manufacturing', "!=", False)])
+ # if product_tmpl:
+ # if num > 1:
+ # for no in range(1, num + 1):
+ # Procurement = namedtuple('Procurement', ['product_id', 'product_qty',
+ # 'product_uom', 'location_id', 'name', 'origin',
+ # 'company_id',
+ # 'values'])
+ # s = Procurement(product_id=item[0].product_id, product_qty=1.0, product_uom=item[0].product_uom,
+ # location_id=item[0].location_id,
+ # name=item[0].name,
+ # origin=item[0].origin,
+ # company_id=item[0].company_id,
+ # values=item[0].values,
+ # )
+ # item1 = list(item)
+ # item1[0] = s
- list2.append(tuple(item1))
- else:
- list2.append(item)
- else:
- list2.append(item)
+ # list2.append(tuple(item1))
+ # else:
+ # list2.append(item)
+ # else:
+ # list2.append(item)
- for procurement, rule in list2:
- procure_method = rule.procure_method
- if rule.procure_method == 'mts_else_mto':
- qty_needed = procurement.product_uom._compute_quantity(procurement.product_qty,
- procurement.product_id.uom_id)
- if float_compare(qty_needed, 0, precision_rounding=procurement.product_id.uom_id.rounding) <= 0:
- procure_method = 'make_to_order'
- for move in procurement.values.get('group_id', self.env['procurement.group']).stock_move_ids:
- if move.rule_id == rule and float_compare(move.product_uom_qty, 0,
- precision_rounding=move.product_uom.rounding) > 0:
- procure_method = move.procure_method
- break
- forecasted_qties_by_loc[rule.location_src_id][procurement.product_id.id] -= qty_needed
- elif float_compare(qty_needed, forecasted_qties_by_loc[rule.location_src_id][procurement.product_id.id],
- precision_rounding=procurement.product_id.uom_id.rounding) > 0:
- procure_method = 'make_to_order'
- else:
- forecasted_qties_by_loc[rule.location_src_id][procurement.product_id.id] -= qty_needed
- procure_method = 'make_to_stock'
- move_values = rule._get_stock_move_values(*procurement)
- move_values['procure_method'] = procure_method
- moves_values_by_company[procurement.company_id.id].append(move_values)
+ # for procurement, rule in list2:
+ # procure_method = rule.procure_method
+ # if rule.procure_method == 'mts_else_mto':
+ # qty_needed = procurement.product_uom._compute_quantity(procurement.product_qty,
+ # procurement.product_id.uom_id)
+ # if float_compare(qty_needed, 0, precision_rounding=procurement.product_id.uom_id.rounding) <= 0:
+ # procure_method = 'make_to_order'
+ # for move in procurement.values.get('group_id', self.env['procurement.group']).stock_move_ids:
+ # if move.rule_id == rule and float_compare(move.product_uom_qty, 0,
+ # precision_rounding=move.product_uom.rounding) > 0:
+ # procure_method = move.procure_method
+ # break
+ # forecasted_qties_by_loc[rule.location_src_id][procurement.product_id.id] -= qty_needed
+ # elif float_compare(qty_needed, forecasted_qties_by_loc[rule.location_src_id][procurement.product_id.id],
+ # precision_rounding=procurement.product_id.uom_id.rounding) > 0:
+ # procure_method = 'make_to_order'
+ # else:
+ # forecasted_qties_by_loc[rule.location_src_id][procurement.product_id.id] -= qty_needed
+ # procure_method = 'make_to_stock'
+ # move_values = rule._get_stock_move_values(*procurement)
+ # move_values['procure_method'] = procure_method
+ # moves_values_by_company[procurement.company_id.id].append(move_values)
- for company_id, moves_values in moves_values_by_company.items():
- # create the move as SUPERUSER because the current user may not have the rights to do it (mto product
- # launched by a sale for example)
- moves = self.env['stock.move'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create(
- moves_values)
- # Since action_confirm launch following procurement_group we should activate it.
- moves._action_confirm()
- return True
+ # for company_id, moves_values in moves_values_by_company.items():
+ # # create the move as SUPERUSER because the current user may not have the rights to do it (mto product
+ # # launched by a sale for example)
+ # moves = self.env['stock.move'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create(
+ # moves_values)
+ # # Since action_confirm launch following procurement_group we should activate it.
+ # moves._action_confirm()
+ # return True
def attachment_update(self, name, res_id, res_field):
attachment_info = self.env['ir.attachment'].sudo().search(
[('res_id', '=', res_id), ('res_field', '=', res_field)], limit=1)
attachment_info.write({'name': name})
- @api.model
- def _run_manufacture(self, procurements):
- productions_values_by_company = defaultdict(list)
- errors = []
- for procurement, rule in procurements:
- if float_compare(procurement.product_qty, 0, precision_rounding=procurement.product_uom.rounding) <= 0:
- # If procurement contains negative quantity, don't create a MO that would be for a negative value.
- continue
- bom = rule._get_matching_bom(procurement.product_id, procurement.company_id, procurement.values)
+ # @api.model
+ # def _run_manufacture(self, procurements):
+ # productions_values_by_company = defaultdict(list)
+ # errors = []
+ # for procurement, rule in procurements:
+ # if float_compare(procurement.product_qty, 0, precision_rounding=procurement.product_uom.rounding) <= 0:
+ # # If procurement contains negative quantity, don't create a MO that would be for a negative value.
+ # continue
+ # bom = rule._get_matching_bom(procurement.product_id, procurement.company_id, procurement.values)
- productions_values_by_company[procurement.company_id.id].append(rule._prepare_mo_vals(*procurement, bom))
+ # productions_values_by_company[procurement.company_id.id].append(rule._prepare_mo_vals(*procurement, bom))
- if errors:
- raise ProcurementException(errors)
+ # if errors:
+ # raise ProcurementException(errors)
- for company_id, productions_values in productions_values_by_company.items():
- # create the MO as SUPERUSER because the current user may not have the rights to do it
- # (mto product launched by a sale for example)
- '''创建制造订单'''
- productions = self.env['mrp.production'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create(
- productions_values)
+ # for company_id, productions_values in productions_values_by_company.items():
+ # # create the MO as SUPERUSER because the current user may not have the rights to do it
+ # # (mto product launched by a sale for example)
+ # '''创建制造订单'''
+ # productions = self.env['mrp.production'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create(
+ # productions_values)
- # self.env['stock.move'].sudo().create(productions._get_moves_raw_values())
- # self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
+ # # self.env['stock.move'].sudo().create(productions._get_moves_raw_values())
+ # # self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
- '''
- 创建工单
- '''
- # productions._create_workorder()
- #
- self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
- productions.filtered(lambda p: (not p.orderpoint_id and p.move_raw_ids) or \
- (
- p.move_dest_ids.procure_method != 'make_to_order' and not
- p.move_raw_ids and not p.workorder_ids)).action_confirm()
- # 处理 根据制造订单生成的采购单坯料入库时到原材料库,手动将原材料位置该为坯料存货区
- for production in productions:
- if production.picking_ids:
- product_type_id = production.picking_ids[0].move_ids[0].product_id.categ_id
- if product_type_id.name == '坯料':
- location_id = self.env['stock.location'].search([('name', '=', '坯料存货区')])
- if not location_id:
- logging.info(f'没有搜索到【坯料存货区】: {location_id}')
- break
- for picking_id in production.picking_ids:
- if picking_id.picking_type_id.name == '内部调拨':
- if picking_id.location_dest_id.product_type != product_type_id:
- picking_id.location_dest_id = location_id.id
- elif picking_id.picking_type_id.name == '生产发料':
- if picking_id.location_id.product_type != product_type_id:
- picking_id.location_id = location_id.id
+ # '''
+ # 创建工单
+ # '''
+ # # productions._create_workorder()
+ # #
+ # self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
+ # productions.filtered(lambda p: (not p.orderpoint_id and p.move_raw_ids) or \
+ # (
+ # p.move_dest_ids.procure_method != 'make_to_order' and not
+ # p.move_raw_ids and not p.workorder_ids)).action_confirm()
+ # # 处理 根据制造订单生成的采购单坯料入库时到原材料库,手动将原材料位置该为坯料存货区
+ # for production in productions:
+ # if production.picking_ids:
+ # product_type_id = production.picking_ids[0].move_ids[0].product_id.categ_id
+ # if product_type_id.name == '坯料':
+ # location_id = self.env['stock.location'].search([('name', '=', '坯料存货区')])
+ # if not location_id:
+ # logging.info(f'没有搜索到【坯料存货区】: {location_id}')
+ # break
+ # for picking_id in production.picking_ids:
+ # if picking_id.picking_type_id.name == '内部调拨':
+ # if picking_id.location_dest_id.product_type != product_type_id:
+ # picking_id.location_dest_id = location_id.id
+ # elif picking_id.picking_type_id.name == '生产发料':
+ # if picking_id.location_id.product_type != product_type_id:
+ # picking_id.location_id = location_id.id
- for production in productions:
- '''
- 创建制造订单时生成序列号
- '''
- production.action_generate_serial()
- origin_production = production.move_dest_ids and production.move_dest_ids[
- 0].raw_material_production_id or False
- orderpoint = production.orderpoint_id
- if orderpoint and orderpoint.create_uid.id == SUPERUSER_ID and orderpoint.trigger == 'manual':
- production.message_post(
- body=_('This production order has been created from Replenishment Report.'),
- message_type='comment',
- subtype_xmlid='mail.mt_note')
- elif orderpoint:
- production.message_post_with_view(
- 'mail.message_origin_link',
- values={'self': production, 'origin': orderpoint},
- subtype_id=self.env.ref('mail.mt_note').id)
- elif origin_production:
- production.message_post_with_view(
- 'mail.message_origin_link',
- values={'self': production, 'origin': origin_production},
- subtype_id=self.env.ref('mail.mt_note').id)
+ # for production in productions:
+ # '''
+ # 创建制造订单时生成序列号
+ # '''
+ # production.action_generate_serial()
+ # origin_production = production.move_dest_ids and production.move_dest_ids[
+ # 0].raw_material_production_id or False
+ # orderpoint = production.orderpoint_id
+ # if orderpoint and orderpoint.create_uid.id == SUPERUSER_ID and orderpoint.trigger == 'manual':
+ # production.message_post(
+ # body=_('This production order has been created from Replenishment Report.'),
+ # message_type='comment',
+ # subtype_xmlid='mail.mt_note')
+ # elif orderpoint:
+ # production.message_post_with_view(
+ # 'mail.message_origin_link',
+ # values={'self': production, 'origin': orderpoint},
+ # subtype_id=self.env.ref('mail.mt_note').id)
+ # elif origin_production:
+ # production.message_post_with_view(
+ # 'mail.message_origin_link',
+ # values={'self': production, 'origin': origin_production},
+ # subtype_id=self.env.ref('mail.mt_note').id)
- '''
- 创建生产计划
- '''
- # 工单耗时
- workorder_duration = 0
- for workorder in production.workorder_ids:
- workorder_duration += workorder.duration_expected
+ # '''
+ # 创建生产计划
+ # '''
+ # # 工单耗时
+ # workorder_duration = 0
+ # for workorder in production.workorder_ids:
+ # workorder_duration += workorder.duration_expected
- sale_order = self.env['sale.order'].sudo().search([('name', '=', production.origin)])
- if sale_order:
- # sale_order.write({'schedule_status': 'to schedule'})
- self.env['sf.production.plan'].sudo().with_company(company_id).create({
- 'name': production.name,
- 'order_deadline': sale_order.deadline_of_delivery,
- 'production_id': production.id,
- 'date_planned_start': production.date_planned_start,
- 'origin': production.origin,
- 'product_qty': production.product_qty,
- 'product_id': production.product_id.id,
- 'state': 'draft',
- })
- technology_design_values = []
- all_production = productions
- grouped_product_ids = {k: list(g) for k, g in groupby(all_production, key=lambda x: x.product_id.id)}
- # 初始化一个字典来存储每个product_id对应的生产订单名称列表
- product_id_to_production_names = {}
- # 对于每个product_id,获取其所有生产订单的名称
- for product_id, all_production in grouped_product_ids.items():
- # 为同一个product_id创建一个生产订单名称列表
- product_id_to_production_names[product_id] = [production.name for production in all_production]
- for production_item in productions:
- production_programming = self.env['mrp.production'].search(
- [('product_id.id', '=', production_item.product_id.id),
- ('origin', '=', production_item.origin)],
- limit=1, order='id asc')
- if production_item.product_id.id in product_id_to_production_names:
- if production_item.product_id.model_process_parameters_ids:
- is_purchase = False
- sorted_process_parameters = sorted(production_item.product_id.model_process_parameters_ids,
- key=lambda w: w.id)
+ # sale_order = self.env['sale.order'].sudo().search([('name', '=', production.origin)])
+ # if sale_order:
+ # # sale_order.write({'schedule_status': 'to schedule'})
+ # self.env['sf.production.plan'].sudo().with_company(company_id).create({
+ # 'name': production.name,
+ # 'order_deadline': sale_order.deadline_of_delivery,
+ # 'production_id': production.id,
+ # 'date_planned_start': production.date_planned_start,
+ # 'origin': production.origin,
+ # 'product_qty': production.product_qty,
+ # 'product_id': production.product_id.id,
+ # 'state': 'draft',
+ # })
+ # technology_design_values = []
+ # all_production = productions
+ # grouped_product_ids = {k: list(g) for k, g in groupby(all_production, key=lambda x: x.product_id.id)}
+ # # 初始化一个字典来存储每个product_id对应的生产订单名称列表
+ # product_id_to_production_names = {}
+ # # 对于每个product_id,获取其所有生产订单的名称
+ # for product_id, all_production in grouped_product_ids.items():
+ # # 为同一个product_id创建一个生产订单名称列表
+ # product_id_to_production_names[product_id] = [production.name for production in all_production]
+ # for production_item in productions:
+ # # production_programming = self.env['mrp.production'].search(
+ # # [('product_id.id', '=', production_item.product_id.id),
+ # # ('origin', '=', production_item.origin)],
+ # # limit=1, order='id asc')
+ # if production_item.product_id.id in product_id_to_production_names:
+ # if production_item.product_id.model_process_parameters_ids:
+ # is_purchase = False
+ # sorted_process_parameters = sorted(production_item.product_id.model_process_parameters_ids,
+ # key=lambda w: w.id)
- consecutive_process_parameters = []
- m = 0
- for i in range(len(sorted_process_parameters) - 1):
- if m == 0:
- is_purchase = False
- if self.env['product.template']._get_process_parameters_product(
- sorted_process_parameters[i]).partner_id == self.env[
- 'product.template']._get_process_parameters_product(sorted_process_parameters[
- i + 1]).partner_id and \
- sorted_process_parameters[i].gain_way == '外协':
- if sorted_process_parameters[i] not in consecutive_process_parameters:
- consecutive_process_parameters.append(sorted_process_parameters[i])
- consecutive_process_parameters.append(sorted_process_parameters[i + 1])
- m += 1
- continue
- else:
- if m == len(consecutive_process_parameters) - 1 and m != 0:
- self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
- production_item,
- product_id_to_production_names)
- if sorted_process_parameters[i] in consecutive_process_parameters:
- is_purchase = True
- consecutive_process_parameters = []
- m = 0
- # 当前面的连续外协采购单生成再生成当前外协采购单
- if is_purchase is False:
- self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
- production_item,
- product_id_to_production_names)
- if m == len(consecutive_process_parameters) - 1 and m != 0:
- self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
- production_item,
- product_id_to_production_names)
- if sorted_process_parameters[i] in consecutive_process_parameters:
- is_purchase = True
- consecutive_process_parameters = []
- m = 0
- if m == len(consecutive_process_parameters) - 1 and m != 0:
- self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
- production_item,
- product_id_to_production_names)
- if is_purchase is False and m == 0:
- if len(sorted_process_parameters) == 1:
- self.env['purchase.order'].get_purchase_order(sorted_process_parameters,
- production_item,
- product_id_to_production_names)
- else:
- self.env['purchase.order'].get_purchase_order(sorted_process_parameters[i],
- production_item,
- product_id_to_production_names)
- if not technology_design_values:
- if production.product_id.categ_id.type == '成品':
- production.product_id.model_processing_panel = 'ZM,FM'
- # 根据加工面板的面数及成品工序模板生成工序设计
- i = 0
- for k in (production.product_id.model_processing_panel.split(',')):
- product_routing_workcenter = self.env['sf.product.model.type.routing.sort'].search(
- [('product_model_type_id', '=', production.product_id.product_model_type_id.id)],
- order='sequence asc'
- )
- for route in product_routing_workcenter:
- i += 1
- technology_design_values.append(
- self.env['sf.technology.design'].json_technology_design_str(k, route, i))
- surface_technics_arr = []
- route_workcenter_arr = []
- for process_param in production.product_id.product_model_type_id.surface_technics_routing_tmpl_ids.filtered(
- lambda st: st.id in production.product_id.model_process_parameters_ids.ids):
- # if item.route_workcenter_id.surface_technics_id.id:
- # for process_param in production.product_id.model_process_parameters_ids:
- logging.info('process_param:%s%s' % (process_param.id, process_param.name))
- if item.route_workcenter_id.surface_technics_id == process_param.process_id:
- logging.info(
- 'surface_technics_id:%s%s' % (
- item.route_workcenter_id.surface_technics_id.id,
- item.route_workcenter_id.surface_technics_id.name))
- surface_technics_arr.append(
- item.route_workcenter_id.surface_technics_id.id)
- route_workcenter_arr.append(item.route_workcenter_id.id)
- if surface_technics_arr:
- production_process = self.env['sf.production.process'].search(
- [('id', 'in', surface_technics_arr)],
- order='sequence asc'
- )
- for p in production_process:
- logging.info('production_process:%s' % p.name)
- process_parameter = production.product_id.model_process_parameters_ids.filtered(
- lambda pm: pm.process_id.id == p.id)
- product_production_process = self.env['product.template'].search(
- [('server_product_process_parameters_id', '=',
- process_parameter.id)])
- if process_parameter:
- i += 1
- route_production_process = self.env[
- 'mrp.routing.workcenter'].search(
- [('surface_technics_id', '=', p.id),
- ('id', 'in', route_workcenter_arr)])
- technology_design_values.append(
- self.env['sf.technology.design'].json_technology_design_str(k,
- route_production_process,
- product_production_process,
- i))
- productions.technology_design_ids = technology_design_values
+ # consecutive_process_parameters = []
+ # m = 0
+ # for i in range(len(sorted_process_parameters) - 1):
+ # if m == 0:
+ # is_purchase = False
+ # if self.env['product.template']._get_process_parameters_product(
+ # sorted_process_parameters[i]).partner_id == self.env[
+ # 'product.template']._get_process_parameters_product(sorted_process_parameters[
+ # i + 1]).partner_id and \
+ # sorted_process_parameters[i].gain_way == '外协':
+ # if sorted_process_parameters[i] not in consecutive_process_parameters:
+ # consecutive_process_parameters.append(sorted_process_parameters[i])
+ # consecutive_process_parameters.append(sorted_process_parameters[i + 1])
+ # m += 1
+ # continue
+ # else:
+ # if m == len(consecutive_process_parameters) - 1 and m != 0:
+ # self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
+ # production_item,
+ # product_id_to_production_names)
+ # if sorted_process_parameters[i] in consecutive_process_parameters:
+ # is_purchase = True
+ # consecutive_process_parameters = []
+ # m = 0
+ # # 当前面的连续外协采购单生成再生成当前外协采购单
+ # if is_purchase is False:
+ # self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
+ # production_item,
+ # product_id_to_production_names)
+ # if m == len(consecutive_process_parameters) - 1 and m != 0:
+ # self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
+ # production_item,
+ # product_id_to_production_names)
+ # if sorted_process_parameters[i] in consecutive_process_parameters:
+ # is_purchase = True
+ # consecutive_process_parameters = []
+ # m = 0
+ # if m == len(consecutive_process_parameters) - 1 and m != 0:
+ # self.env['purchase.order'].get_purchase_order(consecutive_process_parameters,
+ # production_item,
+ # product_id_to_production_names)
+ # if is_purchase is False and m == 0:
+ # if len(sorted_process_parameters) == 1:
+ # self.env['purchase.order'].get_purchase_order(sorted_process_parameters,
+ # production_item,
+ # product_id_to_production_names)
+ # else:
+ # self.env['purchase.order'].get_purchase_order(sorted_process_parameters[i],
+ # production_item,
+ # product_id_to_production_names)
+ # if not technology_design_values:
+ # if production.product_id.categ_id.type == '成品':
+ # production.product_id.model_processing_panel = 'ZM,FM'
+ # # 根据加工面板的面数及成品工序模板生成工序设计
+ # i = 0
+ # for k in (production.product_id.model_processing_panel.split(',')):
+ # product_routing_workcenter = self.env['sf.product.model.type.routing.sort'].search(
+ # [('product_model_type_id', '=', production.product_id.product_model_type_id.id)],
+ # order='sequence asc'
+ # )
+ # for route in product_routing_workcenter:
+ # i += 1
+ # technology_design_values.append(
+ # self.env['sf.technology.design'].json_technology_design_str(k, route, i))
+ # surface_technics_arr = []
+ # route_workcenter_arr = []
+ # for process_param in production.product_id.product_model_type_id.surface_technics_routing_tmpl_ids.filtered(
+ # lambda st: st.id in production.product_id.model_process_parameters_ids.ids):
+ # # if item.route_workcenter_id.surface_technics_id.id:
+ # # for process_param in production.product_id.model_process_parameters_ids:
+ # logging.info('process_param:%s%s' % (process_param.id, process_param.name))
+ # if item.route_workcenter_id.surface_technics_id == process_param.process_id:
+ # logging.info(
+ # 'surface_technics_id:%s%s' % (
+ # item.route_workcenter_id.surface_technics_id.id,
+ # item.route_workcenter_id.surface_technics_id.name))
+ # surface_technics_arr.append(
+ # item.route_workcenter_id.surface_technics_id.id)
+ # route_workcenter_arr.append(item.route_workcenter_id.id)
+ # if surface_technics_arr:
+ # production_process = self.env['sf.production.process'].search(
+ # [('id', 'in', surface_technics_arr)],
+ # order='sequence asc'
+ # )
+ # for p in production_process:
+ # logging.info('production_process:%s' % p.name)
+ # process_parameter = production.product_id.model_process_parameters_ids.filtered(
+ # lambda pm: pm.process_id.id == p.id)
+ # product_production_process = self.env['product.template'].search(
+ # [('server_product_process_parameters_id', '=',
+ # process_parameter.id)])
+ # if process_parameter:
+ # i += 1
+ # route_production_process = self.env[
+ # 'mrp.routing.workcenter'].search(
+ # [('surface_technics_id', '=', p.id),
+ # ('id', 'in', route_workcenter_arr)])
+ # technology_design_values.append(
+ # self.env['sf.technology.design'].json_technology_design_str(k,
+ # route_production_process,
+ # product_production_process,
+ # i))
+ # productions.technology_design_ids = technology_design_values
- # # 同一个产品多个制造订单对应一个编程单和模型库
- # # 只调用一次fetchCNC,并将所有生产订单的名称作为字符串传递
- # if not production_item.programming_no:
- # if not production_programming.programming_no:
- # production_item.fetchCNC(
- # ', '.join(product_id_to_production_names[production_item.product_id.id]))
- # else:
- # production_item.write({'programming_no': production_programming.programming_no,
- # 'programming_state': '编程中'})
- return True
+ # # # 同一个产品多个制造订单对应一个编程单和模型库
+ # # # 只调用一次fetchCNC,并将所有生产订单的名称作为字符串传递
+ # # if not production_item.programming_no:
+ # # if not production_programming.programming_no:
+ # # production_item.fetchCNC(
+ # # ', '.join(product_id_to_production_names[production_item.product_id.id]))
+ # # else:
+ # # production_item.write({'programming_no': production_programming.programming_no,
+ # # 'programming_state': '编程中'})
+ # return True
class ProductionLot(models.Model):
@@ -505,6 +505,12 @@ class ProductionLot(models.Model):
if product.categ_id.name == '刀具':
return self.env['stock.lot'].get_tool_generate_lot_names1(company, product)
else:
+ # 对last_serial的name进行检测,如果不是以产品名称+数字的形式的就重新搜索
+ if product.name.split('[')[0] not in last_serial.name:
+ last_serial = self.env['stock.lot'].search(
+ [('company_id', '=', company.id), ('product_id', '=', product.id),
+ ('name', 'ilike', product.name.split('[')[0])],
+ limit=1, order='name desc')
return self.env['stock.lot'].generate_lot_names1(product.name, last_serial.name, 2)[1]
now = datetime.now().strftime("%Y%m%d")
if product.cutting_tool_model_id:
@@ -831,10 +837,11 @@ class ReStockMove(models.Model):
self.next_serial = self._get_tool_next_serial(self.company_id, self.product_id, self.origin)
else:
self.next_serial = self.env['stock.lot']._get_next_serial(self.company_id, self.product_id)
+ if self.picking_type_id.sequence_code == 'DL' and not self.move_line_nosuggest_ids:
+ self.action_assign_serial_show_details()
elif self.product_id.tracking == "lot":
self._put_tool_lot(self.company_id, self.product_id, self.origin)
- if not self.move_line_nosuggest_ids:
- self._generate_serial_numbers()
+
return {
'name': _('Detailed Operations'),
diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml
index c56f4c3e..ff492436 100644
--- a/sf_manufacturing/views/mrp_production_addional_change.xml
+++ b/sf_manufacturing/views/mrp_production_addional_change.xml
@@ -35,10 +35,10 @@
-
+
@@ -91,7 +91,7 @@
-
+
-
+
@@ -265,7 +265,7 @@
- 制造订单生产计划
+ CNC产线计划排程
ir.actions.act_window
sf.production.plan
tree,gantt,form
diff --git a/sf_plan_management/i18n/zh_CN.po b/sf_plan_management/i18n/zh_CN.po
index d9511db1..20b7f9f3 100644
--- a/sf_plan_management/i18n/zh_CN.po
+++ b/sf_plan_management/i18n/zh_CN.po
@@ -16130,6 +16130,11 @@ msgstr "在手库存"
msgid "Inventory Overview"
msgstr "库存概览"
+#. module: stock
+#: model:ir.actions.act_window,name:stock.stock_picking_type_action
+msgid "Internal Transfers"
+msgstr "厂内出入库"
+
#. module: stock
#: model:ir.model.fields,field_description:stock.field_stock_quant__inventory_quantity_set
msgid "Inventory Quantity Set"
diff --git a/sf_quality/views/view.xml b/sf_quality/views/view.xml
index 6b7e4fa0..62a5b0e7 100644
--- a/sf_quality/views/view.xml
+++ b/sf_quality/views/view.xml
@@ -23,8 +23,8 @@
-
- 质量缺陷单
+
+ 质量缺陷
quality.alert
tree,kanban,form,pivot,graph,calendar
@@ -34,6 +34,13 @@
+
+
quality.point.form.inherit.sf
quality.point
diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py
index 341ec60f..30024239 100644
--- a/sf_warehouse/models/model.py
+++ b/sf_warehouse/models/model.py
@@ -1106,6 +1106,9 @@ class SfProcurementGroup(models.Model):
class SfPickingType(models.Model):
_inherit = 'stock.picking.type'
+ code = fields.Selection([('incoming', 'Receipt'), ('outgoing', 'Delivery'), ('internal', '厂内出入库')],
+ 'Type of Operation', required=True)
+
def _default_show_operations(self):
return self.user_has_groups(
'stock.group_production_lot,'