FIX company_code: records with company_id is False

This commit is contained in:
David Beal
2018-12-13 17:58:41 +01:00
parent 1607dd6597
commit c3919e438a
2 changed files with 6 additions and 3 deletions

View File

@@ -35,11 +35,13 @@ write this code in your custom code according your model
```python
class ResPartner(models.Model):
_inherit = 'res.partner'
def name_get(self):
return self.env['res.company']._add_company_code(super())
```
Bug Tracker

View File

@@ -24,9 +24,10 @@ class ResCompany(models.Model):
else:
codes = {x.id: x['company_id']['code'] for x in records
if getattr(x, 'company_id')}
res = [(elm[0], '%s (%s)' % (elm[1], codes[elm[0]] or ''))
if not codes:
return super_object.name_get()
return [(elm[0], '%s (%s)' % (elm[1], codes[elm[0]] or ''))
for elm in super_object.name_get()]
return res
def name_get(self):
return self.env['res.company']._add_company_code(super())