去掉警告及开发表面工艺相关需求

This commit is contained in:
jinling.yang
2023-03-27 21:04:33 +08:00
parent 446bd04a9d
commit bf010e2cca
18 changed files with 89 additions and 72 deletions

View File

@@ -23,6 +23,7 @@
], ],
'qweb': [ 'qweb': [
], ],
'license': 'LGPL-3',
'installable': True, 'installable': True,
'application': False, 'application': False,
'auto_install': False, 'auto_install': False,

View File

@@ -63,6 +63,8 @@ class MrsProductionProcess(models.Model):
parameter_ids = fields.One2many('sf.production.process.parameter', 'process_id', string='可选参数') parameter_ids = fields.One2many('sf.production.process.parameter', 'process_id', string='可选参数')
gain_way = fields.Selection([("自加工", "自加工"), ("外协", "外协")], default="", string="获取方式") gain_way = fields.Selection([("自加工", "自加工"), ("外协", "外协")], default="", string="获取方式")
category_id = fields.Many2one('sf.production.process.category') category_id = fields.Many2one('sf.production.process.category')
workcenter_ids = fields.Many2many('mrp.workcenter', 'rel_workcenter_process', required=True)
class MrsProcessingTechnology(models.Model): class MrsProcessingTechnology(models.Model):

View File

@@ -15,6 +15,7 @@ access_sf_tray,sf_tray,model_sf_tray,base.group_user,1,1,1,1
access_sf_supplier_sort,sf_supplier_sort,model_sf_supplier_sort,base.group_user,1,1,1,1 access_sf_supplier_sort,sf_supplier_sort,model_sf_supplier_sort,base.group_user,1,1,1,1
access_sf_production_process_parameter,sf_production_process_parameter,model_sf_production_process_parameter,base.group_user,1,1,1,1 access_sf_production_process_parameter,sf_production_process_parameter,model_sf_production_process_parameter,base.group_user,1,1,1,1
access_sf_production_process_category,sf_production_process_category,model_sf_production_process_category,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
15 access_sf_supplier_sort sf_supplier_sort model_sf_supplier_sort base.group_user 1 1 1 1
16 access_sf_production_process_parameter sf_production_process_parameter model_sf_production_process_parameter base.group_user 1 1 1 1
17 access_sf_production_process_category sf_production_process_category model_sf_production_process_category base.group_user 1 1 1 1
18
19
20
21

View File

@@ -108,55 +108,49 @@
<field name="model">sf.production.process</field> <field name="model">sf.production.process</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="表面工艺"> <form string="表面工艺">
<group> <sheet>
<field name="process_encode" readonly="1"/> <group>
<field name="name" required="1"/> <group>
<field name="gain_way" required="1"/> <field name="process_encode" readonly="1"/>
</group> <field name="gain_way" required="1"/>
<notebook> </group>
<page string="工序"> <group>
<field name='processing_order_ids' options="{'no_create':True}" widget="one2many"> <field name="name" required="1"/>
<tree editable='bottom'> <field name="workcenter_ids" widget="many2many_tags" string="工作中心" required="0"/>
<field name="sequence" widget="handle"/> </group>
<field name="processing_technology_ids" widget="many2many_tags">
</field> <notebook>
</tree> <page string="可选参数">
<form> <field name="parameter_ids">
<field name="processing_technology_ids" widget="many2many"> <tree force_save="1">
</field>
</form>
</field>
</page>
<page string="可选参数">
<field name="parameter_ids">
<tree force_save="1">
<field name="code" readonly="1" force_save="1"/>
<field name="name"/>
<field name="price"/>
<field name='process_id' default="default" invisible="1"/>
</tree>
<form>
<sheet>
<group>
<field name="code" readonly="1" force_save="1"/> <field name="code" readonly="1" force_save="1"/>
<field name="name"/> <field name="name"/>
<field name="price"/> <field name="price"/>
</group> <field name='process_id' default="default" invisible="1"/>
<notebook> </tree>
<page string="适用材料"> </field>
<field name="materials_model_ids"/> </page>
</page> <page string="工序">
</notebook> <field name='processing_order_ids' options="{'no_create':True}" widget="one2many">
</sheet> <tree editable='bottom'>
</form> <field name="sequence" widget="handle"/>
</field> <field name="processing_technology_ids" widget="many2many_tags">
</page> </field>
</notebook> </tree>
<form>
<field name="processing_technology_ids" widget="many2many">
<group> </field>
<field name="remark"/> </form>
</group> </field>
</page>
</notebook>
</group>
<group>
<group>
<field name="remark"/>
</group>
</group>
</sheet>
</form> </form>
</field> </field>
</record> </record>

View File

