diff --git a/sf_demand_plan/__manifest__.py b/sf_demand_plan/__manifest__.py
index 0e9b3ca5..40323c5f 100644
--- a/sf_demand_plan/__manifest__.py
+++ b/sf_demand_plan/__manifest__.py
@@ -13,11 +13,14 @@
'depends': ['sf_plan'],
'data': [
'security/ir.model.access.csv',
+ 'data/stock_route_group.xml',
'views/sale_order_views.xml',
'views/demand_plan.xml',
'views/demand_main_plan.xml',
+ 'views/stock_route.xml',
'wizard/sf_demand_plan_print_wizard_view.xml',
'wizard/sf_release_plan_wizard_views.xml',
+ 'views/menu_view.xml',
],
'demo': [
],
diff --git a/sf_demand_plan/data/stock_route_group.xml b/sf_demand_plan/data/stock_route_group.xml
new file mode 100644
index 00000000..1b4a0b84
--- /dev/null
+++ b/sf_demand_plan/data/stock_route_group.xml
@@ -0,0 +1,21 @@
+
+
+
+
+ 自动化产线加工
+ automation
+
+
+ 人工线下加工
+ manual
+
+
+ 外购
+ purchase
+
+
+ 委外加工
+ outsourcing
+
+
+
\ No newline at end of file
diff --git a/sf_demand_plan/models/sale_order.py b/sf_demand_plan/models/sale_order.py
index f4591cb2..a49a51a8 100644
--- a/sf_demand_plan/models/sale_order.py
+++ b/sf_demand_plan/models/sale_order.py
@@ -9,12 +9,14 @@ class ReSaleOrder(models.Model):
compute='_compute_mrp_production_ids',
string='与此销售订单相关联的制造订单',
groups='mrp.group_mrp_user', store=True)
+ demand_plan_ids = fields.Many2many(comodel_name="sf.demand.main.plan",
+ string="需求计划", readonly=True)
demand_plan_count = fields.Integer(
"需求计划生成计数",
compute='_compute_demand_plan_count',
)
#暂时不知道哪里用到了
- @api.depends('procurement_group_id')
+ @api.depends('demand_plan_ids.line_ids.status')
def _compute_purchase_request_count(self):
for record in self:
pr_ids = self.env['purchase.request'].sudo().search([('origin', 'like', record.name)])
@@ -23,6 +25,7 @@ class ReSaleOrder(models.Model):
else:
record.purchase_request_purchase_order_count = 0
#计算需求计划生成计数
+ @api.depends('demand_plan_ids.line_ids')
def _compute_demand_plan_count(self):
for line in self:
demand_plan = self.env['sf.production.demand.plan'].sudo().search([('sale_order_id', '=', line.id)])
@@ -62,8 +65,9 @@ class ReSaleOrder(models.Model):
'type': '1',
}
self.env['sf.demand.plan.print.wizard'].sudo().create(wizard_vals)
+ ret.order_id.demand_plan_ids = [(4, demand_plan_info.id)]
return ret
- #暂时不知道哪里用到
+ #从sf工厂调过来时,调用了,这里重写
def confirm_to_supply_method(self):
self.state = 'sale'
for line in self.order_line:
diff --git a/sf_demand_plan/models/sf_production_demand_plan.py b/sf_demand_plan/models/sf_production_demand_plan.py
index 52ac539b..d772f41f 100644
--- a/sf_demand_plan/models/sf_production_demand_plan.py
+++ b/sf_demand_plan/models/sf_production_demand_plan.py
@@ -94,7 +94,7 @@ class SfProductionDemandPlan(models.Model):
model_long = fields.Char('尺寸(mm)', compute='_compute_model_long')
blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类',
related='product_id.blank_type')
- #embryo_long = fields.Char('坯料尺寸(mm)', compute='_compute_embryo_long')
+ #blank_precision = fields.Selection([('精坯', '精坯'), ('粗坯', '粗坯')], string='坯料类型', related='product_id.blank_precision')
#materials_id = fields.Char('材料', compute='_compute_materials_id', store=True)
embryo_long = fields.Char('坯料尺寸(mm)', related='demand_plan_id.embryo_long')
materials_id = fields.Char('材料', related='demand_plan_id.materials_id')
@@ -598,7 +598,7 @@ class SfProductionDemandPlan(models.Model):
#同一需求计划下,相同供货方式的产品可以共享BOM
line_ids = self.demand_plan_id.line_ids.filtered(
lambda p: p.supply_method in ('automation', 'manual') and p.status in ('50', '60'))
- if line_ids:
+ if line_ids:
self.bom_id = line_ids[0].bom_id.id # 复用已有BOM
return
elif self.supply_method == 'outsourcing':
diff --git a/sf_demand_plan/views/demand_plan.xml b/sf_demand_plan/views/demand_plan.xml
index 3f3a600c..c602031b 100644
--- a/sf_demand_plan/views/demand_plan.xml
+++ b/sf_demand_plan/views/demand_plan.xml
@@ -4,16 +4,14 @@
sf.production.demand.plan
+ class="demand_plan_tree freeze-columns-before-part_number" create="false" delete="false">
-
-
@@ -30,6 +28,7 @@
+
@@ -45,7 +44,10 @@
-
+
diff --git a/sf_demand_plan/views/menu_view.xml b/sf_demand_plan/views/menu_view.xml
new file mode 100644
index 00000000..8f591e3f
--- /dev/null
+++ b/sf_demand_plan/views/menu_view.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sf_demand_plan/views/stock_route.xml b/sf_demand_plan/views/stock_route.xml
new file mode 100644
index 00000000..c4581acc
--- /dev/null
+++ b/sf_demand_plan/views/stock_route.xml
@@ -0,0 +1,21 @@
+
+
+
+ stock.route.form
+ stock.route
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+