Hi Odooers,
I am trying to create a record in the stock.move from my custom model. I am using Odoo version 12.0.
This is my code, I call this function from a button. But it shows a user error like this.
"The requested operation cannot be processed because of a programming error setting the `product_qty` field instead of the `product_uom_qty`."
As the error says, I haven't set product_qty but added product_uom_qty in my dictionary. What would be the reason for this error.?
Thanks in advance
@api.multi
def action_reproduction(self):
active_id = self._context.get('active_id', False)
scrap_id = self.env['stock.scrap'].browse(active_id)
if scrap_id:
dest_location_id = self.env.ref('stock_reproduction.stock_location_reproduction')
move_id = self.env['stock.move'].create({
'name': 'Reproduction from scrap(%s)' % scrap_id.name,
'location_id': scrap_id.scrap_location_id.id,
'location_dest_id': dest_location_id.id,
'product_id': scrap_id.product_id.id,
'product_uom': scrap_id.product_uom_id.id,
'product_uom_qty': self.product_qty,
})
Click here to see the error message