需求计划详情调拨单显示
This commit is contained in:
16
sf_demand_plan/models/stock_picking.py
Normal file
16
sf_demand_plan/models/stock_picking.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from odoo import fields, api, models, _
|
||||
|
||||
|
||||
class StockPicking(models.Model):
|
||||
_inherit = "stock.picking"
|
||||
|
||||
demand_plan_line_ids = fields.Many2many(comodel_name="sf.production.demand.plan",
|
||||
string="需求计划明细", compute='_compute_demand_plan_line_ids', store=True)
|
||||
|
||||
@api.depends('move_ids_without_package')
|
||||
def _compute_demand_plan_line_ids(self):
|
||||
for line in self:
|
||||
demand_plan_lines = self.env['sf.production.demand.plan']
|
||||
if line.move_ids_without_package and line.move_ids_without_package.demand_plan_line_ids:
|
||||
demand_plan_lines |= line.move_ids_without_package.demand_plan_line_ids
|
||||
line.demand_plan_line_ids = demand_plan_lines.ids
|
||||
Reference in New Issue
Block a user