物料需求计划

This commit is contained in:
guanhuan
2025-06-24 11:17:41 +08:00
parent 2f26aee90a
commit 02b4f76326
8 changed files with 75 additions and 2 deletions

View File

@@ -12,7 +12,15 @@ class SfDemandPlan(models.Model):
list = [(m.sync_id, m.name) for m in machinings]
return list
line_ids = fields.One2many('sf.production.demand.plan', 'demand_plan_id', string="需求计划", copy=True)
state = fields.Selection([
('10', '草稿'),
('20', '待工艺设计'),
('30', '部分下达'),
('40', '已下达'),
], string='状态')
line_ids = fields.One2many(comodel_name='sf.production.demand.plan',
inverse_name='demand_plan_id', string="需求计划", copy=True)
sale_order_id = fields.Many2one(comodel_name="sale.order",
string="销售订单", readonly=True)
@@ -35,6 +43,9 @@ class SfDemandPlan(models.Model):
# product_uom_qty = fields.Float(
# string="待计划",
# related='sale_order_line_id.product_uom_qty', store=True)
# product_uom_qty = fields.Float(
# string="已计划",
# related='sale_order_line_id.product_uom_qty', store=True)
model_id = fields.Char('模型ID', related='product_id.model_id')
customer_name = fields.Char('客户', related='sale_order_id.customer_name')
product_uom_qty = fields.Float(
@@ -65,6 +76,8 @@ class SfDemandPlan(models.Model):
('4', ''),
], string='优先级', default='3')
remark = fields.Char('备注')
@api.depends('product_id.part_number', 'product_id.model_name')
def _compute_part_number(self):
for line in self: