Skip to content

Commit

Permalink
Merge PR #22 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by andhit-r
  • Loading branch information
ssi-bot committed Sep 3, 2024
2 parents f618729 + faa98ca commit 86fa5d3
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 0 deletions.
47 changes: 47 additions & 0 deletions ssi_employee_bank_account_mixin/README.rst
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.
7 changes: 7 additions & 0 deletions ssi_employee_bank_account_mixin/__init__.py
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,
)
16 changes: 16 additions & 0 deletions ssi_employee_bank_account_mixin/__manifest__.py
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": [],
}
7 changes: 7 additions & 0 deletions ssi_employee_bank_account_mixin/models/__init__.py
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,
)
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.
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>

0 comments on commit 86fa5d3

Please sign in to comment.