forked from OCA/hr-expense
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
99 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright (C) 2021 Open Source Integrators | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
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,19 @@ | ||
# Copyright (C) 2021 Open Source Integrators | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Select Expense Journal", | ||
"version": "14.0.1.0.0", | ||
"author": "Open Source Integrators, Odoo Community Association (OCA)", | ||
"summary": "Set the Journal for the payment type used to pay the expense", | ||
"website": "https://github.com/OCA/hr-expense", | ||
"license": "AGPL-3", | ||
"depends": ["hr_expense"], | ||
"category": "Human Resources/Expenses", | ||
"data": [ | ||
"views/hr_expense_views.xml", | ||
], | ||
"installable": True, | ||
"maintainers": ["dreispt"], | ||
"development_status": "Beta", | ||
} |
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,4 @@ | ||
# Copyright (C) 2021 Open Source Integrators | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import hr_expense |
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,16 @@ | ||
# Copyright (C) 2021 Open Source Integrators | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class HrExpense(models.Model): | ||
_inherit = "hr.expense" | ||
|
||
payment_type_id = fields.Many2one("account.journal", string="Payment Journal") | ||
|
||
def _create_sheet_from_expenses(self): | ||
res = super()._create_sheet_from_expenses() | ||
if self.payment_type_id: | ||
res.update({"bank_journal_id": self.payment_type_id.id}) | ||
return res |
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,4 @@ | ||
* `Open Source Integrators <https://www.opensourceintegrators.com>`_: | ||
|
||
* Daniel Reis <[email protected]> | ||
* Freni Patel <[email protected]> |
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,7 @@ | ||
Employees can pay for expenses using company Credit Cards. | ||
|
||
In this case, there is the need for the Expense to identify | ||
what Credit Card was used for that payment. | ||
|
||
This allows the Expense report to use the correct journal, | ||
and have the payment accounting enty to be posted in the correct place. |
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 @@ | ||
- Create an Expense and select "Paid By Company". | ||
- A "Payment Type" field will be available, to select the | ||
journal corresponding to teh credit card or payment method used. | ||
- When creating the Expense Report, the selected Payment Type | ||
is used to populate the "Bank Journal" field, in the "Other Setting" tab. |
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,33 @@ | ||
<odoo> | ||
<record id="hr_expense_form_view_inherit" model="ir.ui.view"> | ||
<field name="model">hr.expense</field> | ||
<field name="inherit_id" ref="hr_expense.hr_expense_view_form" /> | ||
<field name="arch" type="xml"> | ||
|
||
<xpath expr="//sheet/group/group[3]" position="inside"> | ||
<field | ||
name="payment_type_id" | ||
attrs="{'invisible': [('payment_mode', '!=', 'company_account')]}" | ||
domain="[('type', '=', 'bank')]" | ||
/> | ||
</xpath> | ||
|
||
</field> | ||
</record> | ||
<record id="hr_expense_sheet_view_inherit" model="ir.ui.view"> | ||
<field name="model">hr.expense.sheet</field> | ||
<field name="inherit_id" ref="hr_expense.view_hr_expense_sheet_form" /> | ||
<field name="arch" type="xml"> | ||
|
||
<field name="expense_line_ids" position="attributes"> | ||
<!-- Can add only Expenses matching the payment mode and payment journal --> | ||
<attribute name="domain"> | ||
[('state', '=', 'draft'), ('employee_id', '=', employee_id), ('company_id', '=', company_id), | ||
('payment_mode', '=', payment_mode), | ||
'|', ('payment_type_id', '=', bank_journal_id), ('payment_type_id', '=', False)] | ||
</attribute> | ||
</field> | ||
|
||
</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 @@ | ||
../../../../hr_expense_journal |
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 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |