Skip to content

Commit

Permalink
use vals.get in create employee
Browse files Browse the repository at this point in the history
  • Loading branch information
leemannd committed May 17, 2017
1 parent 8f088c3 commit 120afb6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand Down
8 changes: 4 additions & 4 deletions odoo/local-src/specific_expense/models/hr_employee.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions odoo/migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,4 @@ migration:
- sale_company_currency
- specific_crm
- specific_sale
- specific_expense

0 comments on commit 120afb6

Please sign in to comment.