-
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.
Signed-off-by andhit-r
- Loading branch information
Showing
7 changed files
with
131 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,47 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
=========================== | ||
Employee Bank Account Mixin | ||
=========================== | ||
|
||
|
||
Installation | ||
============ | ||
|
||
To install this module, you need to: | ||
|
||
1. Clone the branch 14.0 of the repository https://github.com/open-synergy/opnsynid-hr-employee-directory | ||
2. Add the path to this repository in your configuration (addons-path) | ||
3. Update the module list | ||
4. Go to menu *Apps -> Apps -> Main Apps* | ||
5. Search For *Employee Bank Account Mixin* | ||
6. Install the module | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/open-synergy/opnsynid-hr-employee-directory/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us smashing it by providing a detailed | ||
and welcomed feedback. | ||
|
||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Andhitia Rama <[email protected]> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://simetri-sinergi.id/logo.png | ||
:alt: PT. Simetri Sinergi Indonesia | ||
:target: https://simetri-sinergi.id.com | ||
|
||
This module is maintained by the PT. Simetri Sinergi Indonesia. |
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 @@ | ||
# Copyright 2022 OpenSynergy Indonesia | ||
# Copyright 2022 PT. Simetri Sinergi Indonesia | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
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,16 @@ | ||
# Copyright 2022 OpenSynergy Indonesia | ||
# Copyright 2022 PT. Simetri Sinergi Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
# pylint: disable=locally-disabled, manifest-required-author | ||
{ | ||
"name": "Employee Bank Account Mixin", | ||
"version": "14.0.1.0.0", | ||
"website": "https://simetri-sinergi.id", | ||
"author": "PT. Simetri Sinergi Indonesia, OpenSynergy Indonesia", | ||
"license": "AGPL-3", | ||
"installable": True, | ||
"depends": [ | ||
"ssi_employee_document_mixin", | ||
], | ||
"data": [], | ||
} |
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 @@ | ||
# Copyright 2022 OpenSynergy Indonesia | ||
# Copyright 2022 PT. Simetri Sinergi Indonesia | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from . import ( | ||
mixin_employee_bank_account, | ||
) |
48 changes: 48 additions & 0 deletions
48
ssi_employee_bank_account_mixin/models/mixin_employee_bank_account.py
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,48 @@ | ||
# Copyright 2022 OpenSynergy Indonesia | ||
# Copyright 2022 PT. Simetri Sinergi Indonesia | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class MixinEmployeeBankAccount(models.AbstractModel): | ||
_name = "mixin.employee_bank_account" | ||
_inherit = [ | ||
"mixin.employee_document", | ||
] | ||
_description = "Mixin for Document With Employee Bank Account" | ||
|
||
allowed_bank_account_ids = fields.Many2many( | ||
string="Allowed Bank Accounts", | ||
comodel_name="res.partner.bank", | ||
compute="_compute_allowed_bank_account_ids", | ||
store=False, | ||
) | ||
employee_bank_account_id = fields.Many2one( | ||
string="Employee Bank Account", | ||
comodel_name="res.partner.bank", | ||
readonly=True, | ||
states={"draft": [("readonly", False)]}, | ||
compute_sudo=True, | ||
) | ||
|
||
@api.depends( | ||
"employee_id", | ||
) | ||
def _compute_allowed_bank_account_ids(self): | ||
for record in self: | ||
result = False | ||
|
||
if record.employee_id and record.employee_id.address_home_id: | ||
contact = record.employee_id.address_home_id | ||
criteria = [ | ||
("partner_id", "=", contact.id), | ||
] | ||
result = self.env["res.partner.bank"].search(criteria).ids | ||
record.allowed_bank_account_ids = result | ||
|
||
@api.onchange( | ||
"employee_id", | ||
) | ||
def onchange_employee_bank_account_id(self): | ||
self.employee_bank_account_id = False |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions
6
ssi_employee_bank_account_mixin/templates/employee_document_templates.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,6 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<odoo> | ||
<template id="employee_document_search"> | ||
<field name="employee_id" /> | ||
</template> | ||
</odoo> |