Hi,
I am facing issue while creating stock move lines in delivery order("initial Demand") for remained qty. here is my code: please help to identify the issue.. Thanks
if purchase_order_line:
remained_qty = 0
stock_move = self.env['stock.move']
vals = {}
for line in purchase_order_line:
for move_line in self.move_lines:
if line.product_id.id == move_line.product_id.id:
if line.qty_received - line.whint_invoiced < move_line.product_uom_qty:
remained_qty = move_line.product_uom_qty - (line.qty_received - line.whint_invoiced)
move_line.update({'product_uom_qty' : line.qty_received - line.whint_invoiced})
vals = {
'name': move_line.name,
'product_id': move_line.product_id,
'product_uom_qty': remained_qty,
'product_uom': move_line.product_id.uom_id.id,
'picking_id': move_line.picking_id.id,
'location_id': self.location_id,
'location_dest_id': self.location_dest_id}
stock_move.create(vals)
self.move_lines.create(stock_move)
self.mapped('move_lines').filtered(lambda move: move.state in ['confirmed', 'waiting']).force_assign()
return True
I am getting error as below:
File "/home/nalini/Desktop/odoo10/odoo/odoo-server/addons/stock/models/stock_move.py", line 258, in create
res = super(StockMove, self).create(vals)
File "/home/nalini/Desktop/odoo10/odoo/odoo-server/odoo/models.py", line 3851, in create
record = self.browse(self._create(old_vals))
File "/home/nalini/Desktop/odoo10/odoo/odoo-server/odoo/models.py", line 3946, in _create
cr.execute(query, tuple(u[2] for u in updates if len(u) > 2))
File "/home/nalini/Desktop/odoo10/odoo/odoo-server/odoo/sql_db.py", line 154, in wrapper
return f(self, *args, **kwargs)
File "/home/nalini/Desktop/odoo10/odoo/odoo-server/odoo/sql_db.py", line 231, in execute
res = self._obj.execute(query, params)
ProgrammingError: can't adapt type 'stock.location'
--Return--