物料需求计划管理

This commit is contained in:
guanhuan
2025-06-25 15:33:24 +08:00
parent deda36a0f9
commit 413cf43ea0
3 changed files with 39 additions and 48 deletions

View File

@@ -50,19 +50,10 @@ class ReSaleOrder(models.Model):
def action_view_demand_plan(self):
self.ensure_one()
demand_plan_ids = self.env['sf.production.demand.plan'].sudo().search([('sale_order_id', '=', self.id)]).ids
action = {
return {
'res_model': 'sf.production.demand.plan',
'type': 'ir.actions.act_window',
'name': _("需求计划"),
'domain': [('id', 'in', demand_plan_ids)],
'view_mode': 'tree',
}
if len(demand_plan_ids) == 1:
action.update({
'view_mode': 'form',
'res_id': demand_plan_ids[0],
})
else:
action.update({
'name': _("需求计划"),
'domain': [('id', 'in', demand_plan_ids)],
'view_mode': 'tree',
})
return action