Hello,
I have been struggling the past couple of days with a method on an inherited model that tries to sync data with an external API. Everything seems ok to me, but self.write() doesn't sends the updated data to the database.
Can someone tell what am I doing wrong?
Here is a simplified version of my code:
class ResPartner(models.Model):
"""Customer"""
_inherit = "res.partner"
external_id = fields.Char()
def sync_with_external(self):
api_key = self.env["ir.config_parameter"].get_param("custom_account_invoicing.external_api_key")
data = {
"legal_name": self.name,
"tax_id": self.vat
}
api = ExternalApi(api_key)
res = api.customers.create(data)
self.write({"external_id": res["id"]})
Hello,
I think you need to change the field name.
Reason: Odoo already external id field in import and export data.
Thanks.
Already tried another field name, but same results