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
ntsirintanis
parent
c6b750c5f7
commit
f3e3a2d6fa
@@ -112,10 +112,11 @@ class ExternalSystem(models.Model):
|
||||
def create(self, vals):
|
||||
"""Create the interface for the record and assign to ``interface``."""
|
||||
record = super(ExternalSystem, self).create(vals)
|
||||
interface = self.env[vals['system_type']].create({
|
||||
'system_id': record.id,
|
||||
})
|
||||
record.interface = interface
|
||||
if not self.env.context.get('no_create_interface'):
|
||||
interface = self.env[vals['system_type']].create({
|
||||
'system_id': record.id,
|
||||
})
|
||||
record.interface = interface
|
||||
return record
|
||||
|
||||
@api.multi
|
||||
|
||||
Reference in New Issue
Block a user