开发
This commit is contained in:
@@ -7,8 +7,8 @@ from odoo import api, SUPERUSER_ID
|
|||||||
def _set_init_product_active_false(cr, registry):
|
def _set_init_product_active_false(cr, registry):
|
||||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||||
# 获取所有需要设置的产品模板
|
# 获取所有需要设置的产品模板
|
||||||
env.ref('jikimo_sale_multiple_supply_methods.product_template_purchase').product_variant_id.write({'active': False})
|
env.ref('jikimo_sale_multiple_supply_methods.product_product_purchase').product_tmpl_id.write({'active': False})
|
||||||
env.ref('jikimo_sale_multiple_supply_methods.product_template_manual_processing').product_variant_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_template_default').product_variant_id.write({'active': False})
|
env.ref('jikimo_sale_multiple_supply_methods.product_product_default').product_tmpl_id.write({'active': False})
|
||||||
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_product_raw_material_customer_provided').product_tmpl_id.write({'active': False})
|
||||||
env.ref('jikimo_sale_multiple_supply_methods.product_template_outsourcing').product_variant_id.write({'active': False})
|
env.ref('jikimo_sale_multiple_supply_methods.product_product_outsourcing').product_tmpl_id.write({'active': False})
|
||||||
|
|||||||
@@ -6,13 +6,13 @@
|
|||||||
'author': 'fox',
|
'author': 'fox',
|
||||||
'website': '',
|
'website': '',
|
||||||
'category': '',
|
'category': '',
|
||||||
'depends': ['product', 'sf_dlm_management', 'sale_stock'],
|
'depends': ['product', 'sf_dlm', 'sale_stock'],
|
||||||
"data": [
|
"data": [
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'data/stock_routes.xml',
|
'data/stock_routes.xml',
|
||||||
'data/product_data.xml',
|
'data/product_data.xml',
|
||||||
'views/sale_order_views.xml',
|
'views/sale_order_views.xml',
|
||||||
'views/product_product_views.xml',
|
# 'views/product_product_views.xml',
|
||||||
],'assets': {
|
],'assets': {
|
||||||
# 'web.assets_backend': [
|
# 'web.assets_backend': [
|
||||||
# 'jikimo_sale_multiple_supply_methods/static/src/**/*'
|
# 'jikimo_sale_multiple_supply_methods/static/src/**/*'
|
||||||
|
|||||||
@@ -19,12 +19,7 @@ class JikimoSaleRoutePicking(Sf_Bf_Connect):
|
|||||||
res = {'status': 1, 'factory_order_no': ''}
|
res = {'status': 1, 'factory_order_no': ''}
|
||||||
# _logger.info('get_bfm_process_order_list:%s' % kw['order_number'])
|
# _logger.info('get_bfm_process_order_list:%s' % kw['order_number'])
|
||||||
try:
|
try:
|
||||||
product_tmpl_id = request.env.ref('jikimo_sale_multiple_supply_methods.product_template_default').sudo()
|
product_id = request.env.ref('jikimo_sale_multiple_supply_methods.product_product_default').sudo()
|
||||||
product_id = request.env['product.product'].sudo().search(
|
|
||||||
[('product_tmpl_id', '=', product_tmpl_id.id), ('active', '=', False)],
|
|
||||||
limit=1,
|
|
||||||
order='id asc'
|
|
||||||
)
|
|
||||||
company_id = request.env.ref('base.main_company').sudo()
|
company_id = request.env.ref('base.main_company').sudo()
|
||||||
bfm_process_order_list = json.loads(kw['bfm_process_order_list'])
|
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(
|
order_id = request.env['sale.order'].with_user(request.env.ref("base.user_admin")).sale_order_create(
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<record id="product_template_manual_processing" model="product.template">
|
<record id="product_product_manual_processing" model="product.product">
|
||||||
<field name="name">人工线下加工模板</field>
|
<field name="name">人工线下加工模板</field>
|
||||||
<field name="active" eval="False"/>
|
<field name="active" eval="False"/>
|
||||||
<field name="categ_id" ref="sf_dlm.product_category_finished_sf"/>
|
<field name="categ_id" ref="sf_dlm.product_category_finished_sf"/>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<field name="is_manual_processing">true</field>
|
<field name="is_manual_processing">true</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="product_template_purchase" model="product.template">
|
<record id="product_product_purchase" model="product.product">
|
||||||
<field name="name">成品外购模板</field>
|
<field name="name">成品外购模板</field>
|
||||||
<field name="active" eval="False"/>
|
<field name="active" eval="False"/>
|
||||||
<field name="categ_id" ref="sf_dlm.product_category_finished_sf"/>
|
<field name="categ_id" ref="sf_dlm.product_category_finished_sf"/>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<field name="is_bfm">true</field>
|
<field name="is_bfm">true</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="product_template_outsourcing" model="product.template">
|
<record id="product_product_outsourcing" model="product.product">
|
||||||
<field name="name">成品委外加工模板</field>
|
<field name="name">成品委外加工模板</field>
|
||||||
<field name="active" eval="False"/>
|
<field name="active" eval="False"/>
|
||||||
<field name="categ_id" ref="sf_dlm.product_category_finished_sf"/>
|
<field name="categ_id" ref="sf_dlm.product_category_finished_sf"/>
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
<field name="is_bfm">true</field>
|
<field name="is_bfm">true</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="product_template_default" model="product.template">
|
<record id="product_product_default" model="product.product">
|
||||||
<field name="name">成品初始化模板</field>
|
<field name="name">成品初始化模板</field>
|
||||||
<field name="active" eval="False"/>
|
<field name="active" eval="False"/>
|
||||||
<field name="categ_id" ref="sf_dlm.product_category_finished_sf"/>
|
<field name="categ_id" ref="sf_dlm.product_category_finished_sf"/>
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
<field name="partner_id" eval="91"/>
|
<field name="partner_id" eval="91"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="product_template_raw_material_customer_provided" model="product.template">
|
<record id="product_product_raw_material_customer_provided" model="product.product">
|
||||||
<field name="name">坯料客供料模板</field>
|
<field name="name">坯料客供料模板</field>
|
||||||
<field name="active" eval="False"/>
|
<field name="active" eval="False"/>
|
||||||
<field name="categ_id" ref="sf_dlm.product_category_embryo_sf"/>
|
<field name="categ_id" ref="sf_dlm.product_category_embryo_sf"/>
|
||||||
@@ -81,5 +81,10 @@
|
|||||||
<field name="company_id" ref="base.main_company"/>
|
<field name="company_id" ref="base.main_company"/>
|
||||||
<field name="seller_ids" eval="[ref('jikimo_sale_multiple_supply_methods.product_supplierinfo_bfm')]"/>
|
<field name="seller_ids" eval="[ref('jikimo_sale_multiple_supply_methods.product_supplierinfo_bfm')]"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="product_embryo_sf_self_machining" model="product.product">
|
||||||
|
<field name="name">坯料加工模板(人工线下加工)</field>
|
||||||
|
<field name="is_manual_processing">true</field>
|
||||||
|
</record>
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
@@ -28,5 +28,7 @@
|
|||||||
<field name="picking_type_id" ref="material_picking_in"/>
|
<field name="picking_type_id" ref="material_picking_in"/>
|
||||||
<field name="action">pull</field>
|
<field name="action">pull</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from . import product_template
|
from . import product_template
|
||||||
from . import sale_order
|
from . import sale_order
|
||||||
|
from . import mrp_bom
|
||||||
|
|||||||
13
jikimo_sale_multiple_supply_methods/models/mrp_bom.py
Normal file
13
jikimo_sale_multiple_supply_methods/models/mrp_bom.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
from odoo import models, fields
|
||||||
|
|
||||||
|
class MrpBom(models.Model):
|
||||||
|
_inherit = 'mrp.bom'
|
||||||
|
|
||||||
|
# 业务平台分配工厂后在智能工厂先创建销售订单再创建该产品后再次进行创建bom
|
||||||
|
def bom_create(self, product, bom_type, product_type):
|
||||||
|
bom_id = super(MrpBom, self).bom_create(product, bom_type, product_type)
|
||||||
|
|
||||||
|
# 成品的供应商从模板中获取
|
||||||
|
if product_type == 'product':
|
||||||
|
bom_id.subcontractor_id = product.product_tmpl_id.seller_ids.partner_id.id
|
||||||
|
return bom_id
|
||||||
@@ -28,4 +28,5 @@ class ProductTemplate(models.Model):
|
|||||||
self.tracking = product_template_id.tracking
|
self.tracking = product_template_id.tracking
|
||||||
self.is_bfm = product_template_id.is_bfm
|
self.is_bfm = product_template_id.is_bfm
|
||||||
self.is_manual_processing = product_template_id.is_manual_processing
|
self.is_manual_processing = product_template_id.is_manual_processing
|
||||||
self.seller_ids = product_template_id.seller_ids
|
# 复制 seller_ids
|
||||||
|
self.seller_ids = [(0, 0, {'partner_id': seller.partner_id.id, 'delay': 1.0}) for seller in product_template_id.seller_ids]
|
||||||
|
|||||||
@@ -28,18 +28,18 @@ class SaleOrder(models.Model):
|
|||||||
# 根据供货方式修改成品模板
|
# 根据供货方式修改成品模板
|
||||||
if line.supply_method == 'automation':
|
if line.supply_method == 'automation':
|
||||||
bom_type = 'normal'
|
bom_type = 'normal'
|
||||||
product_template_id = self.env.ref('sf_dlm.product_template_sf').sudo().product_tmpl_id
|
product_template_id = self.env.ref('sf_dlm.product_template_sf').sudo()
|
||||||
elif line.supply_method == 'outsourcing':
|
elif line.supply_method == 'outsourcing':
|
||||||
bom_type = 'subcontract'
|
bom_type = 'subcontract'
|
||||||
product_template_id = self.env.ref('jikimo_sale_multiple_supply_methods.product_template_outsourcing').sudo()
|
product_template_id = self.env.ref('jikimo_sale_multiple_supply_methods.product_product_outsourcing').sudo()
|
||||||
elif line.supply_method == 'purchase':
|
elif line.supply_method == 'purchase':
|
||||||
product_template_id = self.env.ref('jikimo_sale_multiple_supply_methods.product_template_purchase').sudo()
|
product_template_id = self.env.ref('jikimo_sale_multiple_supply_methods.product_product_purchase').sudo()
|
||||||
elif line.supply_method == 'manual':
|
elif line.supply_method == 'manual':
|
||||||
bom_type = 'normal'
|
bom_type = 'normal'
|
||||||
product_template_id = self.env.ref('jikimo_sale_multiple_supply_methods.product_template_manual_processing').sudo()
|
product_template_id = self.env.ref('jikimo_sale_multiple_supply_methods.product_product_manual_processing').sudo()
|
||||||
|
|
||||||
# 复制成品模板上的属性
|
# 复制成品模板上的属性
|
||||||
line.product_id.product_tmpl_id.copy_template(product_template_id)
|
line.product_id.product_tmpl_id.copy_template(product_template_id.product_tmpl_id)
|
||||||
|
|
||||||
order_id = self
|
order_id = self
|
||||||
product = line.product_id
|
product = line.product_id
|
||||||
@@ -63,21 +63,16 @@ class SaleOrder(models.Model):
|
|||||||
# 当成品上带有客供料选项时,生成坯料时选择“客供料”路线
|
# 当成品上带有客供料选项时,生成坯料时选择“客供料”路线
|
||||||
if line.is_incoming_material:
|
if line.is_incoming_material:
|
||||||
# 将成品模板的内容复制到成品上
|
# 将成品模板的内容复制到成品上
|
||||||
embryo_template_id = self.env.ref('jikimo_sale_multiple_supply_methods.product_template_raw_material_customer_provided').sudo()
|
customer_provided_embryo = self.env.ref('jikimo_sale_multiple_supply_methods.product_product_raw_material_customer_provided').sudo()
|
||||||
embryo_id = self.env['product.product'].search(
|
|
||||||
[('product_tmpl_id', '=', embryo_template_id.id), ('active', '=', False)],
|
|
||||||
limit=1,
|
|
||||||
order='id asc'
|
|
||||||
)
|
|
||||||
# 创建坯料,客供料的批量不需要创建bom
|
# 创建坯料,客供料的批量不需要创建bom
|
||||||
material_customer_provided_embryo = self.env['product.template'].sudo().no_bom_product_create(
|
material_customer_provided_embryo = self.env['product.template'].sudo().no_bom_product_create(
|
||||||
embryo_id,
|
customer_provided_embryo,
|
||||||
item,
|
item,
|
||||||
order_id, 'material_customer_provided', 0, product)
|
order_id, 'material_customer_provided', 0, product)
|
||||||
# 成品配置bom
|
# 成品配置bom
|
||||||
product_bom_material_customer_provided = self.env['mrp.bom'].with_user(
|
product_bom_material_customer_provided = self.env['mrp.bom'].with_user(
|
||||||
self.env.ref("base.user_admin")).bom_create(
|
self.env.ref("base.user_admin")).bom_create(
|
||||||
product, bom_type, True)
|
product, bom_type, 'product')
|
||||||
product_bom_material_customer_provided.with_user(self.env.ref("base.user_admin")).bom_create_line_has(
|
product_bom_material_customer_provided.with_user(self.env.ref("base.user_admin")).bom_create_line_has(
|
||||||
material_customer_provided_embryo)
|
material_customer_provided_embryo)
|
||||||
elif line.product_id.materials_type_id.gain_way == '自加工':
|
elif line.product_id.materials_type_id.gain_way == '自加工':
|
||||||
@@ -100,7 +95,7 @@ class SaleOrder(models.Model):
|
|||||||
# 产品配置bom
|
# 产品配置bom
|
||||||
product_bom_self_machining = self.env['mrp.bom'].with_user(
|
product_bom_self_machining = self.env['mrp.bom'].with_user(
|
||||||
self.env.ref("base.user_admin")).bom_create(
|
self.env.ref("base.user_admin")).bom_create(
|
||||||
product, bom_type, True)
|
product, bom_type, 'product')
|
||||||
product_bom_self_machining.with_user(self.env.ref("base.user_admin")).bom_create_line_has(
|
product_bom_self_machining.with_user(self.env.ref("base.user_admin")).bom_create_line_has(
|
||||||
self_machining_embryo)
|
self_machining_embryo)
|
||||||
elif line.product_id.materials_type_id.gain_way == '外协':
|
elif line.product_id.materials_type_id.gain_way == '外协':
|
||||||
@@ -124,7 +119,7 @@ class SaleOrder(models.Model):
|
|||||||
raise UserError('该订单模型的材料型号暂未有原材料,请先配置再进行分配')
|
raise UserError('该订单模型的材料型号暂未有原材料,请先配置再进行分配')
|
||||||
# 产品配置bom
|
# 产品配置bom
|
||||||
product_bom_outsource = self.env['mrp.bom'].with_user(
|
product_bom_outsource = self.env['mrp.bom'].with_user(
|
||||||
self.env.ref("base.user_admin")).bom_create(product, bom_type, True)
|
self.env.ref("base.user_admin")).bom_create(product, bom_type, 'product')
|
||||||
product_bom_outsource.with_user(self.env.ref("base.user_admin")).bom_create_line_has(
|
product_bom_outsource.with_user(self.env.ref("base.user_admin")).bom_create_line_has(
|
||||||
outsource_embryo)
|
outsource_embryo)
|
||||||
elif line.product_id.materials_type_id.gain_way == '采购':
|
elif line.product_id.materials_type_id.gain_way == '采购':
|
||||||
@@ -132,14 +127,14 @@ class SaleOrder(models.Model):
|
|||||||
purchase_embryo = self.env['product.template'].sudo().no_bom_product_create(purchase_id,
|
purchase_embryo = self.env['product.template'].sudo().no_bom_product_create(purchase_id,
|
||||||
item,
|
item,
|
||||||
order_id,
|
order_id,
|
||||||
'purchase', i,
|
'purchase', 0,
|
||||||
product)
|
product)
|
||||||
if purchase_embryo == -3:
|
if purchase_embryo == -3:
|
||||||
raise UserError('该订单模型的材料型号暂未设置获取方式和供应商,请先配置再进行分配')
|
raise UserError('该订单模型的材料型号暂未设置获取方式和供应商,请先配置再进行分配')
|
||||||
else:
|
else:
|
||||||
# 产品配置bom
|
# 产品配置bom
|
||||||
product_bom_purchase = self.env['mrp.bom'].with_user(
|
product_bom_purchase = self.env['mrp.bom'].with_user(
|
||||||
self.env.ref("base.user_admin")).bom_create(product, bom_type, True)
|
self.env.ref("base.user_admin")).bom_create(product, bom_type, 'product')
|
||||||
product_bom_purchase.with_user(self.env.ref("base.user_admin")).bom_create_line_has(
|
product_bom_purchase.with_user(self.env.ref("base.user_admin")).bom_create_line_has(
|
||||||
purchase_embryo)
|
purchase_embryo)
|
||||||
return super(SaleOrder, self).action_confirm()
|
return super(SaleOrder, self).action_confirm()
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
<!-- 由于该模块不能依赖sf_dlm_management, 该功能只能在sf_dlm_management中实现,并且依赖该模块-->
|
||||||
<record id="view_product_product_form_inherit_sf" model="ir.ui.view">
|
<record id="view_product_product_form_inherit_sf" model="ir.ui.view">
|
||||||
<field name="name">view.product.template.form.inherit.sf</field>
|
<field name="name">view.product.template.form.inherit.sf</field>
|
||||||
<field name="model">product.template</field>
|
<field name="model">product.template</field>
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
from . import models
|
|
||||||
|
|
||||||
from . import controllers
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
{
|
|
||||||
'name': '机企猫 供货路线选择',
|
|
||||||
'version': '16.0.1.0.0',
|
|
||||||
'summary': """ 报价单提供(自动化产线加工/人工线下加工/外购/委外加工)多种供货路线选择 """,
|
|
||||||
'author': 'fox',
|
|
||||||
'website': '',
|
|
||||||
'category': '',
|
|
||||||
'depends': ['product', 'sf_dlm_management', 'sale_stock'],
|
|
||||||
"data": [
|
|
||||||
'security/ir.model.access.csv',
|
|
||||||
'data/stock_routes.xml',
|
|
||||||
'data/product_templates.xml',
|
|
||||||
'views/sale_order_views.xml',
|
|
||||||
'views/product_product_views.xml',
|
|
||||||
],'assets': {
|
|
||||||
# 'web.assets_backend': [
|
|
||||||
# 'jikimo_sale_route_picking/static/src/**/*'
|
|
||||||
# ],
|
|
||||||
},
|
|
||||||
'application': True,
|
|
||||||
'installable': True,
|
|
||||||
'auto_install': False,
|
|
||||||
'license': 'LGPL-3',
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
from . import main
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
import logging
|
|
||||||
import json
|
|
||||||
from odoo import http
|
|
||||||
from odoo.http import request
|
|
||||||
from odoo.addons.sf_bf_connect.controllers.controllers import Sf_Bf_Connect
|
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
class JikimoSaleRoutePicking(Sf_Bf_Connect):
|
|
||||||
|
|
||||||
@http.route('/api/bfm_process_order/list', type='http', auth='sf_token', methods=['GET', 'POST'], csrf=False,
|
|
||||||
cors="*")
|
|
||||||
def get_bfm_process_order_list(self, **kw):
|
|
||||||
"""
|
|
||||||
接收业务平台加工订单分配工厂时传送来的订单数据并生成销售订单和产品及坯料
|
|
||||||
:param kw:
|
|
||||||
:return:
|
|
||||||
"""
|
|
||||||
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_route_picking.product_template_default').sudo()
|
|
||||||
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(
|
|
||||||
company_id, kw['delivery_name'], kw['delivery_telephone'], kw['delivery_address'],
|
|
||||||
kw['delivery_end_date'], kw['payments_way'], kw['pay_way'], state='draft')
|
|
||||||
i = 1
|
|
||||||
# 给sale_order的default_code字段赋值
|
|
||||||
aa = request.env['sale.order'].sudo().search([('name', '=', order_id.name)])
|
|
||||||
_logger.info('get_bfm_process_or===================================:%s' % order_id.name)
|
|
||||||
aa.default_code = kw['order_number']
|
|
||||||
if kw.get('logistics_way'):
|
|
||||||
aa.logistics_way = kw['logistics_way']
|
|
||||||
_logger.info('get_bfm_process_order_listaaaaaaaaaaaaaaaaaaaaaaaaaaaa================:%s' % aa.default_code)
|
|
||||||
for item in bfm_process_order_list:
|
|
||||||
product = request.env['product.template'].sudo().product_create(product_id, item, order_id,
|
|
||||||
kw['order_number'], i)
|
|
||||||
order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item)
|
|
||||||
i += 1
|
|
||||||
res['factory_order_no'] = order_id.name
|
|
||||||
except Exception as e:
|
|
||||||
_logger.info('get_bfm_process_order_list error:%s' % e)
|
|
||||||
res['status'] = -1
|
|
||||||
res['message'] = '工厂创建销售订单和产品失败,请联系管理员'
|
|
||||||
return json.JSONEncoder().encode(res)
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<odoo>
|
|
||||||
<data noupdate="1">
|
|
||||||
<record id="product_template_manual_processing" model="product.template">
|
|
||||||
<field name="name">人工线下加工模板</field>
|
|
||||||
<field name="active" eval="False"/>
|
|
||||||
<field name="categ_id" ref="sf_dlm.product_category_finished_sf"/>
|
|
||||||
<field name="route_ids"
|
|
||||||
eval="[ref('stock.route_warehouse0_mto'), ref('mrp.route_warehouse0_manufacture')]"/>
|
|
||||||
<field name="invoice_policy">delivery</field>
|
|
||||||
<field name="detailed_type">product</field>
|
|
||||||
<field name="purchase_ok">false</field>
|
|
||||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
|
||||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
|
||||||
<field name="company_id" ref="base.main_company"/>
|
|
||||||
<field name="single_manufacturing">true</field>
|
|
||||||
<field name="tracking">serial</field>
|
|
||||||
<field name="is_bfm">true</field>
|
|
||||||
<field name="is_manual_processing">true</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="product_template_purchase" model="product.template">
|
|
||||||
<field name="name">成品外购模板</field>
|
|
||||||
<field name="active" eval="False"/>
|
|
||||||
<field name="categ_id" ref="sf_dlm.product_category_finished_sf"/>
|
|
||||||
<field name="route_ids"
|
|
||||||
eval="[ref('stock.route_warehouse0_mto'), ref('purchase_stock.route_warehouse0_buy')]"/>
|
|
||||||
<field name="tracking">serial</field>
|
|
||||||
<field name="detailed_type">product</field>
|
|
||||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
|
||||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
|
||||||
<field name="company_id" ref="base.main_company"/>
|
|
||||||
<field name="is_bfm">true</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="product_template_outsourcing" model="product.template">
|
|
||||||
<field name="name">成品委外加工模板</field>
|
|
||||||
<field name="active" eval="False"/>
|
|
||||||
<field name="categ_id" ref="sf_dlm.product_category_finished_sf"/>
|
|
||||||
<field name="route_ids"
|
|
||||||
eval="[ref('stock.route_warehouse0_mto'), ref('purchase_stock.route_warehouse0_buy'), ref('mrp_subcontracting.route_resupply_subcontractor_mto')]"/>
|
|
||||||
<field name="tracking">serial</field>
|
|
||||||
<field name="detailed_type">product</field>
|
|
||||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
|
||||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
|
||||||
<field name="company_id" ref="base.main_company"/>
|
|
||||||
<field name="is_bfm">true</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="product_template_default" model="product.template">
|
|
||||||
<field name="name">成品初始化模板</field>
|
|
||||||
<field name="active" eval="False"/>
|
|
||||||
<field name="categ_id" ref="sf_dlm.product_category_finished_sf"/>
|
|
||||||
<field name="route_ids" eval="[]"/>
|
|
||||||
<field name="tracking">serial</field>
|
|
||||||
<field name="detailed_type">product</field>
|
|
||||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
|
||||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
|
||||||
<field name="company_id" ref="base.main_company"/>
|
|
||||||
<field name="is_bfm">true</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<!-- 供应商信息(业务平台),由于数据是python创建,只能指定ID -->
|
|
||||||
<record id="product_supplierinfo_bfm" model="product.supplierinfo">
|
|
||||||
<field name="partner_id" eval="91"/>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="product_template_raw_material_customer_provided" model="product.template">
|
|
||||||
<field name="name">坯料客供料模板</field>
|
|
||||||
<field name="active" eval="False"/>
|
|
||||||
<field name="categ_id" ref="sf_dlm.product_category_embryo_sf"/>
|
|
||||||
<field name="route_ids" eval="[
|
|
||||||
ref('stock.route_warehouse0_mto'),
|
|
||||||
ref('mrp_subcontracting.route_resupply_subcontractor_mto'),
|
|
||||||
ref('jikimo_sale_route_picking.route_material_processing')]"/>
|
|
||||||
<field name="sale_ok">false</field>
|
|
||||||
<field name="tracking">serial</field>
|
|
||||||
<field name="detailed_type">product</field>
|
|
||||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
|
||||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
|
||||||
<field name="company_id" ref="base.main_company"/>
|
|
||||||
<field name="seller_ids" eval="[ref('jikimo_sale_route_picking.product_supplierinfo_bfm')]"/>
|
|
||||||
</record>
|
|
||||||
</data>
|
|
||||||
</odoo>
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<odoo>
|
|
||||||
<data noupdate="1">
|
|
||||||
<record id="route_material_processing" model="stock.route">
|
|
||||||
<field name="name">带料加工</field>
|
|
||||||
<field name="product_selectable">true</field>
|
|
||||||
<field name="warehouse_selectable">true</field>
|
|
||||||
<field name="warehouse_ids" eval="[ref('stock.warehouse0')]"/>
|
|
||||||
<field name="sequence">16</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="material_picking_in" model="stock.picking.type">
|
|
||||||
<field name="name">客供料入库</field>
|
|
||||||
<field name="code">incoming</field>
|
|
||||||
<field name="active">true</field>
|
|
||||||
<field name="company_id" ref="base.main_company"/>
|
|
||||||
<field name="sequence_code">DL</field>
|
|
||||||
<field name="default_location_src_id" ref="stock.stock_location_customers"/>
|
|
||||||
<field name="default_location_dest_id" eval="25"/>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="rule_material_receiving" model="stock.rule">
|
|
||||||
<field name="name">带料收货</field>
|
|
||||||
<field name="route_id" ref="route_material_processing"/>
|
|
||||||
<field name="location_dest_id" ref="stock.stock_location_company"/>
|
|
||||||
<field name="location_src_id" ref="stock.stock_location_customers"/>
|
|
||||||
<field name="picking_type_id" ref="material_picking_in"/>
|
|
||||||
<field name="action">pull</field>
|
|
||||||
</record>
|
|
||||||
</data>
|
|
||||||
</odoo>
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
from . import product_template
|
|
||||||
from . import product_product
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
from odoo import models, fields
|
|
||||||
|
|
||||||
class ProductProduct(models.Model):
|
|
||||||
_inherit = 'product.product'
|
|
||||||
|
|
||||||
# 是否客供料
|
|
||||||
is_customer_provided = fields.Boolean(string='是否客供料', related='product_tmpl_id.is_customer_provided')
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
from odoo import models, fields
|
|
||||||
|
|
||||||
class ProductTemplate(models.Model):
|
|
||||||
_inherit = 'product.template'
|
|
||||||
|
|
||||||
is_manual_processing = fields.Boolean(string='人工线下加工')
|
|
||||||
is_customer_provided = fields.Boolean(string='客供料')
|
|
||||||
|
|
||||||
def product_create(self, product_id, item, order_id, order_number, i):
|
|
||||||
product_id = super(ProductTemplate, self).product_create(product_id, item, order_id, order_number, i)
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
|
||||||
access_sale_order_group_production_engineer,sale.order_group_production_engineer,sale.model_sale_order,sf_base.group_production_engineer,1,1,0,0
|
|
||||||
access_sale_order_line_group_production_engineer,sale_order_line_group_production_engineer,sale.model_sale_order_line,sf_base.group_production_engineer,1,1,0,0
|
|
||||||
access_product_product_group_production_engineer,product_product_group_production_engineer,product.model_product_product,sf_base.group_production_engineer,1,0,0,0
|
|
||||||
access_product_template_group_production_engineer,product_template_group_production_engineer,product.model_product_template,sf_base.group_production_engineer,1,0,0,0
|
|
||||||
access_stock_picking_group_production_engineer,stock_picking_group_production_engineer,stock.model_stock_picking,sf_base.group_production_engineer,1,0,0,0
|
|
||||||
access_stock_move_group_production_engineer,stock_move_group_production_engineer,stock.model_stock_move,sf_base.group_production_engineer,1,0,0,0
|
|
||||||
access_mrp_bom_group_production_engineer,mrp_bom_group_production_engineer,mrp.model_mrp_bom,sf_base.group_production_engineer,1,0,0,0
|
|
||||||
|
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<odoo>
|
|
||||||
<record id="view_product_product_form_inherit_sf" model="ir.ui.view">
|
|
||||||
<field name="name">view.product.template.form.inherit.sf</field>
|
|
||||||
<field name="model">product.template</field>
|
|
||||||
<field name="inherit_id" ref="sf_dlm_management.view_sale_product_template_form_inherit_sf"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<xpath expr="//field[@name='manual_quotation']" position="after">
|
|
||||||
<field name="is_customer_provided" attrs="{'invisible': [('categ_type', 'not in', ['成品', '坯料'])], 'readonly': True}" />
|
|
||||||
</xpath>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
</odoo>
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<odoo>
|
|
||||||
<record id="view_order_form_inherit_sf" model="ir.ui.view">
|
|
||||||
<field name="name">view.sale.order.form.inherit.sf</field>
|
|
||||||
<field name="inherit_id" ref="sale_stock.view_order_form_inherit_sale_stock_qty"/>
|
|
||||||
<field name="model">sale.order</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<xpath expr="//page/field[@name='order_line']/form/group/group/div[@name='ordered_qty']/widget[@name='qty_at_date_widget']" position="replace">
|
|
||||||
</xpath>
|
|
||||||
<xpath expr="//page/field[@name='order_line']/tree/widget[@name='qty_at_date_widget']" position="replace">
|
|
||||||
</xpath>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="jikimo_sale_order_view_search_inherit_quotation" model="ir.ui.view">
|
|
||||||
<field name="name">jikimo.sale.order.search.inherit.quotation</field>
|
|
||||||
<field name="model">sale.order</field>
|
|
||||||
<field name="mode">primary</field>
|
|
||||||
<field name="inherit_id" ref="sale.sale_order_view_search_inherit_quotation"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<xpath expr="//filter[@name='my_quotation']" position="replace">
|
|
||||||
<filter string="My Quotations" name="my_quotation" domain="[('state', 'in', ('draft', 'sent'))]"/>
|
|
||||||
</xpath>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="jikimo_sale_order_view_search_inherit_quotation_route" model="ir.ui.view">
|
|
||||||
<field name="name">jikimo.sale.order.search.inherit.quotation</field>
|
|
||||||
<field name="model">sale.order</field>
|
|
||||||
<field name="mode">primary</field>
|
|
||||||
<field name="inherit_id" ref="sale.sale_order_view_search_inherit_quotation"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<xpath expr="//filter[@name='my_quotation']" position="replace">
|
|
||||||
<filter string="My Quotations" name="my_quotation" domain="[('state', 'in', ('draft', 'sent'))]"/>
|
|
||||||
</xpath>
|
|
||||||
<xpath expr="//filter[@name='draft']" position="after">
|
|
||||||
<filter string="供货路线待确认" name="route" domain="[('state', '=', 'route')]"/>
|
|
||||||
</xpath>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="sale.action_quotations" model="ir.actions.act_window">
|
|
||||||
<field name="search_view_id" ref="jikimo_sale_order_view_search_inherit_quotation"/>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="action_quotations_route_picking" model="ir.actions.act_window">
|
|
||||||
<field name="name">报价单</field>
|
|
||||||
<field name="type">ir.actions.act_window</field>
|
|
||||||
<field name="res_model">sale.order</field>
|
|
||||||
<field name="view_mode">tree,kanban,form,calendar,pivot,graph,activity</field>
|
|
||||||
<field name="search_view_id" ref="jikimo_sale_order_view_search_inherit_quotation_route"/>
|
|
||||||
<field name="context">{'search_default_route': 1}</field>
|
|
||||||
<field name="help" type="html">
|
|
||||||
<p class="o_view_nocontent_smiling_face">
|
|
||||||
Create a new quotation, the first step of a new sale!
|
|
||||||
</p><p>
|
|
||||||
Once the quotation is confirmed by the customer, it becomes a sales order.<br/> You will be able to create an invoice and collect the payment.
|
|
||||||
</p>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
<menuitem
|
|
||||||
id="sale.sale_menu_root"
|
|
||||||
groups="sf_base.group_production_engineer,sf_base.group_sale_director,sf_base.group_sale_salemanager"
|
|
||||||
/>
|
|
||||||
<menuitem
|
|
||||||
id="sale_order_menu_route_picker"
|
|
||||||
name="订单"
|
|
||||||
sequence="10"
|
|
||||||
parent="sale.sale_menu_root"
|
|
||||||
groups="sf_base.group_production_engineer"
|
|
||||||
/>
|
|
||||||
<!--供货路线专员菜单-->
|
|
||||||
<menuitem
|
|
||||||
id="sale_order_menu_quotations_route_picker"
|
|
||||||
name="报价单"
|
|
||||||
action="jikimo_sale_route_picking.action_quotations_route_picking"
|
|
||||||
parent="sale_order_menu_route_picker"
|
|
||||||
groups="sf_base.group_production_engineer"
|
|
||||||
sequence="2"/>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</odoo>
|
|
||||||
@@ -1187,6 +1187,20 @@ class MrpProduction(models.Model):
|
|||||||
'user_id': production.user_id.id}
|
'user_id': production.user_id.id}
|
||||||
return production_values_str
|
return production_values_str
|
||||||
|
|
||||||
|
# 增加制造订单类型
|
||||||
|
production_type = fields.Selection(
|
||||||
|
[('自动化产线加工', '自动化产线加工'), ('人工线下加工', '人工线下加工')],
|
||||||
|
string='制造订单类型',
|
||||||
|
required=True,
|
||||||
|
compute='_compute_production_type',
|
||||||
|
store=True
|
||||||
|
)
|
||||||
|
|
||||||
|
@api.depends('product_id')
|
||||||
|
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):
|
class sf_detection_result(models.Model):
|
||||||
_name = 'sf.detection.result'
|
_name = 'sf.detection.result'
|
||||||
|
|||||||
@@ -955,6 +955,7 @@ class ResProductMo(models.Model):
|
|||||||
'list_price': item['price'],
|
'list_price': item['price'],
|
||||||
'materials_id': materials_id.id,
|
'materials_id': materials_id.id,
|
||||||
'materials_type_id': materials_type_id.id,
|
'materials_type_id': materials_type_id.id,
|
||||||
|
'single_manufacturing': product_id.single_manufacturing,
|
||||||
'is_bfm': True,
|
'is_bfm': True,
|
||||||
'active': True
|
'active': True
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,7 +133,8 @@ class ReSaleOrder(models.Model):
|
|||||||
'product_uom_qty': item['number'],
|
'product_uom_qty': item['number'],
|
||||||
'model_glb_file': base64.b64decode(item['model_file']),
|
'model_glb_file': base64.b64decode(item['model_file']),
|
||||||
'remark': item.get('remark'),
|
'remark': item.get('remark'),
|
||||||
'is_incoming_material': item.get('is_incoming_material')
|
'is_incoming_material': item.get('is_incoming_material'),
|
||||||
|
'manual_quotation': item.get('manual_quotation')
|
||||||
}
|
}
|
||||||
return self.env['sale.order.line'].with_context(skip_procurement=True).create(vals)
|
return self.env['sale.order.line'].with_context(skip_procurement=True).create(vals)
|
||||||
|
|
||||||
@@ -175,6 +176,7 @@ class ResaleOrderLine(models.Model):
|
|||||||
remark = fields.Char('备注')
|
remark = fields.Char('备注')
|
||||||
|
|
||||||
is_incoming_material = fields.Boolean('客供料', default=False)
|
is_incoming_material = fields.Boolean('客供料', default=False)
|
||||||
|
manual_quotation = fields.Boolean('人工编程', default=False)
|
||||||
|
|
||||||
@api.depends('product_template_id')
|
@api.depends('product_template_id')
|
||||||
def _compute_model_glb_file(self):
|
def _compute_model_glb_file(self):
|
||||||
|
|||||||
@@ -118,7 +118,8 @@
|
|||||||
<xpath expr="//field[@name='order_line']/tree/field[@name='name']" position="replace">
|
<xpath expr="//field[@name='order_line']/tree/field[@name='name']" position="replace">
|
||||||
<field name="name" widget="section_and_note_text" optional="show"
|
<field name="name" widget="section_and_note_text" optional="show"
|
||||||
string="参数说明(长/宽/高/体积/精度/材质)"/>
|
string="参数说明(长/宽/高/体积/精度/材质)"/>
|
||||||
<field name="is_incoming_material"/>
|
<field name="manual_quotation" readonly="1"/>
|
||||||
|
<field name="is_incoming_material" readonly="1"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<field name="user_id" position="attributes">
|
<field name="user_id" position="attributes">
|
||||||
<attribute name="attrs">{'readonly': [('state', 'in', ['cancel','sale'])]}</attribute>
|
<attribute name="attrs">{'readonly': [('state', 'in', ['cancel','sale'])]}</attribute>
|
||||||
@@ -165,6 +166,7 @@
|
|||||||
</xpath>
|
</xpath>
|
||||||
<!--新增带料字段-->
|
<!--新增带料字段-->
|
||||||
<xpath expr="//field[@name='order_line']/form//group//group//field[@name='analytic_distribution']" position="after">
|
<xpath expr="//field[@name='order_line']/form//group//group//field[@name='analytic_distribution']" position="after">
|
||||||
|
<field name="manual_quotation" />
|
||||||
<field name="is_incoming_material"/>
|
<field name="is_incoming_material"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
Reference in New Issue
Block a user