NormalOne
NormalOne

Reputation: 251

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

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);

Upvotes: 4

Views: 10621

Answers (2)

NormalOne
NormalOne

Reputation: 251

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()));

Upvotes: 5

KbiR
KbiR

Reputation: 4174

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.

Upvotes: 6

Related Questions