@@ -13,13 +13,14 @@
'depends': ['sf_base', 'sf_sale', 'sf_dlm'], 'depends': ['sf_base', 'sf_sale', 'sf_dlm'],
'data': [ 'data': [
'views/res_partner_view.xml', 'views/res_partner_view.xml',
'views/view.xml', # 'views/view.xml',
'report/bill_report.xml', 'report/bill_report.xml',
], ],
'demo': [ 'demo': [
], ],
'qweb': [ 'qweb': [
], ],
'license': 'LGPL-3',
'installable': True, 'installable': True,
'application': False, 'application': False,
'auto_install': False, 'auto_install': False,

View File

@@ -111,7 +111,6 @@ class Sf_Bf_Connect(http.Controller):
product_bom_purchase.with_user(request.env.ref("base.user_admin")).bom_create_line_has( product_bom_purchase.with_user(request.env.ref("base.user_admin")).bom_create_line_has(
purchase_embryo) purchase_embryo)
order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item) order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item)
order_id.step_file = product.model_file
i += 1 i += 1
res['factory_order_no'] = order_id.name res['factory_order_no'] = order_id.name
return json.JSONEncoder().encode(res) return json.JSONEncoder().encode(res)

View File

@@ -1,4 +1,4 @@
import cpca #import cpca
import logging import logging
import base64 import base64
import requests import requests
@@ -37,7 +37,7 @@ class JdEclp(models.Model):
deliveryType = fields.Selection([('6', '特快零担'), ('25', '特快重货')], string='运输类型', default='25') deliveryType = fields.Selection([('6', '特快零担'), ('25', '特快重货')], string='运输类型', default='25')
# bill = fields.Char(string='物流面单') # bill = fields.Char(string='物流面单')
bill = fields.Many2one('ir.attachment', string='物流面单', compute='query_bill_pdf') # bill = fields.Many2one('ir.attachment', string='物流面单', compute='query_bill_pdf')
# bill_show = fields.Binary(string='物流面单展示', readonly=True, related='self.bill.datas') # bill_show = fields.Binary(string='物流面单展示', readonly=True, related='self.bill.datas')
bill_show = fields.Binary(string='物流面单展示', readonly=True) bill_show = fields.Binary(string='物流面单展示', readonly=True)

View File

@@ -10,9 +10,11 @@
""", """,
'category': 'sf', 'category': 'sf',
'website': 'https://www.sf.jikimo.com', 'website': 'https://www.sf.jikimo.com',
'depends': ['mrp', 'base', 'sf_manufacturing', 'web_widget_model_viewer', 'mrp_subcontracting'], 'depends': ['mrp', 'base', 'sf_manufacturing', 'web_widget_model_viewer', 'mrp_subcontracting', 'purchase_stock',
'uom'],
'data': [ 'data': [
'data/product_data.xml', 'data/product_data.xml',
'data/uom_data.xml',
'views/product_template_view.xml', 'views/product_template_view.xml',
'views/product_workorder.xml' 'views/product_workorder.xml'
], ],
@@ -20,6 +22,7 @@
], ],
'qweb': [ 'qweb': [
], ],
'license': 'LGPL-3',
'installable': True, 'installable': True,
'application': False, 'application': False,
'auto_install': False, 'auto_install': False,

View File

@@ -15,6 +15,11 @@
<field name="type">原材料</field> <field name="type">原材料</field>
</record> </record>
<!-- <record id="product_category_server_sf" model="product.category">-->
<!-- <field name="name">服务</field>-->
<!-- <field name="type">服务</field>-->
<!-- </record>-->
<record id="product_template_sf" model="product.product"> <record id="product_template_sf" model="product.product">
<field name="name">CNC加工产品模板</field> <field name="name">CNC加工产品模板</field>
<field name="active" eval="False"/> <field name="active" eval="False"/>
@@ -29,7 +34,7 @@
<field name="company_id" ref="base.main_company"/> <field name="company_id" ref="base.main_company"/>
<field name="single_manufacturing">true</field> <field name="single_manufacturing">true</field>
<field name="tracking">serial</field> <field name="tracking">serial</field>
<field name="is_bfm">false</field>
</record> </record>
<record id="product_embryo_sf_self_machining" model="product.product"> <record id="product_embryo_sf_self_machining" model="product.product">
<field name="name">胚料自加工模板</field> <field name="name">胚料自加工模板</field>
@@ -45,6 +50,7 @@
<field name="company_id" ref="base.main_company"/> <field name="company_id" ref="base.main_company"/>
<field name="single_manufacturing">true</field> <field name="single_manufacturing">true</field>
<field name="tracking">serial</field> <field name="tracking">serial</field>
<field name="is_bfm">false</field>
</record> </record>
<record id="product_embryo_sf_outsource" model="product.product"> <record id="product_embryo_sf_outsource" model="product.product">
@@ -60,6 +66,7 @@
<field name="uom_po_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="company_id" ref="base.main_company"/>
<field name="tracking">serial</field> <field name="tracking">serial</field>
<field name="is_bfm">false</field>
</record> </record>
<record id="product_embryo_sf_purchase" model="product.product"> <record id="product_embryo_sf_purchase" model="product.product">
<field name="name">胚料采购模板</field> <field name="name">胚料采购模板</field>
@@ -74,6 +81,7 @@
<field name="uom_po_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="company_id" ref="base.main_company"/>
<field name="tracking">serial</field> <field name="tracking">serial</field>
<field name="is_bfm">false</field>
</record> </record>
</data> </data>
</odoo> </odoo>

