[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:
Dave Lasley
2017-10-20 14:17:13 -07:00
committed by ntsirintanis
parent c6b750c5f7
commit f3e3a2d6fa
4 changed files with 39 additions and 6 deletions

View File

@@ -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