物料需求计划提交
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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':
|
||||
|
||||
Reference in New Issue
Block a user