3

I am making an android application on crm module of odoo 10 and I want to create quotation in odoo through my application and I am passing this various arguments to ORecordValues and after that I am calling the createRecord().So when I am clicking on save button I am calling python api and python api is giving me this error.

Database fetch misses ids (u'1') and has extra ids (1), may be caused by a type incoherence in a previous request

This is my code for inserting record in odoo.

 ORecordValues values = new ORecordValues();
  values.put("partner_id",resPartnerArrayList.get(idc).get_id());//parter id
  values.put("date_order", binding.qOrderDate.getText().toString());
  if(!expDate.isEmpty())
  {
       values.put("validity_date",
       binding.qExpirationDate.getText().toString());
  }
  if(!paymentTerms.isEmpty())
  {
     values.put("payment_term_id",paymentTermArrayList.get(idP).get_id());//payment term id
  } 
  if(!binding.qUntaxedAmount.getText().toString().isEmpty())
  {
    values.put("amount_untaxed",binding.qUntaxedAmount.getText().toString());
  }
  if(!binding.qTotal.getText().toString().isEmpty())
  {
      values.put("amount_total", binding.qTotal.getText().toString());
  }
  if(!binding.qTaxes.getText().toString().isEmpty())
  {
      values.put("amount_tax", binding.qTaxes.getText().toString());
  }

  return odoo.createRecord("sale.order", values);
Normal1One
  • 219
  • 3
  • 11

2 Answers2

6

I think you trying to pass unicode value to Many2one field. Perform a type conversion. I think in your case its payment_term_id.

Hope it will help you.

KbiR
  • 4,047
  • 6
  • 37
  • 103
4

I found the Solution that work for me. I got error because i was passing the String in partner_id which odoo is taking as unicode so i parse the type of it and changed it like this. it worked for me.

 values.put("partner_id",resPartnerArrayList.get(idc).get_id())

to

 values.put("partner_id", Integer.parseInt
                            (resPartnerArrayList.get(idc).get_id()));
Normal1One
  • 219
  • 3
  • 11
  • I had a similar situation where I have saved the ID of a model in the system parameter. When I recovered it and call `my_record = self.env['my.model'].browse(_id_from_param)` it returned the record; but, it was in an inconsistent state like this case. So, for me, worked just converting the id to int before invoke the `browse` method. – Wellington Souza Sep 11 '21 at 02:36