From 120afb69f3610f04774368779f6aee2b3fbc0a5c Mon Sep 17 00:00:00 2001 From: Denis Leemann Date: Wed, 17 May 2017 09:59:57 +0200 Subject: [PATCH] use vals.get in create employee --- HISTORY.rst | 1 + odoo/local-src/specific_expense/models/hr_employee.py | 8 ++++---- odoo/migration.yml | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index d8743fe8b3b..ec402498d60 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -25,6 +25,7 @@ Latest (unreleased) * SO change validation button visibility/process given product_category * SO & crm.lead holding_amount_currency in tree view. Can be used as measure * Add module 'sale_company_currency' +* Add and install specific_expense **Bugfixes** diff --git a/odoo/local-src/specific_expense/models/hr_employee.py b/odoo/local-src/specific_expense/models/hr_employee.py index c2f56e0156b..442d00cae84 100644 --- a/odoo/local-src/specific_expense/models/hr_employee.py +++ b/odoo/local-src/specific_expense/models/hr_employee.py @@ -18,10 +18,10 @@ class Employee(models.Model): @api.model def create(self, vals): - if vals['address_home_id']: + if vals.get('address_home_id'): return super(Employee, self).create(vals) - country_id = None - if not vals['country_id']: + country_id = vals.get('country_id') + if not country_id: Company = self.env['res.company'] country_id = Company.browse(vals['company_id']).country_id.id Partner = self.env['res.partner'] @@ -30,7 +30,7 @@ def create(self, vals): 'name': vals.get('name'), 'supplier': True, 'customer': False, - 'country_id': country_id if country_id else vals.get('country_id'), + 'country_id': country_id, 'category_id': [(4, category_id)], } partner = Partner.create(vals_address) diff --git a/odoo/migration.yml b/odoo/migration.yml index 5ab3b2fb7c3..9fac34193da 100644 --- a/odoo/migration.yml +++ b/odoo/migration.yml @@ -184,3 +184,4 @@ migration: - sale_company_currency - specific_crm - specific_sale + - specific_expense