1.修复产品类别和计量单位去掉审核状态字段2.优化bfm派单至sf的销售订单流程3.工序增加编码字段

This commit is contained in:
jinling.yang
2024-01-19 15:45:15 +08:00
parent eb117aef86
commit 3226942ed3
12 changed files with 26 additions and 101 deletions

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>
<record id="product_category_embryo_sf" model="product.category">
<field name="name">坯料</field>
<field name="type">坯料</field>

View File

@@ -1,6 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="sequence_routing_workcenter" model="ir.sequence">
<field name="name">工序编码规则</field>
<field name="code">mrp.routing.workcenter</field>
<field name="padding">4</field>
<field name="company_id" eval="False"/>
</record>
<record id="sequence_stock_picking_out" model="ir.sequence">
<field name="name">YourCompany Sequence ocout</field>
<field name="prefix">WH/OCOUT/</field>

View File

@@ -1,5 +1,6 @@
import logging
from odoo import fields, models
from odoo import fields, models, api
from odoo.exceptions import UserError
class ResMrpRoutingWorkcenter(models.Model):
@@ -21,13 +22,17 @@ class ResMrpRoutingWorkcenter(models.Model):
bom_id = fields.Many2one('mrp.bom', required=False)
surface_technics_id = fields.Many2one('sf.production.process', string="表面工艺")
def generate_code(self):
return self.env['ir.sequence'].next_by_code('mrp.routing.workcenter')
code = fields.Char('编码', default=generate_code)
# 获得当前登陆者公司
def get_company_id(self):
self.company_id = self.env.user.company_id.id
company_id = fields.Many2one('res.company', compute="get_company_id", related=False)
# 排产的时候, 根据坯料的长宽高比对一下机床的最大加工尺寸.不符合就不要分配给这个加工中心(机床).
# 工单对应的工作中心,根据工序中的工作中心去匹配,
# 如果只配置了一个工作中心,则默认采用该工作中心;

View File

@@ -6,8 +6,8 @@ import os
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError
from odoo.modules import get_resource_path
# from OCC.Extend.DataExchange import read_step_file
# from OCC.Extend.DataExchange import write_stl_file
from OCC.Extend.DataExchange import read_step_file
from OCC.Extend.DataExchange import write_stl_file
class ResProductMo(models.Model):

View File

@@ -6,6 +6,9 @@
<field name="model">mrp.routing.workcenter</field>
<field name="inherit_id" ref="mrp.mrp_routing_workcenter_form_view"/>
<field name="arch" type="xml">
<field name="name" position="before">
<field name="code" readonly="1"/>
</field>
<field name="workcenter_id" position="replace">
<field name="workcenter_ids" widget="many2many_tags" string="工作中心" required="0"/>
<field name="surface_technics_id"

View File

@@ -2,7 +2,7 @@
import logging
from odoo.modules import get_resource_path
from odoo import fields, models, api
# from quatotion import readSql, feature_recognize, auto_quatotion
from quatotion import readSql, feature_recognize, auto_quatotion
__author__ = 'jinling.yang'
_logger = logging.getLogger(__name__)

View File

@@ -5,8 +5,8 @@ import os
import json
from datetime import datetime
import requests
# from OCC.Extend.DataExchange import read_step_file
# from OCC.Extend.DataExchange import write_stl_file
from OCC.Extend.DataExchange import read_step_file
from OCC.Extend.DataExchange import write_stl_file
from odoo import models, fields, api
from odoo.modules import get_resource_path
from odoo.exceptions import ValidationError, UserError

View File

@@ -94,7 +94,7 @@ class ReSaleOrder(models.Model):
'product_uom_qty': item['number'],
'model_glb_file': base64.b64decode(item['model_file']),
}
return self.env['sale.order.line'].create(vals)
return self.env['sale.order.line'].with_context(skip_procurement=True).create(vals)
@api.constrains('order_line')
def check_order_line(self):
@@ -122,10 +122,6 @@ class ResaleOrderLine(models.Model):
model_glb_file = fields.Binary('模型的glb文件')
check_status = fields.Selection(related='order_id.check_status')
def create(self, vals_list):
lines = super(ResaleOrderLine, self).create(vals_list)
return lines
class RePurchaseOrder(models.Model):
_inherit = 'purchase.order'

View File

