From f386782de28f2b38d6dd1466986ba88ebb0b6575 Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Sun, 24 Jun 2018 20:46:11 +0200 Subject: [PATCH] [IMP] improve compatibility layer, use related field --- partner_firstname/models/partner.py | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/partner_firstname/models/partner.py b/partner_firstname/models/partner.py index d5498f3..de55830 100644 --- a/partner_firstname/models/partner.py +++ b/partner_firstname/models/partner.py @@ -32,22 +32,6 @@ class Partner(models.Model): if not rec.firstname: rec.lastname = rec.name - - def _compatibility_layer(self, vals): - if 'last_name' in vals: - if not 'lastname' in vals: - vals['lastname'] = vals['last_name'] - vals.pop('last_name') - if 'first_name' in vals: - if not 'firstname' in vals: - vals['firstname'] = vals['first_name'] - vals.pop('first_name') - return vals - - @api.multi - def write(self, vals): - return super(Partner, self).write(self._compatibility_layer(vals)) - - @api.model - def create(self, vals): - return super(Partner, self).create(self._compatibility_layer(vals)) + #Compatibility with old name use in beedoo + last_name = fields.char(related='lastname') + first_name = fields.char(related='firstname')