Hi all,
I need to show Forecasted quantity in Purchase Order view.
Tried like this:
get the onhand, qutgoing and incomin qty - create computational field named forecasted_qty and add logic to it, this is the code:
onhand_qty = fields.Float(related='product_id.qty_available', string="Available Stock")
outgoing_qty = fields.Float(related="product_id.outgoing_qty", string="Outgoing Qty")
incoming_qty = fields.Float(related="product_id.incoming_qty", string="Incoming Qty")
forecasted_qty = fields.Float(string="Forecasted", compute='_compute_forecasted_qty')
def _compute_forecasted_qty(self):
for rec in self:
self.forecasted_qty = self.onhand_qty - self.outgoing_qty + self.incoming_qty
rec.forecasted_qty = forecasted_qty
And this is the error:
ValueError: Expected singleton: purchase.order.line(5780, 5781, 5782, 5783)
Can anyone please help me to show forecasted field in Purchase order.