diff --git a/sf_demand_plan/__manifest__.py b/sf_demand_plan/__manifest__.py index 47cccebb..caa4dce3 100644 --- a/sf_demand_plan/__manifest__.py +++ b/sf_demand_plan/__manifest__.py @@ -10,7 +10,7 @@ """, 'category': 'sf', 'website': 'https://www.sf.jikimo.com', - 'depends': ['sf_plan'], #,'jikimo_printing' + 'depends': ['sf_plan','jikimo_printing'], 'data': [ 'security/ir.model.access.csv', 'data/stock_route_group.xml', diff --git a/sf_demand_plan/models/sf_production_demand_plan.py b/sf_demand_plan/models/sf_production_demand_plan.py index da231f3e..faa356db 100644 --- a/sf_demand_plan/models/sf_production_demand_plan.py +++ b/sf_demand_plan/models/sf_production_demand_plan.py @@ -695,9 +695,9 @@ class SfProductionDemandPlan(models.Model): self.action_confirm() def action_confirm(self): - """ - 确认需求计划行,创建 BOM、触发库存规则,并更新状态。 - """ + + #确认需求计划行,创建 BOM、触发库存规则,并更新状态。 + # 将当前需求计划行 ID 写入上下文,便于后续方法使用 self = self.with_context(demand_plan_line_id=self.id) @@ -717,9 +717,9 @@ class SfProductionDemandPlan(models.Model): def _get_embryo_template_by_supply_method(self): - """ - 根据供货方式返回对应的胚料模板 product.template 记录。 - """ + + #根据供货方式返回对应的胚料模板 product.template 记录。 + supply_map = { 'automation': self.env.ref('sf_dlm.product_embryo_sf_self_machining').sudo(), 'outsourcing': self.env.ref('sf_dlm.product_embryo_sf_outsource').sudo(), @@ -734,9 +734,9 @@ class SfProductionDemandPlan(models.Model): def mrp_bom_create(self): - """ - 创建 BOM(包含胚料与成品 BOM),用于后续生产或采购流程。 - """ + + #创建 BOM(包含胚料与成品 BOM),用于后续生产或采购流程。 + # 如果同一计划中已有对应的 BOM 可复用,则直接使用 if self.supply_method in ('automation', 'manual'): line_ids = self.demand_plan_id.line_ids.filtered( @@ -851,9 +851,9 @@ class SfProductionDemandPlan(models.Model): def _action_launch_stock_rule(self): - """ - 触发库存规则(如采购、生产),并确认相关拣货单。 - """ + + #触发库存规则(如采购、生产),并确认相关拣货单。 + procurements = [] group_id = self.sale_order_id.procurement_group_id @@ -903,9 +903,9 @@ class SfProductionDemandPlan(models.Model): def _prepare_procurement_group_vals(self): - """ - 构造创建 procurement group 所需的字段。 - """ + + #构造创建 procurement group 所需的字段。 + return { 'name': self.sale_order_id.name, 'move_type': self.sale_order_id.picking_policy, @@ -915,9 +915,9 @@ class SfProductionDemandPlan(models.Model): def _prepare_procurement_values(self, group_id=False): - """ - 构造单个 procurement 请求所需的字段字典。 - """ + + #构造单个 procurement 请求所需的字段字典。 + self.ensure_one() # 交货日期与计划日期