mirror of
https://github.com/OCA/server-backend.git
synced 2025-02-18 09:52:42 +02:00
[IMP] base_external_system: Add create bypass
* In cases of deep inheritance, it may be required to create an adapter directly. Add an override in the create via the env context to support this. * Add default system type if creating from an interface * Fix interface assignment during creation in adapter
This commit is contained in:
committed by
Alexandre Díaz
parent
50c6ee968a
commit
4a22c8764b
@@ -69,3 +69,13 @@ class ExternalSystemAdapter(models.AbstractModel):
|
||||
odoo.exceptions.UserError: In the event of a good connection.
|
||||
"""
|
||||
raise UserError(_('The connection was a success.'))
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
context_self = self.with_context(no_create_interface=True)
|
||||
vals.update({
|
||||
'system_type': self._name,
|
||||
})
|
||||
record = super(ExternalSystemAdapter, context_self).create(vals)
|
||||
record.system_id.interface = record
|
||||
return record
|
||||
|
||||
Reference in New Issue
Block a user