diff --git a/sf_manufacturing/data/stock_data.xml b/sf_manufacturing/data/stock_data.xml
index 6bd0fe53..72559691 100644
--- a/sf_manufacturing/data/stock_data.xml
+++ b/sf_manufacturing/data/stock_data.xml
@@ -67,5 +67,21 @@
search="[('barcode','=','WH-PREPRODUCTION')]"/>
+
+
+ 表面工艺外协
+
+ True
+ 11
+
+
+
+
+
+
+
+
+
+
diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py
index f255d28b..dc2fff9d 100644
--- a/sf_manufacturing/models/stock.py
+++ b/sf_manufacturing/models/stock.py
@@ -17,6 +17,50 @@ from io import BytesIO
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):
_inherit = 'stock.rule'
diff --git a/sf_sale/models/sale_order.py b/sf_sale/models/sale_order.py
index a55f9fb3..e2313ba3 100644
--- a/sf_sale/models/sale_order.py
+++ b/sf_sale/models/sale_order.py
@@ -85,11 +85,16 @@ class ReSaleOrder(models.Model):
self.check_status = 'pending'
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')
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
else:
- partner_tag = self.env['res.partner.category'].create({'name': '平台客户'})
partner = self.env['res.partner'].create(
{'name': '业务平台', 'vat': '91430103MA7BRH9K4M', 'phone': '0731-85115515',
'email': 'jikimo@jikimo.com', 'category_id': [Command.set([partner_tag.id])]})
diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py
index 2228d2d5..931c6410 100644
--- a/sf_warehouse/models/model.py
+++ b/sf_warehouse/models/model.py
@@ -19,13 +19,6 @@ class SfLocation(models.Model):
name = fields.Char('Location Name', required=True, size=20)
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:库区、库位、货位)
# location_type = fields.Selection([
@@ -822,112 +815,15 @@ class SfProcurementGroup(models.Model):
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):
_inherit = 'stock.picking.type'
- check_state = fields.Selection([
- ('enable', '启用'),
- ('close', '关闭')
- ], string='审核状态', default='close')
-
- def action_check(self):
- 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'
+ def _default_show_operations(self):
+ return self.user_has_groups('stock.group_production_lot,'
+ 'stock.group_stock_multi_locations,'
+ 'stock.group_tracking_lot',
+ 'sf_warehouse.group_sf_stock_user',
+ 'sf_warehouse.group_sf_stock_manager')
class CustomStockMove(models.Model):
diff --git a/sf_warehouse/views/view.xml b/sf_warehouse/views/view.xml
index 39d5a8c0..aa3293ce 100644
--- a/sf_warehouse/views/view.xml
+++ b/sf_warehouse/views/view.xml
@@ -67,16 +67,16 @@
-
-
+
+
+
+
+
+
+
+
-
+
@@ -188,23 +188,23 @@
-
- stock.warehouse.form.sf.inherit
- stock.warehouse
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
@@ -220,23 +220,23 @@
-
- stock.route.form.sf.inherit
- stock.route
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
@@ -251,23 +251,23 @@
-
- stock.rule.form.sf.inherit
- stock.rule
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
@@ -282,23 +282,23 @@
-
- stock.picking.type.form.sf.inherit
- stock.picking.type
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+