1.新增表面工艺外协路线初始化数据
This commit is contained in:
@@ -67,5 +67,21 @@
|
|||||||
search="[('barcode','=','WH-PREPRODUCTION')]"/>
|
search="[('barcode','=','WH-PREPRODUCTION')]"/>
|
||||||
<field name="default_location_dest_id" ref="stock_location_locations_virtual_outcontract"/>
|
<field name="default_location_dest_id" ref="stock_location_locations_virtual_outcontract"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="route_surface_technology_outsourcing" model="stock.route">
|
||||||
|
<field name="name">表面工艺外协</field>
|
||||||
|
<!-- <field name="company_id"></field>-->
|
||||||
|
<field name="active">True</field>
|
||||||
|
<field name="sequence">11</field>
|
||||||
|
</record>
|
||||||
|
<!-- <record id="route_surface_technology_outsourcing" model="stock.rule">-->
|
||||||
|
<!-- <field name="name">外协出库单</field>-->
|
||||||
|
<!-- <field name="action">push</field>-->
|
||||||
|
<!-- <field name="pick_type_id" ref="outcontract_picking_out"></field>-->
|
||||||
|
<!-- <field name="location_src_id" ref=""/>-->
|
||||||
|
<!-- <field name="location_dest_id" ref="stock_location_locations_virtual_outcontract"/>-->
|
||||||
|
<!-- <field name="active">True</field>-->
|
||||||
|
<!-- <field name="sequence">11</field>-->
|
||||||
|
<!-- </record>-->
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -17,6 +17,50 @@ from io import BytesIO
|
|||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
|
class stockWarehouse(models.Model):
|
||||||
|
_inherit = 'stock.warehouse'
|
||||||
|
|
||||||
|
subcontracting_surface_technology_pull_out_id = fields.Many2one(
|
||||||
|
'stock.rule', '表面工艺规则1')
|
||||||
|
subcontracting_surface_technology_pull_in_id = fields.Many2one(
|
||||||
|
'stock.rule', '表面工艺规则2'
|
||||||
|
)
|
||||||
|
|
||||||
|
def _get_global_route_rules_values(self):
|
||||||
|
rules = super(stockWarehouse, self)._get_global_route_rules_values()
|
||||||
|
location_virtual_id = self.env.ref(
|
||||||
|
'sf_manufacturing.stock_location_locations_virtual_outcontract').id,
|
||||||
|
location_pre_id = self.env['stock.location'].search(
|
||||||
|
[('barcode', 'ilike', 'WH-PREPRODUCTION')]).id,
|
||||||
|
rules.update({
|
||||||
|
'subcontracting_surface_technology_pull_in_id': {
|
||||||
|
'create_values': {
|
||||||
|
'action': 'pull',
|
||||||
|
'picking_type_id': self.env.ref('sf_manufacturing.outcontract_picking_in').id,
|
||||||
|
'group_propagation_option': 'none',
|
||||||
|
'company_id': self.company_id.id,
|
||||||
|
'location_src_id': location_virtual_id,
|
||||||
|
'location_dest_id': location_pre_id,
|
||||||
|
'route_id': self._find_global_route('sf_manufacturing.route_surface_technology_outsourcing',
|
||||||
|
_('表面工艺外协')).id,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'subcontracting_surface_technology_pull_out_id': {
|
||||||
|
'create_values': {
|
||||||
|
'action': 'pull',
|
||||||
|
'picking_type_id': self.env.ref('sf_manufacturing.outcontract_picking_out').id,
|
||||||
|
'group_propagation_option': 'none',
|
||||||
|
'company_id': self.company_id.id,
|
||||||
|
'location_src_id': location_pre_id,
|
||||||
|
'location_dest_id': location_virtual_id,
|
||||||
|
'route_id': self._find_global_route('sf_manufacturing.route_surface_technology_outsourcing',
|
||||||
|
_('表面工艺外协')).id,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return rules
|
||||||
|
|
||||||
|
|
||||||
class StockRule(models.Model):
|
class StockRule(models.Model):
|
||||||
_inherit = 'stock.rule'
|
_inherit = 'stock.rule'
|
||||||
|
|
||||||
|
|||||||
@@ -85,11 +85,16 @@ class ReSaleOrder(models.Model):
|
|||||||
self.check_status = 'pending'
|
self.check_status = 'pending'
|
||||||
|
|
||||||
def get_customer(self):
|
def get_customer(self):
|
||||||
|
partner_tag = self.env['res.partner.category'].search([('name', '=', '业务平台')], limit=1, order='id asc')
|
||||||
|
if not partner_tag:
|
||||||
|
partner_tag = self.env['res.partner.category'].create({'name': '平台客户'})
|
||||||
customer = self.env['res.partner'].search([('name', '=', '业务平台')], limit=1, order='id asc')
|
customer = self.env['res.partner'].search([('name', '=', '业务平台')], limit=1, order='id asc')
|
||||||
if customer:
|
if customer:
|
||||||
|
if not customer.vat:
|
||||||
|
customer.write({'name': '业务平台', 'vat': '91430103MA7BRH9K4M', 'phone': '0731-85115515',
|
||||||
|
'email': 'jikimo@jikimo.com', 'category_id': [Command.set([partner_tag.id])]})
|
||||||
return customer
|
return customer
|
||||||
else:
|
else:
|
||||||
partner_tag = self.env['res.partner.category'].create({'name': '平台客户'})
|
|
||||||
partner = self.env['res.partner'].create(
|
partner = self.env['res.partner'].create(
|
||||||
{'name': '业务平台', 'vat': '91430103MA7BRH9K4M', 'phone': '0731-85115515',
|
{'name': '业务平台', 'vat': '91430103MA7BRH9K4M', 'phone': '0731-85115515',
|
||||||
'email': 'jikimo@jikimo.com', 'category_id': [Command.set([partner_tag.id])]})
|
'email': 'jikimo@jikimo.com', 'category_id': [Command.set([partner_tag.id])]})
|
||||||
|
|||||||
@@ -19,13 +19,6 @@ class SfLocation(models.Model):
|
|||||||
name = fields.Char('Location Name', required=True, size=20)
|
name = fields.Char('Location Name', required=True, size=20)
|
||||||
barcode = fields.Char('Barcode', copy=False, size=15)
|
barcode = fields.Char('Barcode', copy=False, size=15)
|
||||||
|
|
||||||
check_state = fields.Selection([
|
|
||||||
('enable', '启用'),
|
|
||||||
('close', '关闭')
|
|
||||||
], string='审核状态', default='close')
|
|
||||||
|
|
||||||
def action_check(self):
|
|
||||||
self.check_state = 'enable'
|
|
||||||
|
|
||||||
# 仓库类别(selection:库区、库位、货位)
|
# 仓库类别(selection:库区、库位、货位)
|
||||||
# location_type = fields.Selection([
|
# location_type = fields.Selection([
|
||||||
@@ -822,112 +815,15 @@ class SfProcurementGroup(models.Model):
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
class SfWarehouse(models.Model):
|
|
||||||
_inherit = 'stock.warehouse'
|
|
||||||
|
|
||||||
check_state = fields.Selection([
|
|
||||||
('enable', '启用'),
|
|
||||||
('close', '关闭')
|
|
||||||
], string='审核状态', default='close')
|
|
||||||
|
|
||||||
def action_check(self):
|
|
||||||
self.check_state = 'enable'
|
|
||||||
|
|
||||||
|
|
||||||
class SfRule(models.Model):
|
|
||||||
_inherit = 'stock.rule'
|
|
||||||
|
|
||||||
check_state = fields.Selection([
|
|
||||||
('enable', '启用'),
|
|
||||||
('close', '关闭')
|
|
||||||
], string='审核状态', default='close')
|
|
||||||
|
|
||||||
def action_check(self):
|
|
||||||
self.check_state = 'enable'
|
|
||||||
|
|
||||||
|
|
||||||
class SfRoute(models.Model):
|
|
||||||
_inherit = 'stock.route'
|
|
||||||
|
|
||||||
check_state = fields.Selection([
|
|
||||||
('enable', '启用'),
|
|
||||||
('close', '关闭')
|
|
||||||
], string='审核状态', default='close')
|
|
||||||
|
|
||||||
def action_check(self):
|
|
||||||
self.check_state = 'enable'
|
|
||||||
|
|
||||||
|
|
||||||
class SfPickingType(models.Model):
|
class SfPickingType(models.Model):
|
||||||
_inherit = 'stock.picking.type'
|
_inherit = 'stock.picking.type'
|
||||||
|
|
||||||
check_state = fields.Selection([
|
def _default_show_operations(self):
|
||||||
('enable', '启用'),
|
return self.user_has_groups('stock.group_production_lot,'
|
||||||
('close', '关闭')
|
'stock.group_stock_multi_locations,'
|
||||||
], string='审核状态', default='close')
|
'stock.group_tracking_lot',
|
||||||
|
'sf_warehouse.group_sf_stock_user',
|
||||||
def action_check(self):
|
'sf_warehouse.group_sf_stock_manager')
|
||||||
self.check_state = 'enable'
|
|
||||||
|
|
||||||
|
|
||||||
class SfBarcodeNomenclature(models.Model):
|
|
||||||
_inherit = 'barcode.nomenclature'
|
|
||||||
|
|
||||||
check_state = fields.Selection([
|
|
||||||
('enable', '启用'),
|
|
||||||
('close', '关闭')
|
|
||||||
], string='审核状态', default='close')
|
|
||||||
|
|
||||||
def action_check(self):
|
|
||||||
self.check_state = 'enable'
|
|
||||||
|
|
||||||
|
|
||||||
class SfPutawayRule(models.Model):
|
|
||||||
_inherit = 'stock.putaway.rule'
|
|
||||||
|
|
||||||
check_state = fields.Selection([
|
|
||||||
('enable', '同意'),
|
|
||||||
('close', '不同意')
|
|
||||||
], string='审核状态', default='close')
|
|
||||||
|
|
||||||
def action_check(self):
|
|
||||||
self.check_state = 'enable'
|
|
||||||
|
|
||||||
|
|
||||||
class SfWarehouseOrderpoint(models.Model):
|
|
||||||
_inherit = 'stock.warehouse.orderpoint'
|
|
||||||
|
|
||||||
check_state = fields.Selection([
|
|
||||||
('enable', '同意'),
|
|
||||||
('close', '不同意')
|
|
||||||
], string='审核状态', default='close')
|
|
||||||
|
|
||||||
def action_check(self):
|
|
||||||
self.check_state = 'enable'
|
|
||||||
|
|
||||||
|
|
||||||
class SfStockQuant(models.Model):
|
|
||||||
_inherit = 'stock.quant'
|
|
||||||
|
|
||||||
check_state = fields.Selection([
|
|
||||||
('enable', '同意'),
|
|
||||||
('close', '不同意')
|
|
||||||
], string='审核状态', default='close')
|
|
||||||
|
|
||||||
def action_check(self):
|
|
||||||
self.check_state = 'enable'
|
|
||||||
|
|
||||||
|
|
||||||
class SfStockScrap(models.Model):
|
|
||||||
_inherit = 'stock.scrap'
|
|
||||||
|
|
||||||
check_state = fields.Selection([
|
|
||||||
('enable', '启用'),
|
|
||||||
('close', '关闭')
|
|
||||||
], string='审核状态', default='close')
|
|
||||||
|
|
||||||
def action_check(self):
|
|
||||||
self.check_state = 'enable'
|
|
||||||
|
|
||||||
|
|
||||||
class CustomStockMove(models.Model):
|
class CustomStockMove(models.Model):
|
||||||
|
|||||||
@@ -67,16 +67,16 @@
|
|||||||
</notebook>
|
</notebook>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
<xpath expr="//sheet" position="before">
|
<!-- <xpath expr="//sheet" position="before">-->
|
||||||
<header>
|
<!-- <header>-->
|
||||||
<field name="check_state" invisible="1"/>
|
<!-- <field name="check_state" invisible="1"/>-->
|
||||||
<button name="action_check" string="审核" type="object"
|
<!-- <button name="action_check" string="审核" type="object"-->
|
||||||
attrs="{'invisible': [('check_state','=', 'enable')]}"
|
<!-- attrs="{'invisible': [('check_state','=', 'enable')]}"-->
|
||||||
groups="sf_warehouse.group_sf_stock_manager"
|
<!-- groups="sf_warehouse.group_sf_stock_manager"-->
|
||||||
class="oe_highlight"/>
|
<!-- class="oe_highlight"/>-->
|
||||||
</header>
|
<!-- </header>-->
|
||||||
|
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
@@ -188,23 +188,23 @@
|
|||||||
<!-- </record>-->
|
<!-- </record>-->
|
||||||
|
|
||||||
<!--仓库根据权限增加审核按钮-->
|
<!--仓库根据权限增加审核按钮-->
|
||||||
<record id="view_warehouse_form_sf_inherit" model="ir.ui.view">
|
<!-- <record id="view_warehouse_form_sf_inherit" model="ir.ui.view">-->
|
||||||
<field name="name">stock.warehouse.form.sf.inherit</field>
|
<!-- <field name="name">stock.warehouse.form.sf.inherit</field>-->
|
||||||
<field name="model">stock.warehouse</field>
|
<!-- <field name="model">stock.warehouse</field>-->
|
||||||
<field name="inherit_id" ref="stock.view_warehouse"/>
|
<!-- <field name="inherit_id" ref="stock.view_warehouse"/>-->
|
||||||
<field name="arch" type="xml">
|
<!-- <field name="arch" type="xml">-->
|
||||||
<xpath expr="//sheet" position="before">
|
<!-- <xpath expr="//sheet" position="before">-->
|
||||||
<header>
|
<!-- <header>-->
|
||||||
<field name="check_state" invisible="1"/>
|
<!-- <field name="check_state" invisible="1"/>-->
|
||||||
<button name="action_check" string="审核" type="object"
|
<!-- <button name="action_check" string="审核" type="object"-->
|
||||||
attrs="{'invisible': [('check_state','=', 'enable')]}"
|
<!-- attrs="{'invisible': [('check_state','=', 'enable')]}"-->
|
||||||
groups="sf_warehouse.group_sf_stock_manager"
|
<!-- groups="sf_warehouse.group_sf_stock_manager"-->
|
||||||
class="oe_highlight"/>
|
<!-- class="oe_highlight"/>-->
|
||||||
</header>
|
<!-- </header>-->
|
||||||
|
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
</field>
|
<!-- </field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
<!-- <record id="view_warehouse_tree_sf_inherit" model="ir.ui.view">-->
|
<!-- <record id="view_warehouse_tree_sf_inherit" model="ir.ui.view">-->
|
||||||
<!-- <field name="name">stock.warehouse.tree.sf.inherit</field>-->
|
<!-- <field name="name">stock.warehouse.tree.sf.inherit</field>-->
|
||||||
@@ -220,23 +220,23 @@
|
|||||||
|
|
||||||
|
|
||||||
<!--路线根据权限增加审核按钮-->
|
<!--路线根据权限增加审核按钮-->
|
||||||
<record id="view_route_form_sf_inherit" model="ir.ui.view">
|
<!-- <record id="view_route_form_sf_inherit" model="ir.ui.view">-->
|
||||||
<field name="name">stock.route.form.sf.inherit</field>
|
<!-- <field name="name">stock.route.form.sf.inherit</field>-->
|
||||||
<field name="model">stock.route</field>
|
<!-- <field name="model">stock.route</field>-->
|
||||||
<field name="inherit_id" ref="stock.stock_location_route_form_view"/>
|
<!-- <field name="inherit_id" ref="stock.stock_location_route_form_view"/>-->
|
||||||
<field name="arch" type="xml">
|
<!-- <field name="arch" type="xml">-->
|
||||||
<xpath expr="//sheet" position="before">
|
<!-- <xpath expr="//sheet" position="before">-->
|
||||||
<header>
|
<!-- <header>-->
|
||||||
<field name="check_state" invisible="1"/>
|
<!-- <field name="check_state" invisible="1"/>-->
|
||||||
<button name="action_check" string="审核" type="object"
|
<!-- <button name="action_check" string="审核" type="object"-->
|
||||||
attrs="{'invisible': [('check_state','=', 'enable')]}"
|
<!-- attrs="{'invisible': [('check_state','=', 'enable')]}"-->
|
||||||
groups="sf_warehouse.group_sf_stock_manager"
|
<!-- groups="sf_warehouse.group_sf_stock_manager"-->
|
||||||
class="oe_highlight"/>
|
<!-- class="oe_highlight"/>-->
|
||||||
</header>
|
<!-- </header>-->
|
||||||
|
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
</field>
|
<!-- </field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
<!-- <record id="view_route_tree_sf_inherit" model="ir.ui.view">-->
|
<!-- <record id="view_route_tree_sf_inherit" model="ir.ui.view">-->
|
||||||
<!-- <field name="name">stock.route.tree.sf.inherit</field>-->
|
<!-- <field name="name">stock.route.tree.sf.inherit</field>-->
|
||||||
@@ -251,23 +251,23 @@
|
|||||||
<!-- </record>-->
|
<!-- </record>-->
|
||||||
|
|
||||||
<!--规则根据权限增加审核按钮-->
|
<!--规则根据权限增加审核按钮-->
|
||||||
<record id="view_rule_form_sf_inherit" model="ir.ui.view">
|
<!-- <record id="view_rule_form_sf_inherit" model="ir.ui.view">-->
|
||||||
<field name="name">stock.rule.form.sf.inherit</field>
|
<!-- <field name="name">stock.rule.form.sf.inherit</field>-->
|
||||||
<field name="model">stock.rule</field>
|
<!-- <field name="model">stock.rule</field>-->
|
||||||
<field name="inherit_id" ref="stock.view_stock_rule_form"/>
|
<!-- <field name="inherit_id" ref="stock.view_stock_rule_form"/>-->
|
||||||
<field name="arch" type="xml">
|
<!-- <field name="arch" type="xml">-->
|
||||||
<xpath expr="//sheet" position="before">
|
<!-- <xpath expr="//sheet" position="before">-->
|
||||||
<header>
|
<!-- <header>-->
|
||||||
<field name="check_state" invisible="1"/>
|
<!-- <field name="check_state" invisible="1"/>-->
|
||||||
<button name="action_check" string="审核" type="object"
|
<!-- <button name="action_check" string="审核" type="object"-->
|
||||||
attrs="{'invisible': [('check_state','=', 'enable')]}"
|
<!-- attrs="{'invisible': [('check_state','=', 'enable')]}"-->
|
||||||
groups="sf_warehouse.group_sf_stock_manager"
|
<!-- groups="sf_warehouse.group_sf_stock_manager"-->
|
||||||
class="oe_highlight"/>
|
<!-- class="oe_highlight"/>-->
|
||||||
</header>
|
<!-- </header>-->
|
||||||
|
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
</field>
|
<!-- </field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
<!-- <record id="view_rule_tree_sf_inherit" model="ir.ui.view">-->
|
<!-- <record id="view_rule_tree_sf_inherit" model="ir.ui.view">-->
|
||||||
<!-- <field name="name">stock.rule.tree.sf.inherit</field>-->
|
<!-- <field name="name">stock.rule.tree.sf.inherit</field>-->
|
||||||
@@ -282,23 +282,23 @@
|
|||||||
<!-- </record>-->
|
<!-- </record>-->
|
||||||
|
|
||||||
<!--作业类型根据权限增加审核按钮-->
|
<!--作业类型根据权限增加审核按钮-->
|
||||||
<record id="view_picking_type_form_sf_inherit" model="ir.ui.view">
|
<!-- <record id="view_picking_type_form_sf_inherit" model="ir.ui.view">-->
|
||||||
<field name="name">stock.picking.type.form.sf.inherit</field>
|
<!-- <field name="name">stock.picking.type.form.sf.inherit</field>-->
|
||||||
<field name="model">stock.picking.type</field>
|
<!-- <field name="model">stock.picking.type</field>-->
|
||||||
<field name="inherit_id" ref="stock.view_picking_type_form"/>
|
<!-- <field name="inherit_id" ref="stock.view_picking_type_form"/>-->
|
||||||
<field name="arch" type="xml">
|
<!-- <field name="arch" type="xml">-->
|
||||||
<xpath expr="//sheet" position="before">
|
<!-- <xpath expr="//sheet" position="before">-->
|
||||||
<header>
|
<!-- <header>-->
|
||||||
<field name="check_state" invisible="1"/>
|
<!-- <field name="check_state" invisible="1"/>-->
|
||||||
<button name="action_check" string="审核" type="object"
|
<!-- <button name="action_check" string="审核" type="object"-->
|
||||||
attrs="{'invisible': [('check_state','=', 'enable')]}"
|
<!-- attrs="{'invisible': [('check_state','=', 'enable')]}"-->
|
||||||
groups="sf_warehouse.group_sf_stock_manager"
|
<!-- groups="sf_warehouse.group_sf_stock_manager"-->
|
||||||
class="oe_highlight"/>
|
<!-- class="oe_highlight"/>-->
|
||||||
</header>
|
<!-- </header>-->
|
||||||
|
|
||||||
</xpath>
|
<!-- </xpath>-->
|
||||||
</field>
|
<!-- </field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
<!-- <record id="view_picking_type_tree_sf_inherit" model="ir.ui.view">-->
|
<!-- <record id="view_picking_type_tree_sf_inherit" model="ir.ui.view">-->
|
||||||
<!-- <field name="name">stock.picking.type.tree.sf.inherit</field>-->
|
<!-- <field name="name">stock.picking.type.tree.sf.inherit</field>-->
|
||||||
|
|||||||
Reference in New Issue
Block a user