View File

@@ -1,8 +1,8 @@
from odoo import models, fields, api from odoo import models, fields, api
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError
from odoo.modules import get_resource_path from odoo.modules import get_resource_path
from OCC.Extend.DataExchange import read_step_file # from OCC.Extend.DataExchange import read_step_file
from OCC.Extend.DataExchange import write_stl_file # from OCC.Extend.DataExchange import write_stl_file
import logging import logging
import base64 import base64
import hashlib import hashlib
@@ -30,8 +30,9 @@ class ResProductTemplate(models.Model):
product_model_type_id = fields.Many2one('sf.model.type', string='产品模型类型') product_model_type_id = fields.Many2one('sf.model.type', string='产品模型类型')
embryo_model_type_id = fields.Many2one('sf.model.type', string='胚料模型类型') embryo_model_type_id = fields.Many2one('sf.model.type', string='胚料模型类型')
model_processing_panel = fields.Char('模型加工面板') model_processing_panel = fields.Char('模型加工面板')
model_surface_process_id = fields.Many2one('sf.production.process', string='表面工艺') # model_surface_process_category_id = fields.Many2one('sf.production.process.category', string='表面工艺类别')
model_process_parameters_id = fields.Many2one('sf.processing.technology', string='工艺参数') model_surface_process_id = fields.Many2many('sf.production.process', 'rel_product_process', string='表面工艺')
model_process_parameters_id = fields.Many2many('sf.processing.technology', 'rel_product_technology', string='工艺参数')
# model_price = fields.Float('模型单价', digits=(16, 3)) # model_price = fields.Float('模型单价', digits=(16, 3))
model_remark = fields.Char('模型备注说明') model_remark = fields.Char('模型备注说明')
length = fields.Float('长[mm]', digits=(16, 3)) length = fields.Float('长[mm]', digits=(16, 3))
@@ -108,8 +109,8 @@ class ResProductTemplate(models.Model):
[('materials_no', '=', item['texture_type_code'])]).id, [('materials_no', '=', item['texture_type_code'])]).id,
'model_surface_process_id': self.env['sf.production.process'].search( 'model_surface_process_id': self.env['sf.production.process'].search(
[('process_encode', '=', item['surface_process_code'])]).id, [('process_encode', '=', item['surface_process_code'])]).id,
# 'model_process_parameters_id': self.env['sf.processing.technology'].search( 'model_process_parameters_id': self.env['sf.processing.technology'].search(
# [('process_encode', '=', item['process_parameters_code'])]).id, [('process_encode', '=', item['process_parameters_code'])]).id,
'model_remark': item['remark'], 'model_remark': item['remark'],
'default_code': '%s-%s' % (order_number, i), 'default_code': '%s-%s' % (order_number, i),
# 'barcode': item['barcode'], # 'barcode': item['barcode'],
@@ -182,14 +183,15 @@ class ResProductTemplate(models.Model):
@api.model_create_multi @api.model_create_multi
def create(self, vals_list): def create(self, vals_list):
for vals in vals_list: for vals in vals_list:
if vals['upload_model_file']: if vals.get('upload_model_file'):
for item in vals['upload_model_file']: if vals.get('is_bfm') is False and vals.get('categ_type') == '成品':
attachment = self.env['ir.attachment'].sudo().search([('id', '=', int(item[2][0]))]) for item in vals['upload_model_file']:
base64_data = base64.b64encode(attachment.datas) attachment = self.env['ir.attachment'].sudo().search([('id', '=', int(item[2][0]))])
base64_datas = base64_data.decode('utf-8') base64_data = base64.b64encode(attachment.datas)
model_code = hashlib.sha1(base64_datas.encode('utf-8')).hexdigest() base64_datas = base64_data.decode('utf-8')
report_path = attachment._full_path(attachment.store_fname) model_code = hashlib.sha1(base64_datas.encode('utf-8')).hexdigest()
vals['model_file'] = self.transition_glb_file(report_path, model_code) report_path = attachment._full_path(attachment.store_fname)
vals['model_file'] = self.transition_glb_file(report_path, model_code)
self._sanitize_vals(vals) self._sanitize_vals(vals)
templates = super(ResProductTemplate, self).create(vals_list) templates = super(ResProductTemplate, self).create(vals_list)
if "create_product_product" not in self._context: if "create_product_product" not in self._context:

