Initial commit: Cybrosys Odoo packages (10 packages)
60
README.md
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
# Cybrosys Odoo Packages
|
||||||
|
|
||||||
|
This repository contains **10** Odoo packages from Cybrosys vendor.
|
||||||
|
|
||||||
|
## About Cybrosys
|
||||||
|
|
||||||
|
Cybrosys is a recognized vendor in the Odoo ecosystem, providing specialized addons and customizations.
|
||||||
|
|
||||||
|
## Packages Included (10 packages)
|
||||||
|
|
||||||
|
- **odoo-bringout-cybrosys-hr_payroll_input_add** - Hr Payroll Input Add
|
||||||
|
- **odoo-bringout-cybrosys-ohrms_loan** - Ohrms Loan
|
||||||
|
- **odoo-bringout-cybrosys-order_line_sequences** - Order Line Sequences
|
||||||
|
- **odoo-bringout-cybrosys-product_brand_ecommerce** - Product Brand Ecommerce
|
||||||
|
- **odoo-bringout-cybrosys-product_brand_inventory** - Product Brand Inventory
|
||||||
|
- **odoo-bringout-cybrosys-product_brand_invoicing** - Product Brand Invoicing
|
||||||
|
- **odoo-bringout-cybrosys-product_brand_purchase** - Product Brand Purchase
|
||||||
|
- **odoo-bringout-cybrosys-product_brand_sale** - Product Brand Sale
|
||||||
|
- **odoo-bringout-cybrosys-stock_move_invoice** - Stock Move Invoice
|
||||||
|
- **odoo-bringout-cybrosys-warehouse_reports** - Warehouse Reports
|
||||||
|
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Install any package from this collection:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install from local directory
|
||||||
|
pip install packages/cybrosys/PACKAGE_NAME/
|
||||||
|
|
||||||
|
# Install in development mode
|
||||||
|
pip install -e packages/cybrosys/PACKAGE_NAME/
|
||||||
|
|
||||||
|
# Using uv (recommended for speed)
|
||||||
|
uv add packages/cybrosys/PACKAGE_NAME/
|
||||||
|
```
|
||||||
|
|
||||||
|
## Repository Structure
|
||||||
|
|
||||||
|
Each package in this repository follows the standard Odoo addon structure:
|
||||||
|
|
||||||
|
```
|
||||||
|
cybrosys/
|
||||||
|
├── odoo-bringout-cybrosys-ADDON/
|
||||||
|
│ ├── ADDON_NAME/ # Complete addon code
|
||||||
|
│ │ ├── __init__.py
|
||||||
|
│ │ ├── __manifest__.py
|
||||||
|
│ │ └── ... (models, views, etc.)
|
||||||
|
│ ├── pyproject.toml # Python package configuration
|
||||||
|
│ └── README.md # Package documentation
|
||||||
|
└── ...
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Each package maintains its original license as specified by Cybrosys.
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
For support with these packages, please refer to the original Cybrosys documentation or community resources.
|
||||||
50
odoo-bringout-cybrosys-hr_payroll_input_add/README.md
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
# Payroll input add STIMUL
|
||||||
|
|
||||||
|
|
||||||
|
Helps you to manage add salary requests.
|
||||||
|
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install odoo-bringout-cybrosys-hr_payroll_input_add
|
||||||
|
```
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
This addon depends on:
|
||||||
|
- base
|
||||||
|
- hr
|
||||||
|
- payroll
|
||||||
|
|
||||||
|
## Manifest Information
|
||||||
|
|
||||||
|
- **Name**: Payroll input add STIMUL
|
||||||
|
- **Version**: 16.0.1.0.0
|
||||||
|
- **Category**: Generic Modules/Human Resources
|
||||||
|
- **License**: AGPL-3
|
||||||
|
- **Installable**: True
|
||||||
|
|
||||||
|
## Source
|
||||||
|
|
||||||
|
Custom addon from bringout-cybrosys vendor, addon `hr_payroll_input_add`.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This package maintains the original AGPL-3 license from the addon.
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
- Overview: doc/OVERVIEW.md
|
||||||
|
- Architecture: doc/ARCHITECTURE.md
|
||||||
|
- Models: doc/MODELS.md
|
||||||
|
- Controllers: doc/CONTROLLERS.md
|
||||||
|
- Wizards: doc/WIZARDS.md
|
||||||
|
- Reports: doc/REPORTS.md
|
||||||
|
- Security: doc/SECURITY.md
|
||||||
|
- Install: doc/INSTALL.md
|
||||||
|
- Usage: doc/USAGE.md
|
||||||
|
- Configuration: doc/CONFIGURATION.md
|
||||||
|
- Dependencies: doc/DEPENDENCIES.md
|
||||||
|
- Troubleshooting: doc/TROUBLESHOOTING.md
|
||||||
|
- FAQ: doc/FAQ.md
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
# Architecture
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart TD
|
||||||
|
U[Users] -->|HTTP| V[Views and QWeb Templates]
|
||||||
|
V --> C[Controllers]
|
||||||
|
V --> W[Wizards – Transient Models]
|
||||||
|
C --> M[Models and ORM]
|
||||||
|
W --> M
|
||||||
|
M --> R[Reports]
|
||||||
|
DX[Data XML] --> M
|
||||||
|
S[Security – ACLs and Groups] -. enforces .-> M
|
||||||
|
|
||||||
|
subgraph Hr_payroll_input_add Module - hr_payroll_input_add
|
||||||
|
direction LR
|
||||||
|
M:::layer
|
||||||
|
W:::layer
|
||||||
|
C:::layer
|
||||||
|
V:::layer
|
||||||
|
R:::layer
|
||||||
|
S:::layer
|
||||||
|
DX:::layer
|
||||||
|
end
|
||||||
|
|
||||||
|
classDef layer fill:#eef8ff,stroke:#6ea8fe,stroke-width:1px
|
||||||
|
```
|
||||||
|
|
||||||
|
Notes
|
||||||
|
- Views include tree/form/kanban templates and report templates.
|
||||||
|
- Controllers provide website/portal routes when present.
|
||||||
|
- Wizards are UI flows implemented with `models.TransientModel`.
|
||||||
|
- Data XML loads data/demo records; Security defines groups and access.
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Configuration
|
||||||
|
|
||||||
|
Refer to Odoo settings for hr_payroll_input_add. Configure related models, access rights, and options as needed.
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Controllers
|
||||||
|
|
||||||
|
This module does not define custom HTTP controllers.
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Dependencies
|
||||||
|
|
||||||
|
This addon depends on:
|
||||||
|
|
||||||
|
- base
|
||||||
|
- [hr](../../odoo-bringout-oca-ocb-hr)
|
||||||
|
- [payroll](../../odoo-bringout-oca-payroll-payroll)
|
||||||
4
odoo-bringout-cybrosys-hr_payroll_input_add/doc/FAQ.md
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
# FAQ
|
||||||
|
|
||||||
|
- Q: Which Odoo version? A: 16.0 (OCA/OCB packaged).
|
||||||
|
- Q: How to enable? A: Start server with --addon hr_payroll_input_add or install in UI.
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Install
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install odoo-bringout-cybrosys-hr_payroll_input_add"
|
||||||
|
# or
|
||||||
|
uv pip install odoo-bringout-cybrosys-hr_payroll_input_add"
|
||||||
|
```
|
||||||
15
odoo-bringout-cybrosys-hr_payroll_input_add/doc/MODELS.md
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
# Models
|
||||||
|
|
||||||
|
Detected core models and extensions in hr_payroll_input_add.
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
classDiagram
|
||||||
|
class hr_payroll_input_add
|
||||||
|
class hr_employee
|
||||||
|
class hr_payslip
|
||||||
|
class hr_payslip_input
|
||||||
|
```
|
||||||
|
|
||||||
|
Notes
|
||||||
|
- Classes show model technical names; fields omitted for brevity.
|
||||||
|
- Items listed under _inherit are extensions of existing models.
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
# Overview
|
||||||
|
|
||||||
|
Packaged Odoo addon: hr_payroll_input_add. Provides features documented in upstream Odoo 16 under this addon.
|
||||||
|
|
||||||
|
- Source: OCA/OCB 16.0, addon hr_payroll_input_add
|
||||||
|
- License: LGPL-3
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Reports
|
||||||
|
|
||||||
|
This module does not define custom reports.
|
||||||
41
odoo-bringout-cybrosys-hr_payroll_input_add/doc/SECURITY.md
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
# Security
|
||||||
|
|
||||||
|
Access control and security definitions in hr_payroll_input_add.
|
||||||
|
|
||||||
|
## Access Control Lists (ACLs)
|
||||||
|
|
||||||
|
Model access permissions defined in:
|
||||||
|
- **[ir.model.access.csv](../hr_payroll_input_add/security/ir.model.access.csv)**
|
||||||
|
- 4 model access rules
|
||||||
|
|
||||||
|
## Record Rules
|
||||||
|
|
||||||
|
Row-level security rules defined in:
|
||||||
|
|
||||||
|
## Security Groups & Configuration
|
||||||
|
|
||||||
|
Security groups and permissions defined in:
|
||||||
|
- **[security.xml](../hr_payroll_input_add/security/security.xml)**
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
graph TB
|
||||||
|
subgraph "Security Layers"
|
||||||
|
A[Users] --> B[Groups]
|
||||||
|
B --> C[Access Control Lists]
|
||||||
|
C --> D[Models]
|
||||||
|
B --> E[Record Rules]
|
||||||
|
E --> F[Individual Records]
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
Security files overview:
|
||||||
|
- **[ir.model.access.csv](../hr_payroll_input_add/security/ir.model.access.csv)**
|
||||||
|
- Model access permissions (CRUD rights)
|
||||||
|
- **[security.xml](../hr_payroll_input_add/security/security.xml)**
|
||||||
|
- Security groups, categories, and XML-based rules
|
||||||
|
|
||||||
|
Notes
|
||||||
|
- Access Control Lists define which groups can access which models
|
||||||
|
- Record Rules provide row-level security (filter records by user/group)
|
||||||
|
- Security groups organize users and define permission sets
|
||||||
|
- All security is enforced at the ORM level by Odoo
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Troubleshooting
|
||||||
|
|
||||||
|
- Ensure Python and Odoo environment matches repo guidance.
|
||||||
|
- Check database connectivity and logs if startup fails.
|
||||||
|
- Validate that dependent addons listed in DEPENDENCIES.md are installed.
|
||||||
7
odoo-bringout-cybrosys-hr_payroll_input_add/doc/USAGE.md
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
Start Odoo including this addon (from repo root):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 scripts/nix_odoo_web_server.py --db-name mydb --addon hr_payroll_input_add
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Wizards
|
||||||
|
|
||||||
|
This module does not include UI wizards.
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
Payroll Input Add
|
||||||
|
================================
|
||||||
|
|
||||||
|
Addition to NETO salary (bosnian: STIMULACIJA)
|
||||||
|
|
||||||
|
|
||||||
|
Installation
|
||||||
|
============
|
||||||
|
-
|
||||||
|
|
||||||
|
License
|
||||||
|
=======
|
||||||
|
GNU AFFERO GENERAL PUBLIC LICENSE, Version 3 (AGPLv3)
|
||||||
|
(http://www.gnu.org/licenses/agpl.html)
|
||||||
|
|
||||||
|
Bug Tracker
|
||||||
|
===========
|
||||||
|
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported.
|
||||||
|
|
||||||
|
Credits
|
||||||
|
=======
|
||||||
|
|
||||||
|
|
||||||
|
based on odoo_OpenHRMS/ohrms_loan by
|
||||||
|
* Cybrosys Techno Solutions <https://www.cybrosys.com>
|
||||||
|
|
||||||
|
Author
|
||||||
|
------
|
||||||
|
|
||||||
|
hernad@bring.out.ba
|
||||||
|
|
||||||
|
based on odoo_OpenHRMS/ohrms_loan by
|
||||||
|
Developers: Anusha P P <anusha@cybrosys.in>
|
||||||
|
|
||||||
|
Maintainer
|
||||||
|
----------
|
||||||
|
|
||||||
|
This module is maintained by bring.out doo Sarajevo, Bosnia and Herzegovina
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from . import models
|
||||||
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
###################################################################################
|
||||||
|
# A part of OpenHRMS Project <https://www.openhrms.com>
|
||||||
|
#
|
||||||
|
# Cybrosys Technologies Pvt. Ltd.
|
||||||
|
# Copyright (C) 2022-TODAY Cybrosys Technologies (<https://www.cybrosys.com>).
|
||||||
|
#
|
||||||
|
# This program is free software: you can modify
|
||||||
|
# it under the terms of the GNU Affero General Public License (AGPL) as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
###################################################################################
|
||||||
|
{
|
||||||
|
'name': 'Payroll input add STIMUL',
|
||||||
|
'version': '16.0.1.0.0',
|
||||||
|
'summary': 'Manage Payroll ADD Requests',
|
||||||
|
'description': """
|
||||||
|
Helps you to manage add salary requests.
|
||||||
|
""",
|
||||||
|
'category': 'Generic Modules/Human Resources',
|
||||||
|
'author': "bring.out doo Sarajevo",
|
||||||
|
'company': 'bring.out doo Sarajevo',
|
||||||
|
'maintainer': 'bring.out doo Sarajevo',
|
||||||
|
'depends': [
|
||||||
|
'base', 'hr', 'payroll',
|
||||||
|
],
|
||||||
|
'data': [
|
||||||
|
'security/ir.model.access.csv',
|
||||||
|
'security/security.xml',
|
||||||
|
'views/hr_payroll_input_add_seq.xml',
|
||||||
|
'data/salary_rule_payroll_add.xml',
|
||||||
|
'views/hr_payroll_input_add.xml',
|
||||||
|
'views/hr_payroll.xml',
|
||||||
|
],
|
||||||
|
'images': ['static/description/banner.png'],
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'installable': True,
|
||||||
|
'auto_install': False,
|
||||||
|
'application': False,
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<!--Adding a salary rule for payroll input add-->
|
||||||
|
<!--
|
||||||
|
<data noupdate="0">
|
||||||
|
|
||||||
|
|
||||||
|
<record id="hr_rule_payroll_input_add" model="hr.salary.rule">
|
||||||
|
<field name="code">ADD</field>
|
||||||
|
<field name="name">Stimulacija</field>
|
||||||
|
<field name="category_id" ref="l10n_bs_hr_payroll_fuelboss.OBUST"/>
|
||||||
|
<field name="amount_select">code</field>
|
||||||
|
<field name="amount_python_compute">result = inputs.ADD and - (inputs.ADD.amount)</field>
|
||||||
|
<field name="appears_on_payslip" eval="True"/>
|
||||||
|
<field name="sequence" eval="60"/>
|
||||||
|
<field name="company_id" search="[('name','ilike','Fuelboss doo Zenica')]" model="res.company"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="hr_rule_input_payroll_input_add" model="hr.rule.input">
|
||||||
|
<field name="code">ADD</field>
|
||||||
|
<field name="name">Stimulacija</field>
|
||||||
|
<field name="input_id" ref="hr_rule_payroll_input_add"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
</data>
|
||||||
|
-->
|
||||||
|
</odoo>
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from . import hr_payroll_input_add
|
||||||
|
from . import hr_payroll
|
||||||
|
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import time
|
||||||
|
import babel
|
||||||
|
from odoo import models, fields, api, tools, _
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
|
class HrPayslipInput(models.Model):
|
||||||
|
_inherit = 'hr.payslip.input'
|
||||||
|
|
||||||
|
payroll_add_id = fields.Many2one('hr.payroll.input.add', string="Payroll add", help="Payroll add")
|
||||||
|
|
||||||
|
|
||||||
|
class HrPayslip(models.Model):
|
||||||
|
_inherit = 'hr.payslip'
|
||||||
|
|
||||||
|
#@api.onchange('employee_id', 'date_from', 'date_to')
|
||||||
|
#def onchange_employee(self):
|
||||||
|
# if (not self.employee_id) or (not self.date_from) or (not self.date_to):
|
||||||
|
# return
|
||||||
|
|
||||||
|
# employee = self.employee_id
|
||||||
|
# date_from = self.date_from
|
||||||
|
# date_to = self.date_to
|
||||||
|
# contract_ids = []
|
||||||
|
|
||||||
|
# ttyme = datetime.fromtimestamp(time.mktime(time.strptime(str(date_from), "%Y-%m-%d")))
|
||||||
|
# locale = self.env.context.get('lang') or 'en_US'
|
||||||
|
# self.name = _('Salary Slip of %s for %s') % (
|
||||||
|
# employee.name, tools.ustr(babel.dates.format_date(date=ttyme, format='MMMM-y', locale=locale)))
|
||||||
|
# self.company_id = employee.company_id
|
||||||
|
#
|
||||||
|
# if not self.env.context.get('contract') or not self.contract_id:
|
||||||
|
# contract_ids = self.get_contract(employee, date_from, date_to)
|
||||||
|
# if not contract_ids:
|
||||||
|
# return
|
||||||
|
# self.contract_id = self.env['hr.contract'].browse(contract_ids[0])
|
||||||
|
#
|
||||||
|
# if not self.contract_id.struct_id:
|
||||||
|
# return
|
||||||
|
# self.struct_id = self.contract_id.struct_id
|
||||||
|
#
|
||||||
|
# # computation of the salary input
|
||||||
|
# contracts = self.env['hr.contract'].browse(contract_ids)
|
||||||
|
# worked_days_line_ids = self.get_worked_day_lines(contracts, date_from, date_to)
|
||||||
|
# worked_days_lines = self.worked_days_line_ids.browse([])
|
||||||
|
# for r in worked_days_line_ids:
|
||||||
|
# worked_days_lines += worked_days_lines.new(r)
|
||||||
|
# self.worked_days_line_ids = worked_days_lines
|
||||||
|
# if contracts:
|
||||||
|
# input_line_ids = self.get_inputs(contracts, date_from, date_to)
|
||||||
|
# input_lines = self.input_line_ids.browse([])
|
||||||
|
# for r in input_line_ids:
|
||||||
|
# input_lines += input_lines.new(r)
|
||||||
|
# self.input_line_ids = input_lines
|
||||||
|
# return
|
||||||
|
|
||||||
|
def get_inputs(self, contract_ids, date_from, date_to):
|
||||||
|
"""This Compute the other inputs to employee payslip.
|
||||||
|
"""
|
||||||
|
res = super(HrPayslip, self).get_inputs(contract_ids, date_from, date_to)
|
||||||
|
contract_obj = self.env['hr.contract']
|
||||||
|
|
||||||
|
contract_for_add = None
|
||||||
|
for contract in contract_ids:
|
||||||
|
if not ('INO' in contract.struct_id.code):
|
||||||
|
contract_for_add = contract
|
||||||
|
break
|
||||||
|
|
||||||
|
if not contract_for_add:
|
||||||
|
return res
|
||||||
|
|
||||||
|
emp_id = contract_obj.browse(contract_for_add.id).employee_id
|
||||||
|
db_payroll_add = self.env['hr.payroll.input.add'].search([('employee_id', '=', emp_id.id), ('state', '=', 'approve')])
|
||||||
|
for payroll_add in db_payroll_add:
|
||||||
|
|
||||||
|
if date_from <= payroll_add.payment_date <= date_to:
|
||||||
|
for result in res:
|
||||||
|
if result.get('code') == 'ADD':
|
||||||
|
result['amount_qty'] = 1
|
||||||
|
result['amount'] = payroll_add.add_amount
|
||||||
|
result['payroll_add_id'] = payroll_add.id
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
def action_payslip_done(self):
|
||||||
|
# set input_line payslip_id for payroll add
|
||||||
|
for line in self.input_line_ids:
|
||||||
|
if line.payroll_add_id:
|
||||||
|
line.payroll_add_id.payslip_id = self.id
|
||||||
|
return super(HrPayslip, self).action_payslip_done()
|
||||||
|
|
@ -0,0 +1,115 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from odoo import models, fields, api, _
|
||||||
|
from datetime import datetime
|
||||||
|
from dateutil.relativedelta import relativedelta
|
||||||
|
from odoo.exceptions import ValidationError, UserError
|
||||||
|
|
||||||
|
|
||||||
|
class HrPayrollInputAdd(models.Model):
|
||||||
|
_name = 'hr.payroll.input.add'
|
||||||
|
_inherit = ['mail.thread', 'mail.activity.mixin']
|
||||||
|
_description = "Payroll Add Request"
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def default_get(self, field_list):
|
||||||
|
result = super(HrPayrollInputAdd, self).default_get(field_list)
|
||||||
|
if result.get('user_id'):
|
||||||
|
ts_user_id = result['user_id']
|
||||||
|
else:
|
||||||
|
ts_user_id = self.env.context.get('user_id', self.env.user.id)
|
||||||
|
result['employee_id'] = self.env['hr.employee'].search([('user_id', '=', ts_user_id)], limit=1).id
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
@api.onchange('employee_id')
|
||||||
|
def onchange_employee(self):
|
||||||
|
if not self.employee_id:
|
||||||
|
return
|
||||||
|
|
||||||
|
employee = self.employee_id
|
||||||
|
self.company_id = self.env['res.company'].search([('id', '=', employee.company_id.id)], limit=1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
name = fields.Char(string="Payroll Add Name", readonly=True, help="Name of the payroll add")
|
||||||
|
date = fields.Date(string="Date", default=fields.Date.today(), readonly=True, help="Date")
|
||||||
|
employee_id = fields.Many2one('hr.employee', string="Employee", required=True, help="Employee")
|
||||||
|
department_id = fields.Many2one('hr.department', related="employee_id.department_id", readonly=True,
|
||||||
|
string="Department", help="Employee")
|
||||||
|
payment_date = fields.Date(string="Payment Start Date", required=True, default=fields.Date.today(), help="Date of "
|
||||||
|
"the "
|
||||||
|
"paymemt")
|
||||||
|
company_id = fields.Many2one('res.company', 'Company', readonly=True, help="Company",
|
||||||
|
default=lambda self: self.env.user.company_id,
|
||||||
|
states={'draft': [('readonly', False)]})
|
||||||
|
currency_id = fields.Many2one('res.currency', string='Currency', required=True, help="Currency",
|
||||||
|
default=lambda self: self.env.user.company_id.currency_id)
|
||||||
|
job_position = fields.Many2one('hr.job', related="employee_id.job_id", readonly=True, string="Job Position",
|
||||||
|
help="Job position")
|
||||||
|
add_amount = fields.Float(string="Add amount", required=True, help="Payroll add amount")
|
||||||
|
|
||||||
|
state = fields.Selection([
|
||||||
|
('draft', 'Draft'),
|
||||||
|
('waiting_approval_1', 'Submitted'),
|
||||||
|
('approve', 'Approved'),
|
||||||
|
('refuse', 'Refused'),
|
||||||
|
('cancel', 'Canceled'),
|
||||||
|
], string="State", default='draft', track_visibility='onchange', copy=False, )
|
||||||
|
|
||||||
|
payslip_id = fields.Many2one('hr.payslip', string="Payslip Ref.", help="Payslip")
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def create(self, values):
|
||||||
|
#add_count = self.env['hr.payroll.input.add'].search_count(
|
||||||
|
# [('employee_id', '=', values['employee_id']), ('state', '=', 'approve')])
|
||||||
|
#if add_count:
|
||||||
|
# raise ValidationError(_("The employee has already a pending installment"))
|
||||||
|
#else:
|
||||||
|
values['name'] = self.env['ir.sequence'].get('hr.payroll.input.add.seq') or ' '
|
||||||
|
#number = payslip.number or self.env["ir.sequence"].next_by_code(
|
||||||
|
# "salary.slip"
|
||||||
|
#)
|
||||||
|
res = super(HrPayrollInputAdd, self).create(values)
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
def action_move_to_status_draft(self):
|
||||||
|
for input_add_id in self._context['active_ids']:
|
||||||
|
input_add = self.env['hr.payroll.input.add'].browse(input_add_id)
|
||||||
|
input_add.write({'state': 'draft'})
|
||||||
|
|
||||||
|
def action_refuse(self):
|
||||||
|
return self.write({'state': 'refuse'})
|
||||||
|
|
||||||
|
def action_submit(self):
|
||||||
|
self.write({'state': 'waiting_approval_1'})
|
||||||
|
|
||||||
|
def action_cancel(self):
|
||||||
|
self.write({'state': 'cancel'})
|
||||||
|
|
||||||
|
def action_approve(self):
|
||||||
|
for data in self:
|
||||||
|
#if not data.loan_lines:
|
||||||
|
# raise ValidationError(_("Please Compute installment"))
|
||||||
|
#else:
|
||||||
|
self.write({'state': 'approve'})
|
||||||
|
|
||||||
|
def unlink(self):
|
||||||
|
for add in self:
|
||||||
|
if add.state not in ('draft', 'cancel'):
|
||||||
|
raise UserError(
|
||||||
|
'You cannot delete a pyroll add which is not in draft or cancelled state')
|
||||||
|
return super(HrPayrollInputAdd, self).unlink()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class HrEmployee(models.Model):
|
||||||
|
_inherit = "hr.employee"
|
||||||
|
|
||||||
|
def _compute_employee_payroll_adds(self):
|
||||||
|
"""This compute total payroll adds count of an employee.
|
||||||
|
"""
|
||||||
|
self.payroll_add_count = self.env['hr.payroll.input.add'].search_count([('employee_id', '=', self.id)])
|
||||||
|
|
||||||
|
payroll_add_count = fields.Integer(string="Payroll adds", compute='_compute_employee_payroll_adds')
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||||
|
access_hr_payroll_input_add_user,hr.payroll.input.add.group_user,model_hr_payroll_input_add,base.group_user,1,1,1,0
|
||||||
|
access_hr_jobuser,hr.job.group_user,hr.model_hr_job,base.group_user,1,1,1,0
|
||||||
|
access_hr_payroll_input_add_officer,hr.payroll.input.add.group_hr_user,model_hr_payroll_input_add,hr.group_hr_user,1,1,1,1
|
||||||
|
access_hr_payroll_input_add_manager,hr.payroll.input.add,model_hr_payroll_input_add,hr.group_hr_manager,1,1,1,1
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data noupdate="1">
|
||||||
|
<record id="rule_hr_payroll_input_add" model="ir.rule">
|
||||||
|
<field name="name">Payroll input add Request Multi Company</field>
|
||||||
|
<field name="model_id" ref="model_hr_payroll_input_add"/>
|
||||||
|
<field eval="True" name="global"/>
|
||||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="hr_payroll_input_add_manager_rule" model="ir.rule">
|
||||||
|
<field name="name">Payroll input add Forms Modification Accounts and Hr</field>
|
||||||
|
<field name="model_id" ref="model_hr_payroll_input_add"/>
|
||||||
|
<field name="groups" eval="[(4, ref('hr.group_hr_user'))]"/>
|
||||||
|
<field name="perm_write" eval="1"/>
|
||||||
|
<field name="perm_read" eval="1"/>
|
||||||
|
<field name="perm_create" eval="1"/>
|
||||||
|
<field name="perm_unlink" eval="1"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<record id="hr_payroll_input_add_rule" model="ir.rule">
|
||||||
|
<field name="name">User: Modify own payroll input add only</field>
|
||||||
|
<field name="model_id" ref="model_hr_payroll_input_add"/>
|
||||||
|
<field name="domain_force">[('employee_id.user_id','=',user.id)]</field>
|
||||||
|
<field name="perm_read" eval="1"/>
|
||||||
|
<field name="perm_write" eval="1"/>
|
||||||
|
<field name="perm_create" eval="1"/>
|
||||||
|
<field name="perm_unlink" eval="1"/>
|
||||||
|
<field name="groups" eval="[(4,ref('base.group_user'))]"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<record id="hr_payslip_form_inherit_view" model="ir.ui.view">
|
||||||
|
<field name="name">hr.payslip.payroll.input.add.form</field>
|
||||||
|
<field name="model">hr.payslip</field>
|
||||||
|
<field name="inherit_id" ref="payroll.hr_payslip_view_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//field[@name='input_line_ids']//tree//field[@name='sequence']" position="after">
|
||||||
|
<field name="payroll_add_id" invisible="1"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
|
|
@ -0,0 +1,156 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<!--Payroll Input Add Tree view-->
|
||||||
|
<record id="hr_payroll_input_add_tree_view" model="ir.ui.view">
|
||||||
|
<field name="name">hr.payroll.input.add.tree</field>
|
||||||
|
<field name="model">hr.payroll.input.add</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree string="Payroll ADD Requests">
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="employee_id"/>
|
||||||
|
<field name="add_amount"/>
|
||||||
|
<field name="date"/>
|
||||||
|
<field name="state"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!--Payroll Input Add Form view-->
|
||||||
|
<record id="hr_payroll_input_add_form_view" model="ir.ui.view">
|
||||||
|
<field name="name">hr.payroll.input.add.form</field>
|
||||||
|
<field name="model">hr.payroll.input.add</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Payroll Add Request">
|
||||||
|
<header>
|
||||||
|
<button name="action_submit" type="object" string="Submit" states="draft" class="oe_highlight"/>
|
||||||
|
<button name="action_cancel" type="object" string="Cancel" states="draft" />
|
||||||
|
<button name="action_approve" type="object" string="Approve" states="waiting_approval_1" class="oe_highlight" groups="hr.group_hr_manager,hr.group_hr_user"/>
|
||||||
|
<button name="action_refuse" type="object" string="Refuse" states="draft,waiting_approval_1" class="oe_highlight" groups="hr.group_hr_manager,hr.group_hr_user"/>
|
||||||
|
<field name="state" widget="statusbar" statusbar_visible="draft,waiting_approval_1,approve" />
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<sheet>
|
||||||
|
<div class="oe_button_box" name="button_box">
|
||||||
|
</div>
|
||||||
|
<div class="oe_title">
|
||||||
|
<h1>
|
||||||
|
<field name="name" readonly="1"/>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
<group col="4">
|
||||||
|
<field name="employee_id" options="{'no_create': True}" attrs="{'readonly':[('state','=','approve')]}"/>
|
||||||
|
<field name="date"/>
|
||||||
|
<field name="department_id"/>
|
||||||
|
<field name="job_position"/>
|
||||||
|
<field name="add_amount" attrs="{'readonly':[('state','=','approve')]}"/>
|
||||||
|
<field name="payment_date" attrs="{'readonly':[('state','=','approve')]}"/>
|
||||||
|
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
|
||||||
|
<field name="currency_id" options="{'no_create': True}" />
|
||||||
|
</group>
|
||||||
|
</sheet>
|
||||||
|
<div class="oe_chatter">
|
||||||
|
<field name="message_follower_ids" widget="mail_followers"/>
|
||||||
|
<field name="message_ids" widget="mail_thread"/>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!--payroll add search view-->
|
||||||
|
<record id="view_payroll_add_request_search_form" model="ir.ui.view">
|
||||||
|
<field name="name">hr.payroll.input.add.search.form</field>
|
||||||
|
<field name="model">hr.payroll.input.add</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<search string="Payroll Add">
|
||||||
|
<filter string="My Requests" name="myrequest" domain="[('employee_id.user_id.id', '=', uid)]" />
|
||||||
|
<field name="employee_id" string="Employee"/>
|
||||||
|
<field name="department_id" string="Department"/>
|
||||||
|
<filter string="Employee" name="employee_id" context="{'group_by':'employee_id'}"/>
|
||||||
|
<filter string="Department" name="department_id" context="{'group_by':'department_id'}"/>
|
||||||
|
<filter string="Status" name="status" context="{'group_by':'state'}"/>
|
||||||
|
</search>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<!--loan
|
||||||
|
<menuitem name="Loans & Advances"
|
||||||
|
id="menu_hr_loans_and_advances" parent="hr.menu_hr_root"
|
||||||
|
sequence="20"/>
|
||||||
|
menu-->
|
||||||
|
<menuitem name="Payroll Adds"
|
||||||
|
id="menu_hr_payroll_adds" parent="hr.menu_hr_root"
|
||||||
|
sequence="30"/>
|
||||||
|
|
||||||
|
<record id="action_hr_payroll_add_request" model="ir.actions.act_window">
|
||||||
|
<field name="name">Request for Payroll Add</field>
|
||||||
|
<field name="res_model">hr.payroll.input.add</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
<!--
|
||||||
|
<field name="context">{'search_default_myrequest': 1}</field>
|
||||||
|
-->
|
||||||
|
<field name="search_view_id" ref="view_payroll_add_request_search_form"/>
|
||||||
|
<field name="help" type="html">
|
||||||
|
<p class="oe_view_nocontent_create">
|
||||||
|
Click to create a new Payroll add request.
|
||||||
|
</p><p>
|
||||||
|
Use this menu to create payroll add requests.
|
||||||
|
</p>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<menuitem name="Payroll add"
|
||||||
|
id="menu_base_hr_payroll_add_request"
|
||||||
|
parent = "menu_hr_payroll_adds"
|
||||||
|
sequence="1"/>
|
||||||
|
|
||||||
|
<menuitem name="Request for Payroll add"
|
||||||
|
parent="menu_base_hr_payroll_add_request"
|
||||||
|
id="menu_hr_payroll_add_request"
|
||||||
|
action="action_hr_payroll_add_request"/>
|
||||||
|
|
||||||
|
<!-- Shortcuts -->
|
||||||
|
<record id="act_hr_employee_payroll_add_request" model="ir.actions.act_window">
|
||||||
|
<field name="name">Payroll adds</field>
|
||||||
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
<field name="res_model">hr.payroll.input.add</field>
|
||||||
|
<field name="binding_model_id" ref="hr.model_hr_employee"/>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
<!--
|
||||||
|
<field name="context">{'search_default_myadd': 1}</field>
|
||||||
|
-->
|
||||||
|
<field name="view_id" eval="hr_payroll_input_add_tree_view"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- HR employee inherit Payroll Adds -->
|
||||||
|
<record id="view_employee_form_payroll_input_add_inherit" model="ir.ui.view">
|
||||||
|
<field name="name">hr.employee.payroll.input.add.form.inherit</field>
|
||||||
|
<field name="model">hr.employee</field>
|
||||||
|
<field name="inherit_id" ref="hr.view_employee_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//div[@name='button_box']" position="inside">
|
||||||
|
<button name="%(act_hr_employee_payroll_add_request)d"
|
||||||
|
type="action"
|
||||||
|
class="oe_stat_button"
|
||||||
|
icon="fa-calendar"
|
||||||
|
groups="hr.group_hr_manager,hr.group_hr_user">
|
||||||
|
<field name="payroll_add_count" widget="statinfo" string="Payroll Adds"/>
|
||||||
|
</button>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<record id="action_status_draft" model="ir.actions.server">
|
||||||
|
<field name="name">Prebaci u pripremu</field>
|
||||||
|
<field name="model_id" ref="hr_payroll_input_add.model_hr_payroll_input_add"/>
|
||||||
|
<field name="binding_model_id" ref="hr_payroll_input_add.model_hr_payroll_input_add"/>
|
||||||
|
<field name="binding_view_types">list,form</field>
|
||||||
|
<field name="state">code</field>
|
||||||
|
<field name="code">
|
||||||
|
action = model.action_move_to_status_draft()
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<odoo>
|
||||||
|
<record id="ir_seq_hr_payroll_input_add" model="ir.sequence">
|
||||||
|
<field name="name">Payroll add Request</field>
|
||||||
|
<field name="code">hr.payroll.input.add.seq</field>
|
||||||
|
<field name="prefix">ADD/</field>
|
||||||
|
<field name="padding">4</field>
|
||||||
|
<field name="number_increment">1</field>
|
||||||
|
<field name="number_next_actual">1</field>
|
||||||
|
<field name="implementation">standard</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
44
odoo-bringout-cybrosys-hr_payroll_input_add/pyproject.toml
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
[project]
|
||||||
|
name = "odoo-bringout-cybrosys-hr_payroll_input_add"
|
||||||
|
version = "16.0.0"
|
||||||
|
description = "Payroll input add STIMUL - Manage Payroll ADD Requests"
|
||||||
|
authors = [
|
||||||
|
{ name = "Ernad Husremovic", email = "hernad@bring.out.ba" }
|
||||||
|
]
|
||||||
|
dependencies = [
|
||||||
|
"odoo-bringout-oca-ocb-base>=16.0.0",
|
||||||
|
"odoo-bringout-oca-ocb-hr>=16.0.0",
|
||||||
|
"odoo-bringout-cybrosys-payroll>=16.0.0",
|
||||||
|
"requests>=2.25.1"
|
||||||
|
]
|
||||||
|
readme = "README.md"
|
||||||
|
requires-python = ">= 3.11"
|
||||||
|
classifiers = [
|
||||||
|
"Development Status :: 5 - Production/Stable",
|
||||||
|
"Intended Audience :: Developers",
|
||||||
|
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
|
||||||
|
"Programming Language :: Python :: 3",
|
||||||
|
"Programming Language :: Python :: 3.11",
|
||||||
|
"Programming Language :: Python :: 3.12",
|
||||||
|
"Topic :: Office/Business",
|
||||||
|
]
|
||||||
|
|
||||||
|
[project.urls]
|
||||||
|
homepage = "https://github.com/bringout/0"
|
||||||
|
repository = "https://github.com/bringout/0"
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["hatchling"]
|
||||||
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
|
[tool.hatch.metadata]
|
||||||
|
allow-direct-references = true
|
||||||
|
|
||||||
|
[tool.hatch.build.targets.wheel]
|
||||||
|
packages = ["hr_payroll_input_add"]
|
||||||
|
|
||||||
|
[tool.rye]
|
||||||
|
managed = true
|
||||||
|
dev-dependencies = [
|
||||||
|
"pytest>=8.4.1",
|
||||||
|
]
|
||||||
50
odoo-bringout-cybrosys-ohrms_loan/README.md
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
# Open HRMS Loan Management
|
||||||
|
|
||||||
|
|
||||||
|
Helps you to manage Loan Requests of your company's staff.
|
||||||
|
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install odoo-bringout-cybrosys-ohrms_loan
|
||||||
|
```
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
This addon depends on:
|
||||||
|
- base
|
||||||
|
- hr
|
||||||
|
- payroll
|
||||||
|
|
||||||
|
## Manifest Information
|
||||||
|
|
||||||
|
- **Name**: Open HRMS Loan Management
|
||||||
|
- **Version**: 16.0.1.0.0
|
||||||
|
- **Category**: Generic Modules/Human Resources
|
||||||
|
- **License**: AGPL-3
|
||||||
|
- **Installable**: True
|
||||||
|
|
||||||
|
## Source
|
||||||
|
|
||||||
|
Custom addon from bringout-cybrosys vendor, addon `ohrms_loan`.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This package maintains the original AGPL-3 license from the addon.
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
- Overview: doc/OVERVIEW.md
|
||||||
|
- Architecture: doc/ARCHITECTURE.md
|
||||||
|
- Models: doc/MODELS.md
|
||||||
|
- Controllers: doc/CONTROLLERS.md
|
||||||
|
- Wizards: doc/WIZARDS.md
|
||||||
|
- Reports: doc/REPORTS.md
|
||||||
|
- Security: doc/SECURITY.md
|
||||||
|
- Install: doc/INSTALL.md
|
||||||
|
- Usage: doc/USAGE.md
|
||||||
|
- Configuration: doc/CONFIGURATION.md
|
||||||
|
- Dependencies: doc/DEPENDENCIES.md
|
||||||
|
- Troubleshooting: doc/TROUBLESHOOTING.md
|
||||||
|
- FAQ: doc/FAQ.md
|
||||||
32
odoo-bringout-cybrosys-ohrms_loan/doc/ARCHITECTURE.md
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
# Architecture
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart TD
|
||||||
|
U[Users] -->|HTTP| V[Views and QWeb Templates]
|
||||||
|
V --> C[Controllers]
|
||||||
|
V --> W[Wizards – Transient Models]
|
||||||
|
C --> M[Models and ORM]
|
||||||
|
W --> M
|
||||||
|
M --> R[Reports]
|
||||||
|
DX[Data XML] --> M
|
||||||
|
S[Security – ACLs and Groups] -. enforces .-> M
|
||||||
|
|
||||||
|
subgraph Ohrms_loan Module - ohrms_loan
|
||||||
|
direction LR
|
||||||
|
M:::layer
|
||||||
|
W:::layer
|
||||||
|
C:::layer
|
||||||
|
V:::layer
|
||||||
|
R:::layer
|
||||||
|
S:::layer
|
||||||
|
DX:::layer
|
||||||
|
end
|
||||||
|
|
||||||
|
classDef layer fill:#eef8ff,stroke:#6ea8fe,stroke-width:1px
|
||||||
|
```
|
||||||
|
|
||||||
|
Notes
|
||||||
|
- Views include tree/form/kanban templates and report templates.
|
||||||
|
- Controllers provide website/portal routes when present.
|
||||||
|
- Wizards are UI flows implemented with `models.TransientModel`.
|
||||||
|
- Data XML loads data/demo records; Security defines groups and access.
|
||||||
3
odoo-bringout-cybrosys-ohrms_loan/doc/CONFIGURATION.md
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Configuration
|
||||||
|
|
||||||
|
Refer to Odoo settings for ohrms_loan. Configure related models, access rights, and options as needed.
|
||||||
3
odoo-bringout-cybrosys-ohrms_loan/doc/CONTROLLERS.md
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Controllers
|
||||||
|
|
||||||
|
This module does not define custom HTTP controllers.
|
||||||
7
odoo-bringout-cybrosys-ohrms_loan/doc/DEPENDENCIES.md
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Dependencies
|
||||||
|
|
||||||
|
This addon depends on:
|
||||||
|
|
||||||
|
- base
|
||||||
|
- [hr](../../odoo-bringout-oca-ocb-hr)
|
||||||
|
- [payroll](../../odoo-bringout-oca-payroll-payroll)
|
||||||
4
odoo-bringout-cybrosys-ohrms_loan/doc/FAQ.md
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
# FAQ
|
||||||
|
|
||||||
|
- Q: Which Odoo version? A: 16.0 (OCA/OCB packaged).
|
||||||
|
- Q: How to enable? A: Start server with --addon ohrms_loan or install in UI.
|
||||||
7
odoo-bringout-cybrosys-ohrms_loan/doc/INSTALL.md
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Install
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install odoo-bringout-cybrosys-ohrms_loan"
|
||||||
|
# or
|
||||||
|
uv pip install odoo-bringout-cybrosys-ohrms_loan"
|
||||||
|
```
|
||||||
16
odoo-bringout-cybrosys-ohrms_loan/doc/MODELS.md
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
# Models
|
||||||
|
|
||||||
|
Detected core models and extensions in ohrms_loan.
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
classDiagram
|
||||||
|
class hr_loan
|
||||||
|
class hr_loan_line
|
||||||
|
class hr_employee
|
||||||
|
class hr_payslip
|
||||||
|
class hr_payslip_input
|
||||||
|
```
|
||||||
|
|
||||||
|
Notes
|
||||||
|
- Classes show model technical names; fields omitted for brevity.
|
||||||
|
- Items listed under _inherit are extensions of existing models.
|
||||||
6
odoo-bringout-cybrosys-ohrms_loan/doc/OVERVIEW.md
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
# Overview
|
||||||
|
|
||||||
|
Packaged Odoo addon: ohrms_loan. Provides features documented in upstream Odoo 16 under this addon.
|
||||||
|
|
||||||
|
- Source: OCA/OCB 16.0, addon ohrms_loan
|
||||||
|
- License: LGPL-3
|
||||||
3
odoo-bringout-cybrosys-ohrms_loan/doc/REPORTS.md
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Reports
|
||||||
|
|
||||||
|
This module does not define custom reports.
|
||||||
41
odoo-bringout-cybrosys-ohrms_loan/doc/SECURITY.md
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
# Security
|
||||||
|
|
||||||
|
Access control and security definitions in ohrms_loan.
|
||||||
|
|
||||||
|
## Access Control Lists (ACLs)
|
||||||
|
|
||||||
|
Model access permissions defined in:
|
||||||
|
- **[ir.model.access.csv](../ohrms_loan/security/ir.model.access.csv)**
|
||||||
|
- 7 model access rules
|
||||||
|
|
||||||
|
## Record Rules
|
||||||
|
|
||||||
|
Row-level security rules defined in:
|
||||||
|
|
||||||
|
## Security Groups & Configuration
|
||||||
|
|
||||||
|
Security groups and permissions defined in:
|
||||||
|
- **[security.xml](../ohrms_loan/security/security.xml)**
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
graph TB
|
||||||
|
subgraph "Security Layers"
|
||||||
|
A[Users] --> B[Groups]
|
||||||
|
B --> C[Access Control Lists]
|
||||||
|
C --> D[Models]
|
||||||
|
B --> E[Record Rules]
|
||||||
|
E --> F[Individual Records]
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
Security files overview:
|
||||||
|
- **[ir.model.access.csv](../ohrms_loan/security/ir.model.access.csv)**
|
||||||
|
- Model access permissions (CRUD rights)
|
||||||
|
- **[security.xml](../ohrms_loan/security/security.xml)**
|
||||||
|
- Security groups, categories, and XML-based rules
|
||||||
|
|
||||||
|
Notes
|
||||||
|
- Access Control Lists define which groups can access which models
|
||||||
|
- Record Rules provide row-level security (filter records by user/group)
|
||||||
|
- Security groups organize users and define permission sets
|
||||||
|
- All security is enforced at the ORM level by Odoo
|
||||||
5
odoo-bringout-cybrosys-ohrms_loan/doc/TROUBLESHOOTING.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Troubleshooting
|
||||||
|
|
||||||
|
- Ensure Python and Odoo environment matches repo guidance.
|
||||||
|
- Check database connectivity and logs if startup fails.
|
||||||
|
- Validate that dependent addons listed in DEPENDENCIES.md are installed.
|
||||||
7
odoo-bringout-cybrosys-ohrms_loan/doc/USAGE.md
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
Start Odoo including this addon (from repo root):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 scripts/nix_odoo_web_server.py --db-name mydb --addon ohrms_loan
|
||||||
|
```
|
||||||
3
odoo-bringout-cybrosys-ohrms_loan/doc/WIZARDS.md
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Wizards
|
||||||
|
|
||||||
|
This module does not include UI wizards.
|
||||||
35
odoo-bringout-cybrosys-ohrms_loan/ohrms_loan/README.md
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
Open HRMS Loan Management
|
||||||
|
=========================
|
||||||
|
|
||||||
|
Manage Loan Requests.
|
||||||
|
|
||||||
|
|
||||||
|
Installation
|
||||||
|
============
|
||||||
|
- www.odoo.com/documentation/15.0/setup/install.html
|
||||||
|
- Install our custom addon
|
||||||
|
|
||||||
|
License
|
||||||
|
=======
|
||||||
|
GNU AFFERO GENERAL PUBLIC LICENSE, Version 3 (AGPLv3)
|
||||||
|
(http://www.gnu.org/licenses/agpl.html)
|
||||||
|
|
||||||
|
Bug Tracker
|
||||||
|
===========
|
||||||
|
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported.
|
||||||
|
|
||||||
|
Credits
|
||||||
|
=======
|
||||||
|
* Cybrosys Techno Solutions <https://www.cybrosys.com>
|
||||||
|
|
||||||
|
Author
|
||||||
|
------
|
||||||
|
|
||||||
|
Developers: Anusha P P <anusha@cybrosys.in>
|
||||||
|
|
||||||
|
Maintainer
|
||||||
|
----------
|
||||||
|
|
||||||
|
This module is maintained by Cybrosys Technologies.
|
||||||
|
|
||||||
|
For support and more information, please visit https://www.cybrosys.com.
|
||||||
3
odoo-bringout-cybrosys-ohrms_loan/ohrms_loan/__init__.py
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from . import models
|
||||||
|
|
||||||
51
odoo-bringout-cybrosys-ohrms_loan/ohrms_loan/__manifest__.py
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
###################################################################################
|
||||||
|
# A part of OpenHRMS Project <https://www.openhrms.com>
|
||||||
|
#
|
||||||
|
# Cybrosys Technologies Pvt. Ltd.
|
||||||
|
# Copyright (C) 2022-TODAY Cybrosys Technologies (<https://www.cybrosys.com>).
|
||||||
|
#
|
||||||
|
# This program is free software: you can modify
|
||||||
|
# it under the terms of the GNU Affero General Public License (AGPL) as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
###################################################################################
|
||||||
|
{
|
||||||
|
'name': 'Open HRMS Loan Management',
|
||||||
|
'version': '16.0.1.0.0',
|
||||||
|
'summary': 'Manage Loan Requests',
|
||||||
|
'description': """
|
||||||
|
Helps you to manage Loan Requests of your company's staff.
|
||||||
|
""",
|
||||||
|
'category': 'Generic Modules/Human Resources',
|
||||||
|
'author': "Cybrosys Techno Solutions,Open HRMS",
|
||||||
|
'company': 'Cybrosys Techno Solutions',
|
||||||
|
'maintainer': 'Cybrosys Techno Solutions',
|
||||||
|
'live_test_url': 'https://youtu.be/lAT5cqVZTZI',
|
||||||
|
'website': "https://www.openhrms.com",
|
||||||
|
'depends': [
|
||||||
|
'base', 'hr', 'payroll'
|
||||||
|
],
|
||||||
|
'data': [
|
||||||
|
'security/ir.model.access.csv',
|
||||||
|
'security/security.xml',
|
||||||
|
'views/hr_loan_seq.xml',
|
||||||
|
'data/salary_rule_loan.xml',
|
||||||
|
'views/hr_loan.xml',
|
||||||
|
'views/hr_payroll.xml',
|
||||||
|
],
|
||||||
|
'images': ['static/description/banner.png'],
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'installable': True,
|
||||||
|
'auto_install': False,
|
||||||
|
'application': False,
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<!--Adding a salary rule for loan-->
|
||||||
|
<!--
|
||||||
|
<data noupdate="0">
|
||||||
|
|
||||||
|
|
||||||
|
<record id="hr_rule_loan" model="hr.salary.rule">
|
||||||
|
<field name="code">LOAN</field>
|
||||||
|
<field name="name">Kredit</field>
|
||||||
|
<field name="category_id" ref="l10n_bs_hr_payroll_fuelboss.OBUST"/>
|
||||||
|
<field name="amount_select">code</field>
|
||||||
|
<field name="amount_python_compute">result = inputs.LOAN and - (inputs.LOAN.amount)</field>
|
||||||
|
<field name="appears_on_payslip" eval="True"/>
|
||||||
|
<field name="sequence" eval="60"/>
|
||||||
|
<field name="company_id" search="[('name','ilike','Fuelboss doo Zenica')]" model="res.company"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="hr_rule_input_loan" model="hr.rule.input">
|
||||||
|
<field name="code">LOAN</field>
|
||||||
|
<field name="name">Kredit</field>
|
||||||
|
<field name="input_id" ref="hr_rule_loan"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
</data>
|
||||||
|
-->
|
||||||
|
</odoo>
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
## Module <ohrms_loan>
|
||||||
|
|
||||||
|
#### 18.10.2021
|
||||||
|
#### Version 15.0.1.0.0
|
||||||
|
##### ADD
|
||||||
|
- Initial commit for Open HRMS Project
|
||||||
|
|
||||||
|
#### 26.07.2022
|
||||||
|
#### Version 15.0.1.1.0
|
||||||
|
##### UPDATE
|
||||||
|
- Change the PO file
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from . import hr_loan
|
||||||
|
from . import hr_payroll
|
||||||
|
|
||||||
156
odoo-bringout-cybrosys-ohrms_loan/ohrms_loan/models/hr_loan.py
Normal file
|
|
@ -0,0 +1,156 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from odoo import models, fields, api, _
|
||||||
|
from datetime import datetime
|
||||||
|
from dateutil.relativedelta import relativedelta
|
||||||
|
from odoo.exceptions import ValidationError, UserError
|
||||||
|
|
||||||
|
|
||||||
|
class HrLoan(models.Model):
|
||||||
|
_name = 'hr.loan'
|
||||||
|
_inherit = ['mail.thread', 'mail.activity.mixin']
|
||||||
|
_description = "Loan Request"
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def default_get(self, field_list):
|
||||||
|
result = super(HrLoan, self).default_get(field_list)
|
||||||
|
if result.get('user_id'):
|
||||||
|
ts_user_id = result['user_id']
|
||||||
|
else:
|
||||||
|
ts_user_id = self.env.context.get('user_id', self.env.user.id)
|
||||||
|
result['employee_id'] = self.env['hr.employee'].search([('user_id', '=', ts_user_id)], limit=1).id
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
@api.onchange('employee_id')
|
||||||
|
def onchange_employee(self):
|
||||||
|
if not self.employee_id:
|
||||||
|
return
|
||||||
|
|
||||||
|
employee = self.employee_id
|
||||||
|
self.company_id = self.env['res.company'].search([('id', '=', employee.company_id.id)], limit=1)
|
||||||
|
|
||||||
|
def _compute_loan_amount(self):
|
||||||
|
total_paid = 0.0
|
||||||
|
self.name = self.name or self.env['ir.sequence'].next_by_code('hr.loan.seq')
|
||||||
|
|
||||||
|
for loan in self:
|
||||||
|
for line in loan.loan_lines:
|
||||||
|
if line.paid:
|
||||||
|
total_paid += line.amount
|
||||||
|
balance_amount = loan.loan_amount - total_paid
|
||||||
|
loan.total_amount = loan.loan_amount
|
||||||
|
loan.balance_amount = balance_amount
|
||||||
|
loan.total_paid_amount = total_paid
|
||||||
|
|
||||||
|
name = fields.Char(string="Loan Name", readonly=True, help="Name of the loan")
|
||||||
|
date = fields.Date(string="Date", default=fields.Date.today(), readonly=True, help="Date")
|
||||||
|
employee_id = fields.Many2one('hr.employee', string="Employee", required=True, help="Employee")
|
||||||
|
department_id = fields.Many2one('hr.department', related="employee_id.department_id", readonly=True,
|
||||||
|
string="Department", help="Employee")
|
||||||
|
installment = fields.Integer(string="No Of Installments", default=1, help="Number of installments")
|
||||||
|
payment_date = fields.Date(string="Payment Start Date", required=True, default=fields.Date.today(), help="Date of "
|
||||||
|
"the "
|
||||||
|
"paymemt")
|
||||||
|
loan_lines = fields.One2many('hr.loan.line', 'loan_id', string="Loan Line", index=True)
|
||||||
|
company_id = fields.Many2one('res.company', 'Company', readonly=True, help="Company",
|
||||||
|
default=lambda self: self.env.user.company_id,
|
||||||
|
states={'draft': [('readonly', False)]})
|
||||||
|
currency_id = fields.Many2one('res.currency', string='Currency', required=True, help="Currency",
|
||||||
|
default=lambda self: self.env.user.company_id.currency_id)
|
||||||
|
job_position = fields.Many2one('hr.job', related="employee_id.job_id", readonly=True, string="Job Position",
|
||||||
|
help="Job position")
|
||||||
|
loan_amount = fields.Float(string="Loan Amount", required=True, help="Loan amount")
|
||||||
|
total_amount = fields.Float(string="Total Amount", store=True, readonly=True, compute='_compute_loan_amount',
|
||||||
|
help="Total loan amount")
|
||||||
|
balance_amount = fields.Float(string="Balance Amount", store=True, compute='_compute_loan_amount', help="Balance amount")
|
||||||
|
total_paid_amount = fields.Float(string="Total Paid Amount", store=True, compute='_compute_loan_amount',
|
||||||
|
help="Total paid amount")
|
||||||
|
|
||||||
|
state = fields.Selection([
|
||||||
|
('draft', 'Draft'),
|
||||||
|
('waiting_approval_1', 'Submitted'),
|
||||||
|
('approve', 'Approved'),
|
||||||
|
('refuse', 'Refused'),
|
||||||
|
('cancel', 'Canceled'),
|
||||||
|
], string="State", default='draft', track_visibility='onchange', copy=False, )
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def create(self, values):
|
||||||
|
loan_count = self.env['hr.loan'].search_count(
|
||||||
|
[('employee_id', '=', values['employee_id']), ('state', '=', 'approve'),
|
||||||
|
('balance_amount', '!=', 0)])
|
||||||
|
if loan_count:
|
||||||
|
raise ValidationError(_("The employee has already a pending installment"))
|
||||||
|
else:
|
||||||
|
#values['name'] = self.env['ir.sequence'].get('hr.loan.seq') or ' '
|
||||||
|
#number = payslip.number or self.env["ir.sequence"].next_by_code(
|
||||||
|
# "salary.slip"
|
||||||
|
#)
|
||||||
|
values['name'] = False
|
||||||
|
res = super(HrLoan, self).create(values)
|
||||||
|
return res
|
||||||
|
|
||||||
|
def compute_installment(self):
|
||||||
|
"""This automatically create the installment the employee need to pay to
|
||||||
|
company based on payment start date and the no of installments.
|
||||||
|
"""
|
||||||
|
for loan in self:
|
||||||
|
loan.loan_lines.unlink()
|
||||||
|
date_start = datetime.strptime(str(loan.payment_date), '%Y-%m-%d')
|
||||||
|
amount = loan.loan_amount / loan.installment
|
||||||
|
for i in range(1, loan.installment + 1):
|
||||||
|
self.env['hr.loan.line'].create({
|
||||||
|
'date': date_start,
|
||||||
|
'amount': amount,
|
||||||
|
'employee_id': loan.employee_id.id,
|
||||||
|
'loan_id': loan.id})
|
||||||
|
date_start = date_start + relativedelta(months=1)
|
||||||
|
loan._compute_loan_amount()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def action_refuse(self):
|
||||||
|
return self.write({'state': 'refuse'})
|
||||||
|
|
||||||
|
def action_submit(self):
|
||||||
|
self.write({'state': 'waiting_approval_1'})
|
||||||
|
|
||||||
|
def action_cancel(self):
|
||||||
|
self.write({'state': 'cancel'})
|
||||||
|
|
||||||
|
def action_approve(self):
|
||||||
|
for data in self:
|
||||||
|
if not data.loan_lines:
|
||||||
|
raise ValidationError(_("Please Compute installment"))
|
||||||
|
else:
|
||||||
|
self.write({'state': 'approve'})
|
||||||
|
|
||||||
|
def unlink(self):
|
||||||
|
for loan in self:
|
||||||
|
if loan.state not in ('draft', 'cancel'):
|
||||||
|
raise UserError(
|
||||||
|
'You cannot delete a loan which is not in draft or cancelled state')
|
||||||
|
return super(HrLoan, self).unlink()
|
||||||
|
|
||||||
|
|
||||||
|
class InstallmentLine(models.Model):
|
||||||
|
_name = "hr.loan.line"
|
||||||
|
_description = "Installment Line"
|
||||||
|
|
||||||
|
date = fields.Date(string="Payment Date", required=True, help="Date of the payment")
|
||||||
|
employee_id = fields.Many2one('hr.employee', string="Employee", help="Employee")
|
||||||
|
amount = fields.Float(string="Amount", required=True, help="Amount")
|
||||||
|
paid = fields.Boolean(string="Paid", help="Paid")
|
||||||
|
loan_id = fields.Many2one('hr.loan', string="Loan Ref.", help="Loan")
|
||||||
|
payslip_id = fields.Many2one('hr.payslip', string="Payslip Ref.", help="Payslip")
|
||||||
|
|
||||||
|
|
||||||
|
class HrEmployee(models.Model):
|
||||||
|
_inherit = "hr.employee"
|
||||||
|
|
||||||
|
def _compute_employee_loans(self):
|
||||||
|
"""This compute the loan amount and total loans count of an employee.
|
||||||
|
"""
|
||||||
|
self.loan_count = self.env['hr.loan'].search_count([('employee_id', '=', self.id)])
|
||||||
|
|
||||||
|
loan_count = fields.Integer(string="Loan Count", compute='_compute_employee_loans')
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import time
|
||||||
|
import babel
|
||||||
|
from odoo import models, fields, api, tools, _
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
|
class HrPayslipInput(models.Model):
|
||||||
|
_inherit = 'hr.payslip.input'
|
||||||
|
|
||||||
|
loan_line_id = fields.Many2one('hr.loan.line', string="Loan Installment", help="Loan installment")
|
||||||
|
|
||||||
|
|
||||||
|
class HrPayslip(models.Model):
|
||||||
|
_inherit = 'hr.payslip'
|
||||||
|
|
||||||
|
#@api.onchange('employee_id', 'date_from', 'date_to')
|
||||||
|
#def onchange_employee(self):
|
||||||
|
# if (not self.employee_id) or (not self.date_from) or (not self.date_to):
|
||||||
|
# return
|
||||||
|
|
||||||
|
# employee = self.employee_id
|
||||||
|
# date_from = self.date_from
|
||||||
|
# date_to = self.date_to
|
||||||
|
# contract_ids = []
|
||||||
|
|
||||||
|
# ttyme = datetime.fromtimestamp(time.mktime(time.strptime(str(date_from), "%Y-%m-%d")))
|
||||||
|
# locale = self.env.context.get('lang') or 'en_US'
|
||||||
|
# self.name = _('Salary Slip of %s for %s') % (
|
||||||
|
# employee.name, tools.ustr(babel.dates.format_date(date=ttyme, format='MMMM-y', locale=locale)))
|
||||||
|
# self.company_id = employee.company_id
|
||||||
|
#
|
||||||
|
# if not self.env.context.get('contract') or not self.contract_id:
|
||||||
|
# contract_ids = self.get_contract(employee, date_from, date_to)
|
||||||
|
# if not contract_ids:
|
||||||
|
# return
|
||||||
|
# self.contract_id = self.env['hr.contract'].browse(contract_ids[0])
|
||||||
|
#
|
||||||
|
# if not self.contract_id.struct_id:
|
||||||
|
# return
|
||||||
|
# self.struct_id = self.contract_id.struct_id
|
||||||
|
#
|
||||||
|
# # computation of the salary input
|
||||||
|
# contracts = self.env['hr.contract'].browse(contract_ids)
|
||||||
|
# worked_days_line_ids = self.get_worked_day_lines(contracts, date_from, date_to)
|
||||||
|
# worked_days_lines = self.worked_days_line_ids.browse([])
|
||||||
|
# for r in worked_days_line_ids:
|
||||||
|
# worked_days_lines += worked_days_lines.new(r)
|
||||||
|
# self.worked_days_line_ids = worked_days_lines
|
||||||
|
# if contracts:
|
||||||
|
# input_line_ids = self.get_inputs(contracts, date_from, date_to)
|
||||||
|
# input_lines = self.input_line_ids.browse([])
|
||||||
|
# for r in input_line_ids:
|
||||||
|
# input_lines += input_lines.new(r)
|
||||||
|
# self.input_line_ids = input_lines
|
||||||
|
# return
|
||||||
|
|
||||||
|
def get_inputs(self, contract_ids, date_from, date_to):
|
||||||
|
"""This Compute the other inputs to employee payslip.
|
||||||
|
"""
|
||||||
|
res = super(HrPayslip, self).get_inputs(contract_ids, date_from, date_to)
|
||||||
|
contract_obj = self.env['hr.contract']
|
||||||
|
|
||||||
|
contract_for_loan = None
|
||||||
|
for contract in contract_ids:
|
||||||
|
if not ('INO' in contract.struct_id.code):
|
||||||
|
contract_for_loan = contract
|
||||||
|
break
|
||||||
|
|
||||||
|
if not contract_for_loan:
|
||||||
|
return res
|
||||||
|
|
||||||
|
emp_id = contract_obj.browse(contract_for_loan.id).employee_id
|
||||||
|
lon_obj = self.env['hr.loan'].search([('employee_id', '=', emp_id.id), ('state', '=', 'approve')])
|
||||||
|
for loan in lon_obj:
|
||||||
|
for loan_line in loan.loan_lines:
|
||||||
|
# pick unpaid lines
|
||||||
|
if date_from <= loan_line.date <= date_to and not loan_line.paid:
|
||||||
|
for result in res:
|
||||||
|
if result.get('code') == 'LOAN':
|
||||||
|
result['amount_qty'] = 1
|
||||||
|
result['amount'] = loan_line.amount
|
||||||
|
result['loan_line_id'] = loan_line.id
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
def action_payslip_done(self):
|
||||||
|
# + calculate loan amount
|
||||||
|
for line in self.input_line_ids:
|
||||||
|
if line.loan_line_id:
|
||||||
|
line.loan_line_id.paid = True
|
||||||
|
line.loan_line_id.payslip_id = self.id
|
||||||
|
line.loan_line_id.loan_id._compute_loan_amount()
|
||||||
|
return super(HrPayslip, self).action_payslip_done()
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||||
|
access_hr_loan_user,hr.loan.group_user,model_hr_loan,base.group_user,1,1,1,0
|
||||||
|
access_hr_jobuser,hr.job.group_user,hr.model_hr_job,base.group_user,1,1,1,0
|
||||||
|
access_hr_loan_line_user,hr.loan.line.group_user,model_hr_loan_line,base.group_user,1,1,0,0
|
||||||
|
access_hr_loan_officer,hr.loan.group_hr_user,model_hr_loan,hr.group_hr_user,1,1,1,1
|
||||||
|
access_hr_loan_line_officer,hr.loan.line.group_hr_user,model_hr_loan_line,hr.group_hr_user,1,1,1,1
|
||||||
|
access_hr_loan_manager,hr.loan,model_hr_loan,hr.group_hr_manager,1,1,1,1
|
||||||
|
access_hr_loan_line_manager,hr.loan.line,model_hr_loan_line,hr.group_hr_manager,1,1,1,1
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data noupdate="1">
|
||||||
|
<record id="rule_hr_loan" model="ir.rule">
|
||||||
|
<field name="name">Loan Request Multi Company</field>
|
||||||
|
<field name="model_id" ref="model_hr_loan"/>
|
||||||
|
<field eval="True" name="global"/>
|
||||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="hr_loan_manager_rule" model="ir.rule">
|
||||||
|
<field name="name">Loan Forms Modification Accounts and Hr</field>
|
||||||
|
<field name="model_id" ref="model_hr_loan"/>
|
||||||
|
<field name="groups" eval="[(4, ref('hr.group_hr_user'))]"/>
|
||||||
|
<field name="perm_write" eval="1"/>
|
||||||
|
<field name="perm_read" eval="1"/>
|
||||||
|
<field name="perm_create" eval="1"/>
|
||||||
|
<field name="perm_unlink" eval="1"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<record id="hr_loan_rule" model="ir.rule">
|
||||||
|
<field name="name">User: Modify own loan only</field>
|
||||||
|
<field name="model_id" ref="model_hr_loan"/>
|
||||||
|
<field name="domain_force">[('employee_id.user_id','=',user.id)]</field>
|
||||||
|
<field name="perm_read" eval="1"/>
|
||||||
|
<field name="perm_write" eval="1"/>
|
||||||
|
<field name="perm_create" eval="1"/>
|
||||||
|
<field name="perm_unlink" eval="1"/>
|
||||||
|
<field name="groups" eval="[(4,ref('base.group_user'))]"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 310 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 576 B |
|
After Width: | Height: | Size: 733 B |
|
After Width: | Height: | Size: 911 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 673 B |
|
After Width: | Height: | Size: 878 B |
|
After Width: | Height: | Size: 653 B |
|
After Width: | Height: | Size: 905 B |
|
After Width: | Height: | Size: 839 B |
|
After Width: | Height: | Size: 427 B |
|
After Width: | Height: | Size: 627 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 988 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 2 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 5 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 656 KiB |
|
After Width: | Height: | Size: 58 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 235 KiB |
|
After Width: | Height: | Size: 106 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 87 KiB |
|
After Width: | Height: | Size: 138 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 123 KiB |
|
After Width: | Height: | Size: 95 KiB |