Hello,
For information, i'm on a 14day trial database on Odoo Cloud, lastest version
I create invoices via Requests with an Odoo Client in a Symfony, 2 months ago I had no problem, but now I have an error and I have been pulling my hair out for 2 days without understanding why, someone anyone know why?
$data = ["invoice_date" => $invoiceDate->format("Y-m-d"),"invoice_date_due" => $invoiceDateDue->modify('+30days')->format("Y-m-d"),"payment_reference" => $json["invoiceData"]["invoiceType"]["type"],"move_type" => "out_invoice","type_name" => "Invoice","partner_id" => $invoiceClientOdooId,"invoice_partner_display_name" => $invoiceClient->getNomSociete(),"currency_id" => $currencyId[0],"ref" => $ref, ];
$client->create('account.move.line', $data, $context);$invoiceAccounting = $client->read('account.move', [$invoiceId]);
Error send by odoo :
[ResponseFault] Fault(1) 'Traceback (most recent call last):
File "/home/odoo/src/odoo/16.0/odoo/api.py", line 983, in get
cache_value = field_cache[record._ids[0]]
KeyError: 19
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/odoo/src/odoo/16.0/odoo/fields.py", line 1138, in __get__
value = env.cache.get(record, self)
File "/home/odoo/src/odoo/16.0/odoo/api.py", line 990, in get
raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: 'account.move(19,).payment_term_details'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/odoo/src/odoo/16.0/odoo/addons/base/controllers/rpc.py", line 149, in xmlrpc_2
response = self._xmlrpc(service)
File "/home/odoo/src/custom/trial/saas_trial/controllers/main.py", line 270, in _xmlrpc
res = super(OdooRPC, self)._xmlrpc(service)
File "/home/odoo/src/odoo/16.0/odoo/addons/base/controllers/rpc.py", line 129, in _xmlrpc
result = dispatch_rpc(service, method, params)
File "/home/odoo/src/odoo/16.0/odoo/http.py", line 368, in dispatch_rpc
return dispatch(method, params)
File "/home/odoo/src/odoo/16.0/odoo/service/model.py", line 37, in dispatch
res = execute_kw(db, uid, *params[3:])
File "/home/odoo/src/odoo/16.0/odoo/service/model.py", line 59, in execute_kw
return execute(db, uid, obj, method, *args, **kw or {})
File "/home/odoo/src/odoo/16.0/odoo/service/model.py", line 65, in execute
res = execute_cr(cr, uid, obj, method, *args, **kw)
File "/home/odoo/src/odoo/16.0/odoo/service/model.py", line 50, in execute_cr
result = retrying(partial(odoo.api.call_kw, recs, method, args, kw), env)
File "/home/odoo/src/odoo/16.0/odoo/service/model.py", line 134, in retrying
result = func()
File "/home/odoo/src/odoo/16.0/odoo/api.py", line 461, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/home/odoo/src/odoo/16.0/odoo/api.py", line 448, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/home/odoo/src/odoo/16.0/odoo/models.py", line 2994, in read
return self._read_format(fnames=fields, load=load)
File "/home/odoo/src/odoo/16.0/odoo/models.py", line 3132, in _read_format
vals[name] = convert(record[name], record, use_name_get)
File "/home/odoo/src/odoo/16.0/odoo/models.py", line 5842, in __getitem__
return self._fields[key].__get__(self, type(self))
File "/home/odoo/src/odoo/16.0/odoo/fields.py", line 1187, in __get__
self.compute_value(recs)
File "/home/odoo/src/odoo/16.0/odoo/fields.py", line 2332, in compute_value
super().compute_value(records)
File "/home/odoo/src/odoo/16.0/odoo/fields.py", line 1346, in compute_value
records._compute_field_value(self)
File "/home/odoo/src/odoo/16.0/addons/mail/models/mail_thread.py", line 403, in _compute_field_value
return super()._compute_field_value(field)
File "/home/odoo/src/odoo/16.0/odoo/models.py", line 4187, in _compute_field_value
getattr(self, field.compute)()
File "/home/odoo/src/odoo/16.0/addons/account/models/account_move.py", line 1185, in _compute_payment_term_details
for line in invoice.line_ids.filtered(lambda l: l.display_type == 'payment_term').sorted('date_maturity'):
File "/home/odoo/src/odoo/16.0/odoo/models.py", line 5506, in sorted
return self.browse(item.id for item in sorted(self, key=key, reverse=reverse))
TypeError: ' < ' not supported between instances of 'bool' and 'datetime.date'
The error message tells you that the code has found a date value of "FALSE" (ie: there is no date value) and that's why the comparison fails. An unknown date can't be earlier or later than a known date.