forked from OCA/hr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge: expense accounting enhancement
BSRTL-205
- Loading branch information
Showing
9 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
============================ | ||
Specific Expense for Roctool | ||
============================ | ||
|
||
In odoo 10, the expense accounting uses the hr.employee address_home_id to find | ||
some information. We want to facilitate this for roctool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2017 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2017 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
{ | ||
"name": "RocTool specific expense", | ||
"version": "10.0.1.0.0", | ||
"depends": ['hr', | ||
], | ||
"author": "Camptocamp", | ||
"website": "http://www.camptocamp.com", | ||
"license": "AGPL-3", | ||
"category": "Expense", | ||
"data": ['data/res_partner_category.xml', | ||
'views/employee_views.xml', | ||
], | ||
'installable': True, | ||
} |
8 changes: 8 additions & 0 deletions
8
odoo/local-src/specific_expense/data/res_partner_category.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<odoo noupdate="1"> | ||
|
||
<record id="employee_home" model="res.partner.category"> | ||
<field name="name">employee home</field> | ||
</record> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2017 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import hr_employee |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2017 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import models, fields, api | ||
|
||
|
||
class Employee(models.Model): | ||
_inherit = 'hr.employee' | ||
|
||
expense_refund_account_id = fields.Many2one( | ||
'account.account', | ||
string='Expense Refund Account', | ||
related='address_home_id.property_account_payable_id', | ||
store=False, | ||
readonly=False, | ||
) | ||
|
||
@api.model | ||
def create(self, vals): | ||
if vals.get('address_home_id'): | ||
return super(Employee, self).create(vals) | ||
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'] | ||
category_id = self.env.ref('specific_expense.employee_home').id | ||
vals_address = { | ||
'name': vals.get('name'), | ||
'supplier': True, | ||
'customer': False, | ||
'country_id': country_id, | ||
'category_id': [(4, category_id)], | ||
} | ||
partner = Partner.create(vals_address) | ||
vals['address_home_id'] = partner.id | ||
return super(Employee, self).create(vals) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<odoo> | ||
|
||
<record id="view_employee_form_expense" model="ir.ui.view"> | ||
<field name="name">hr.employee.form.expense</field> | ||
<field name="model">hr.employee</field> | ||
<field name="inherit_id" ref="hr.view_employee_form"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//page[@name='hr_settings']" position="inside"> | ||
<group name="expenses" string="Expenses"> | ||
<field name='expense_refund_account_id'/> | ||
</group> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -184,3 +184,4 @@ migration: | |
- sale_company_currency | ||
- specific_crm | ||
- specific_sale | ||
- specific_expense |