@@ -12,7 +12,7 @@ access_product_product_group_sale_salemanager,product_product_group_sale_saleman
access_product_product_group_sale_director,product_product_group_sale_director,product.model_product_product,sf_base.group_sale_director,1,1,1,0
access_product_product_group_purchase,product_product_group_purchase,product.model_product_product,sf_base.group_purchase,1,0,0,0
access_product_product_group_purchase_director,product_product_group_purchase_director,product.model_product_product,sf_base.group_purchase_director,1,1,1,0
access_product_template_group_sale_salemanager,product_product_group_sale_salemanager,product.model_product_template,sf_base.group_sale_salemanager,1,0,0,0
access_product_template_group_sale_salemanager,product_template_group_sale_salemanager,product.model_product_template,sf_base.group_sale_salemanager,1,0,0,0
access_product_template_group_sale_director,product_template_group_sale_director,product.model_product_template,sf_base.group_sale_director,1,1,1,0
access_product_template_group_purchase,product_template_group_purchase,product.model_product_template,sf_base.group_purchase,1,0,0,0
access_product_template_group_purchase_director,product_template_group_purchase_director,product.model_product_template,sf_base.group_purchase_director,1,1,1,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
12 access_product_product_group_sale_director product_product_group_sale_director product.model_product_product sf_base.group_sale_director 1 1 1 0
13 access_product_product_group_purchase product_product_group_purchase product.model_product_product sf_base.group_purchase 1 0 0 0
14 access_product_product_group_purchase_director product_product_group_purchase_director product.model_product_product sf_base.group_purchase_director 1 1 1 0
15 access_product_template_group_sale_salemanager product_product_group_sale_salemanager product_template_group_sale_salemanager product.model_product_template sf_base.group_sale_salemanager 1 0 0 0
16 access_product_template_group_sale_director product_template_group_sale_director product.model_product_template sf_base.group_sale_director 1 1 1 0
17 access_product_template_group_purchase product_template_group_purchase product.model_product_template sf_base.group_purchase 1 0 0 0
18 access_product_template_group_purchase_director product_template_group_purchase_director product.model_product_template sf_base.group_purchase_director 1 1 1 0

View File

@@ -84,7 +84,7 @@
<xpath expr="//form/header/button[@name='action_confirm'][2]" position="replace">
<button name="action_confirm" data-hotkey="v"
string="确认" type="object" context="{'validate_analytic': True}"
attrs="{'invisible': ['|','&amp;',('check_status', '!=', 'approved'),('state', 'in', ['draft','cancel']),'&amp;',('check_status', '=', 'approved'),('state', 'in', ['sale','cancel'])]}"/>
attrs="{'invisible': ['|','&amp;',('check_status', '!=', 'approved'),('state', 'in', ['draft','cancel']),'&amp;','&amp;',('check_status', '=', 'approved'),('state', 'in', ['sale','cancel']),('schedule_status', 'not in', False)]}"/>
</xpath>
<xpath expr="//form/header/button[@name='action_cancel']" position="attributes">
<attribute name="attrs">{'invisible': ['|',('state', 'in', ['cancel']),('check_status', 'in',

View File

@@ -567,30 +567,6 @@ class SfPickingType(models.Model):
self.check_state = 'enable'
class SfProductCategory(models.Model):
_inherit = 'product.category'
check_state = fields.Selection([
('enable', '启用'),
('close', '关闭')
], string='审核状态', default='close')
def action_check(self):
self.check_state = 'enable'
class SfUomCategory(models.Model):
_inherit = 'uom.category'
check_state = fields.Selection([
('enable', '启用'),
('close', '关闭')
], string='审核状态', default='close')
def action_check(self):
self.check_state = 'enable'
class SfBarcodeNomenclature(models.Model):
_inherit = 'barcode.nomenclature'

View File

@@ -312,69 +312,6 @@
</field>
</record>
<!--产品类别根据权限增加审核按钮-->
<record id="view_product_category_form_sf_inherit" model="ir.ui.view">
<field name="name">product.category.form.sf.inherit</field>
<field name="model">product.category</field>
<field name="inherit_id" ref="product.product_category_form_view"/>
<field name="arch" type="xml">
<xpath expr="//sheet" position="before">
<header>
<field name="check_state" invisible="1"/>
<button name="action_check" string="审核" type="object"
attrs="{'invisible': [('check_state','=', 'enable')]}"
groups="sf_warehouse.group_sf_stock_manager"
class="oe_highlight"/>
</header>
</xpath>
</field>
</record>
<record id="view_product_category_tree_sf_inherit" model="ir.ui.view">
<field name="name">product.category.tree.sf.inherit</field>
<field name="model">product.category</field>
<field name="inherit_id" ref="product.product_category_list_view"/>
<field name="arch" type="xml">
<xpath expr="//field[last()]" position="after">
<field name="check_state" widget="label_selection"
options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>
</xpath>
</field>
</record>
<!--计量单位类别根据权限增加审核按钮-->
<record id="view_uom_category_form_sf_inherit" model="ir.ui.view">
<field name="name">uom.category.form.sf.inherit</field>
<field name="model">uom.category</field>
<field name="inherit_id" ref="uom.product_uom_categ_form_view"/>
<field name="arch" type="xml">
<xpath expr="//sheet" position="before">
<header>
<field name="check_state" invisible="1"/>
<button name="action_check" string="审核" type="object"
attrs="{'invisible': [('check_state','=', 'enable')]}"
groups="sf_warehouse.group_sf_stock_manager"
class="oe_highlight"/>
</header>
</xpath>
</field>
</record>
<record id="view_uom_category_tree_sf_inherit" model="ir.ui.view">
<field name="name">uom.category.tree.sf.inherit</field>
<field name="model">uom.category</field>
<field name="inherit_id" ref="uom.product_uom_categ_tree_view"/>
<field name="arch" type="xml">
<xpath expr="//field[last()]" position="after">
<field name="check_state" widget="label_selection"
options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>
</xpath>
</field>
</record>
<!--条码命名规则根据权限增加审核按钮-->
<record id="view_barcode_nomenclature_form_sf_inherit" model="ir.ui.view">
<field name="name">barcode.nomenclature.form.sf.inherit</field>