View File

@@ -14,7 +14,8 @@
<field name="detailed_type" position="before"> <field name="detailed_type" position="before">
<field name='categ_type' invisible="1"/> <field name='categ_type' invisible="1"/>
<field name="upload_model_file" <field name="upload_model_file"
widget="many2many_binary"/> widget="many2many_binary"
attrs="{'invisible': ['|', ('categ_type', '!=', '成品'),('categ_type', '=', False)]}"/>
<field name="model_file" widget="Viewer3D" string="模型" readonly="1" force_save="1" <field name="model_file" widget="Viewer3D" string="模型" readonly="1" force_save="1"
attrs="{'invisible': ['|', ('categ_type', '!=', '成品'),('categ_type', '=', False)]}"/> attrs="{'invisible': ['|', ('categ_type', '!=', '成品'),('categ_type', '=', False)]}"/>
</field> </field>
@@ -24,6 +25,8 @@
<field name="materials_id" string="材料"/> <field name="materials_id" string="材料"/>
<field name="materials_type_id" string="型号" <field name="materials_type_id" string="型号"
domain="[('materials_id', '=', materials_id)]"/> domain="[('materials_id', '=', materials_id)]"/>
<field name="model_surface_process_id" string="表面工艺" widget="many2many_tags"/>
<field name="model_process_parameters_id" string="工艺参数" widget="many2many_tags"/>
</field> </field>
<xpath expr="//label[@for='volume']" position="before"> <xpath expr="//label[@for='volume']" position="before">

View File

@@ -34,7 +34,7 @@
'assets': { 'assets': {
}, },
'license': 'LGPL-3',
'installable': True, 'installable': True,
'application': True, 'application': True,
# 'auto_install': False, # 'auto_install': False,

View File

@@ -27,6 +27,7 @@
], ],
'qweb': [ 'qweb': [
], ],
'license': 'LGPL-3',
'installable': True, 'installable': True,
'application': False, 'application': False,
'auto_install': False, 'auto_install': False,

View File

@@ -248,7 +248,7 @@ class MrpProduction(models.Model):
if work.name == '获取CNC加工程序': if work.name == '获取CNC加工程序':
work.button_start() work.button_start()
#work.button_finish() #work.button_finish()
work.fetchCNC() #work.fetchCNC()
#创建工单并进行排序 #创建工单并进行排序
def _create_workorder(self): def _create_workorder(self):

View File

@@ -19,6 +19,7 @@
], ],
'qweb': [ 'qweb': [
], ],
'license': 'LGPL-3',
'installable': True, 'installable': True,
'application': False, 'application': False,
'auto_install': False, 'auto_install': False,

View File

@@ -24,10 +24,10 @@ class ResConfigSettings(models.TransientModel):
_logger.info("同步资源库材料") _logger.info("同步资源库材料")
self.env['sf.materials.model'].sync_all_materials_model() self.env['sf.materials.model'].sync_all_materials_model()
_logger.info("同步资源库材料型号") _logger.info("同步资源库材料型号")
self.env['sf.production.process'].sync_all_production_process()
_logger.info("同步资源库表面工艺")
self.env['sf.production.process.category'].sync_all_production_process_category() self.env['sf.production.process.category'].sync_all_production_process_category()
_logger.info("同步资源库表面工艺类别") _logger.info("同步资源库表面工艺类别")
self.env['sf.production.process'].sync_all_production_process()
_logger.info("同步资源库表面工艺")
self.env['sf.processing.technology'].sync_all_processing_technology() self.env['sf.processing.technology'].sync_all_processing_technology()
_logger.info("同步资源库加工工艺") _logger.info("同步资源库加工工艺")
self.env['sf.machine.brand.tags'].sync_all_machine_brand_tags() self.env['sf.machine.brand.tags'].sync_all_machine_brand_tags()

View File

@@ -212,7 +212,7 @@ class sfProductionProcessCategory(models.Model):
for item in result['production_process_category_all_list']: for item in result['production_process_category_all_list']:
if item: if item:
category = self.env['sf.production.process.category'].search( category = self.env['sf.production.process.category'].search(
[("process_encode", '=', item['process_encode'])]) [("code", '=', item['code'])])
if not category: if not category:
self.env['sf.production.process.category'].create({ self.env['sf.production.process.category'].create({
"name": item['name'], "name": item['name'],

View File

@@ -18,6 +18,7 @@
], ],
'qweb': [ 'qweb': [
], ],
'license': 'LGPL-3',
'installable': True, 'installable': True,
'application': False, 'application': False,
'auto_install': False, 'auto_install': False,