This is my method that I'm creating a production from, but I'm getting "Record does not exist or have been deleted" when create method are called at the end.
@api.multi
def do_production(self, product, location_src_id, qty_value,
location_dest_id=None):
mrp_obj = self.env['mrp.production']
mrp_bom_obj = self.env['mrp.bom']
bom_obj = mrp_bom_obj.search([('product_tmpl_id', '=',
product.product_tmpl_id.id)])
if not bom_obj:
raise AccessError(_('Create bill of materials for ') +
product.name_template)
if not location_dest_id:
location_dest_id = self.location_id.id
vals = mrp_obj.default_get(mrp_obj._columns.keys())
vals.update({
"product_qty": qty_value,
"product_uom": product.uom_id.id,
"product_id": product.id,
"bom_id": bom_obj.id,
"block_peat_id": self.id,
"location_dest_id": location_dest_id,
"location_src_id": location_src_id,
})
production = mrp_obj.create(vals)and this is vals that i'm creating production with
{'user_id': 1, 'location_src_id': 20, 'product_uom': 20, 'date_planned': '2019-01-03 18:56:12', 'block_peat_id': False, 'completing': False, 'company_id': 1, 'priority': '1', 'state': 'draft', 'product_id': 25, 'location_dest_id': 34, 'product_qty': 0.375, 'bom_id': 17, 'name': u'MO00204'}
so i can't find where the problem is.