From 6d7a2216157a5c625f6a3e0cd414556d68151f8f Mon Sep 17 00:00:00 2001 From: Jared Kipe Date: Mon, 30 Apr 2018 08:15:31 -0700 Subject: [PATCH] Adding all from 11.0 https://github.com/hibou-io/odoo-hr-payroll hr_payroll_holidays hr_payroll_input_name_report hr_payroll_input_report hr_payroll_payment hr_payroll_timesheet hr_payslip_line_date l10n_us_fl_hr_payroll l10n_us_hr_payroll l10n_us_mo_hr_payroll l10n_us_oh_hr_payroll l10n_us_va_hr_payroll --- hr_payroll_holidays/__init__.py | 3 + hr_payroll_holidays/__manifest__.py | 17 + hr_payroll_holidays/hr_payslip.py | 53 ++ hr_payroll_input_name_report/__init__.py | 0 hr_payroll_input_name_report/__manifest__.py | 19 + .../hr_payroll_input_name_report.xml | 28 + hr_payroll_input_report/__init__.py | 0 hr_payroll_input_report/__manifest__.py | 18 + .../hr_payroll_input_report.xml | 96 +++ hr_payroll_payment/__init__.py | 3 + hr_payroll_payment/__manifest__.py | 20 + .../hr_payroll_register_payment.py | 124 ++++ .../hr_payroll_register_payment.xml | 82 +++ hr_payroll_timesheet/__init__.py | 3 + hr_payroll_timesheet/__manifest__.py | 18 + hr_payroll_timesheet/hr_contract.py | 8 + hr_payroll_timesheet/hr_contract_view.xml | 18 + hr_payroll_timesheet/hr_payslip.py | 50 ++ hr_payslip_line_date/__init__.py | 2 + hr_payslip_line_date/__manifest__.py | 24 + hr_payslip_line_date/payslip.py | 7 + hr_payslip_line_date/payslip_view.xml | 18 + .../__init__.py | 0 .../__manifest__.py | 19 + .../hr_payroll_input_name_report.xml | 16 + l10n_us_fl_hr_payroll/__init__.py | 3 + l10n_us_fl_hr_payroll/__manifest__.py | 29 + l10n_us_fl_hr_payroll/data/base.xml | 31 + l10n_us_fl_hr_payroll/data/final.xml | 24 + l10n_us_fl_hr_payroll/data/rules_2016.xml | 49 ++ l10n_us_fl_hr_payroll/data/rules_2017.xml | 49 ++ l10n_us_fl_hr_payroll/data/rules_2018.xml | 49 ++ l10n_us_fl_hr_payroll/tests/__init__.py | 5 + .../tests/test_us_fl_payslip_2016.py | 104 +++ .../tests/test_us_fl_payslip_2017.py | 97 +++ .../tests/test_us_fl_payslip_2018.py | 97 +++ l10n_us_fl_hr_payroll/us_fl_hr_payroll.py | 25 + .../us_fl_hr_payroll_view.xml | 20 + l10n_us_hr_payroll/__init__.py | 3 + l10n_us_hr_payroll/__manifest__.py | 32 + l10n_us_hr_payroll/data/base.xml | 136 ++++ l10n_us_hr_payroll/data/final.xml | 51 ++ l10n_us_hr_payroll/data/rules_2016.xml | 604 ++++++++++++++++++ l10n_us_hr_payroll/data/rules_2017.xml | 604 ++++++++++++++++++ l10n_us_hr_payroll/data/rules_2018.xml | 604 ++++++++++++++++++ l10n_us_hr_payroll/l10n_us_hr_payroll.py | 47 ++ .../l10n_us_hr_payroll_view.xml | 27 + l10n_us_hr_payroll/tests/__init__.py | 6 + l10n_us_hr_payroll/tests/test_us_payslip.py | 113 ++++ .../tests/test_us_payslip_2016.py | 377 +++++++++++ .../tests/test_us_payslip_2017.py | 344 ++++++++++ .../tests/test_us_payslip_2018.py | 344 ++++++++++ l10n_us_hr_payroll_account/__init__.py | 2 + l10n_us_hr_payroll_account/__manifest__.py | 22 + .../l10n_us_hr_payroll_account_data.xml | 87 +++ l10n_us_mo_hr_payroll/__init__.py | 3 + l10n_us_mo_hr_payroll/__manifest__.py | 28 + l10n_us_mo_hr_payroll/data/base.xml | 46 ++ l10n_us_mo_hr_payroll/data/final.xml | 19 + l10n_us_mo_hr_payroll/data/rules_2018.xml | 159 +++++ l10n_us_mo_hr_payroll/hr_payroll.py | 34 + l10n_us_mo_hr_payroll/hr_payroll_view.xml | 34 + l10n_us_mo_hr_payroll/tests/__init__.py | 3 + .../tests/test_us_mo_payslip_2018.py | 224 +++++++ l10n_us_oh_hr_payroll/__init__.py | 3 + l10n_us_oh_hr_payroll/__manifest__.py | 31 + l10n_us_oh_hr_payroll/data/base.xml | 46 ++ l10n_us_oh_hr_payroll/data/final.xml | 27 + l10n_us_oh_hr_payroll/data/rules_2016.xml | 104 +++ l10n_us_oh_hr_payroll/data/rules_2017.xml | 104 +++ l10n_us_oh_hr_payroll/data/rules_2018.xml | 104 +++ l10n_us_oh_hr_payroll/hr_payroll.py | 27 + l10n_us_oh_hr_payroll/hr_payroll_view.xml | 33 + l10n_us_oh_hr_payroll/tests/__init__.py | 5 + .../tests/test_us_oh_payslip_2016.py | 111 ++++ .../tests/test_us_oh_payslip_2017.py | 108 ++++ .../tests/test_us_oh_payslip_2018.py | 108 ++++ l10n_us_va_hr_payroll/__init__.py | 3 + l10n_us_va_hr_payroll/__manifest__.py | 28 + l10n_us_va_hr_payroll/data/base.xml | 46 ++ l10n_us_va_hr_payroll/data/final.xml | 19 + l10n_us_va_hr_payroll/data/rules_2018.xml | 99 +++ l10n_us_va_hr_payroll/hr_payroll.py | 26 + l10n_us_va_hr_payroll/hr_payroll_view.xml | 32 + l10n_us_va_hr_payroll/tests/__init__.py | 3 + .../tests/test_us_va_payslip_2018.py | 137 ++++ 86 files changed, 6385 insertions(+) create mode 100755 hr_payroll_holidays/__init__.py create mode 100755 hr_payroll_holidays/__manifest__.py create mode 100755 hr_payroll_holidays/hr_payslip.py create mode 100644 hr_payroll_input_name_report/__init__.py create mode 100644 hr_payroll_input_name_report/__manifest__.py create mode 100644 hr_payroll_input_name_report/hr_payroll_input_name_report.xml create mode 100644 hr_payroll_input_report/__init__.py create mode 100644 hr_payroll_input_report/__manifest__.py create mode 100644 hr_payroll_input_report/hr_payroll_input_report.xml create mode 100755 hr_payroll_payment/__init__.py create mode 100755 hr_payroll_payment/__manifest__.py create mode 100755 hr_payroll_payment/hr_payroll_register_payment.py create mode 100755 hr_payroll_payment/hr_payroll_register_payment.xml create mode 100755 hr_payroll_timesheet/__init__.py create mode 100755 hr_payroll_timesheet/__manifest__.py create mode 100755 hr_payroll_timesheet/hr_contract.py create mode 100755 hr_payroll_timesheet/hr_contract_view.xml create mode 100755 hr_payroll_timesheet/hr_payslip.py create mode 100755 hr_payslip_line_date/__init__.py create mode 100755 hr_payslip_line_date/__manifest__.py create mode 100755 hr_payslip_line_date/payslip.py create mode 100755 hr_payslip_line_date/payslip_view.xml create mode 100644 l10n_ch_hr_payroll_input_name_report/__init__.py create mode 100644 l10n_ch_hr_payroll_input_name_report/__manifest__.py create mode 100644 l10n_ch_hr_payroll_input_name_report/hr_payroll_input_name_report.xml create mode 100755 l10n_us_fl_hr_payroll/__init__.py create mode 100755 l10n_us_fl_hr_payroll/__manifest__.py create mode 100755 l10n_us_fl_hr_payroll/data/base.xml create mode 100755 l10n_us_fl_hr_payroll/data/final.xml create mode 100755 l10n_us_fl_hr_payroll/data/rules_2016.xml create mode 100755 l10n_us_fl_hr_payroll/data/rules_2017.xml create mode 100755 l10n_us_fl_hr_payroll/data/rules_2018.xml create mode 100755 l10n_us_fl_hr_payroll/tests/__init__.py create mode 100755 l10n_us_fl_hr_payroll/tests/test_us_fl_payslip_2016.py create mode 100755 l10n_us_fl_hr_payroll/tests/test_us_fl_payslip_2017.py create mode 100755 l10n_us_fl_hr_payroll/tests/test_us_fl_payslip_2018.py create mode 100755 l10n_us_fl_hr_payroll/us_fl_hr_payroll.py create mode 100755 l10n_us_fl_hr_payroll/us_fl_hr_payroll_view.xml create mode 100755 l10n_us_hr_payroll/__init__.py create mode 100755 l10n_us_hr_payroll/__manifest__.py create mode 100755 l10n_us_hr_payroll/data/base.xml create mode 100755 l10n_us_hr_payroll/data/final.xml create mode 100755 l10n_us_hr_payroll/data/rules_2016.xml create mode 100755 l10n_us_hr_payroll/data/rules_2017.xml create mode 100755 l10n_us_hr_payroll/data/rules_2018.xml create mode 100755 l10n_us_hr_payroll/l10n_us_hr_payroll.py create mode 100755 l10n_us_hr_payroll/l10n_us_hr_payroll_view.xml create mode 100755 l10n_us_hr_payroll/tests/__init__.py create mode 100755 l10n_us_hr_payroll/tests/test_us_payslip.py create mode 100755 l10n_us_hr_payroll/tests/test_us_payslip_2016.py create mode 100755 l10n_us_hr_payroll/tests/test_us_payslip_2017.py create mode 100755 l10n_us_hr_payroll/tests/test_us_payslip_2018.py create mode 100755 l10n_us_hr_payroll_account/__init__.py create mode 100755 l10n_us_hr_payroll_account/__manifest__.py create mode 100755 l10n_us_hr_payroll_account/l10n_us_hr_payroll_account_data.xml create mode 100755 l10n_us_mo_hr_payroll/__init__.py create mode 100755 l10n_us_mo_hr_payroll/__manifest__.py create mode 100755 l10n_us_mo_hr_payroll/data/base.xml create mode 100755 l10n_us_mo_hr_payroll/data/final.xml create mode 100755 l10n_us_mo_hr_payroll/data/rules_2018.xml create mode 100755 l10n_us_mo_hr_payroll/hr_payroll.py create mode 100755 l10n_us_mo_hr_payroll/hr_payroll_view.xml create mode 100755 l10n_us_mo_hr_payroll/tests/__init__.py create mode 100755 l10n_us_mo_hr_payroll/tests/test_us_mo_payslip_2018.py create mode 100755 l10n_us_oh_hr_payroll/__init__.py create mode 100755 l10n_us_oh_hr_payroll/__manifest__.py create mode 100755 l10n_us_oh_hr_payroll/data/base.xml create mode 100755 l10n_us_oh_hr_payroll/data/final.xml create mode 100755 l10n_us_oh_hr_payroll/data/rules_2016.xml create mode 100755 l10n_us_oh_hr_payroll/data/rules_2017.xml create mode 100755 l10n_us_oh_hr_payroll/data/rules_2018.xml create mode 100755 l10n_us_oh_hr_payroll/hr_payroll.py create mode 100755 l10n_us_oh_hr_payroll/hr_payroll_view.xml create mode 100755 l10n_us_oh_hr_payroll/tests/__init__.py create mode 100755 l10n_us_oh_hr_payroll/tests/test_us_oh_payslip_2016.py create mode 100755 l10n_us_oh_hr_payroll/tests/test_us_oh_payslip_2017.py create mode 100755 l10n_us_oh_hr_payroll/tests/test_us_oh_payslip_2018.py create mode 100755 l10n_us_va_hr_payroll/__init__.py create mode 100755 l10n_us_va_hr_payroll/__manifest__.py create mode 100755 l10n_us_va_hr_payroll/data/base.xml create mode 100755 l10n_us_va_hr_payroll/data/final.xml create mode 100755 l10n_us_va_hr_payroll/data/rules_2018.xml create mode 100755 l10n_us_va_hr_payroll/hr_payroll.py create mode 100755 l10n_us_va_hr_payroll/hr_payroll_view.xml create mode 100755 l10n_us_va_hr_payroll/tests/__init__.py create mode 100755 l10n_us_va_hr_payroll/tests/test_us_va_payslip_2018.py diff --git a/hr_payroll_holidays/__init__.py b/hr_payroll_holidays/__init__.py new file mode 100755 index 00000000..390ee764 --- /dev/null +++ b/hr_payroll_holidays/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import hr_payslip diff --git a/hr_payroll_holidays/__manifest__.py b/hr_payroll_holidays/__manifest__.py new file mode 100755 index 00000000..9a4cac2c --- /dev/null +++ b/hr_payroll_holidays/__manifest__.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +{ + 'name': 'Payroll Holidays', + 'author': 'Hibou Corp. ', + 'version': '11.0.0.0.0', + 'category': 'Human Resources', + 'sequence': 95, + 'summary': 'Register payments for Payroll Payslips', + 'description': """ +Simplifies getting approved Holiday Leaves onto an employee Payslip. + """, + 'website': 'https://hibou.io/', + 'depends': ['hr_payroll', 'hr_holidays'], + 'installable': True, + 'application': False, +} diff --git a/hr_payroll_holidays/hr_payslip.py b/hr_payroll_holidays/hr_payslip.py new file mode 100755 index 00000000..9f999266 --- /dev/null +++ b/hr_payroll_holidays/hr_payslip.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +from odoo import models, api +from odoo.addons.hr_holidays.models.hr_holidays import HOURS_PER_DAY + + +class HrPayslip(models.Model): + _inherit = 'hr.payslip' + + @api.model + def get_worked_day_lines(self, contracts, date_from, date_to): + leaves = {} + + for contract in contracts: + for leave in self._fetch_valid_leaves(contract.employee_id.id, date_from, date_to): + leave_code = self._create_leave_code(leave.holiday_status_id.name) + if leave_code in leaves: + leaves[leave_code]['number_of_days'] += leave.number_of_days_temp + leaves[leave_code]['number_of_hours'] += leave.number_of_days_temp * HOURS_PER_DAY + else: + leaves[leave_code] = { + 'name': leave.holiday_status_id.name, + 'sequence': 15, + 'code': leave_code, + 'number_of_days': leave.number_of_days_temp, + 'number_of_hours': leave.number_of_days_temp * HOURS_PER_DAY, + 'contract_id': contract.id, + } + + res = super(HrPayslip, self).get_worked_day_lines(contracts, date_from, date_to) + res.extend(leaves.values()) + return res + + @api.multi + def action_payslip_done(self): + for slip in self: + leaves = self._fetch_valid_leaves(slip.employee_id.id, slip.date_from, slip.date_to) + leaves.write({'payslip_status': True}) + return super(HrPayslip, self).action_payslip_done() + + def _fetch_valid_leaves(self, employee_id, date_from, date_to): + valid_leaves = [ + ('employee_id', '=', employee_id), + ('state', '=', 'validate'), + ('date_from', '>=', date_from), + ('date_to', '<=', date_to), + ('payslip_status', '=', False), + ('type', '=', 'remove'), + ] + + return self.env['hr.holidays'].search(valid_leaves) + + def _create_leave_code(self, name): + return 'L_' + name.replace(' ', '_') diff --git a/hr_payroll_input_name_report/__init__.py b/hr_payroll_input_name_report/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/hr_payroll_input_name_report/__manifest__.py b/hr_payroll_input_name_report/__manifest__.py new file mode 100644 index 00000000..a6aa35d3 --- /dev/null +++ b/hr_payroll_input_name_report/__manifest__.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +{ + 'name': 'Payroll Input Name Report', + 'author': 'Hibou Corp. ', + 'version': '11.0.0.0.0', + 'category': 'Human Resources', + 'sequence': 95, + 'summary': 'Improves slip reports by using your own Input\'s description', + 'description': """ +If a Salary Rule\'s Code is identical to an Input's Code, then the input's description +will appear on the payslip report where the rule is displayed. + """, + 'website': 'https://hibou.io/', + 'depends': ['hr_payroll'], + 'data': ['hr_payroll_input_name_report.xml'], + 'installable': True, + 'application': False, +} diff --git a/hr_payroll_input_name_report/hr_payroll_input_name_report.xml b/hr_payroll_input_name_report/hr_payroll_input_name_report.xml new file mode 100644 index 00000000..d725e392 --- /dev/null +++ b/hr_payroll_input_name_report/hr_payroll_input_name_report.xml @@ -0,0 +1,28 @@ + + + + + hr_payroll_input_name_report.report_payslip + + + + + + + + + + + + hr_payroll_input_name_report.report_payslipdetails + + + + + + + + + + + \ No newline at end of file diff --git a/hr_payroll_input_report/__init__.py b/hr_payroll_input_report/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/hr_payroll_input_report/__manifest__.py b/hr_payroll_input_report/__manifest__.py new file mode 100644 index 00000000..42e4fe45 --- /dev/null +++ b/hr_payroll_input_report/__manifest__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +{ + 'name': 'Payroll Input Report', + 'author': 'Hibou Corp. ', + 'version': '11.0.0.0.0', + 'category': 'Human Resources', + 'sequence': 95, + 'summary': 'Adds "Worked Days" and "Other Inputs" to the payslip reports.', + 'description': """ +Adds "Worked Days" and "Other Inputs" to the payslip reports. + """, + 'website': 'https://hibou.io/', + 'depends': ['hr_payroll'], + 'data': ['hr_payroll_input_report.xml'], + 'installable': True, + 'application': False, +} diff --git a/hr_payroll_input_report/hr_payroll_input_report.xml b/hr_payroll_input_report/hr_payroll_input_report.xml new file mode 100644 index 00000000..73ea1f3e --- /dev/null +++ b/hr_payroll_input_report/hr_payroll_input_report.xml @@ -0,0 +1,96 @@ + + + + + hr_payroll_input_report.report_payslip + + + +

Worked Days

+ + + + + + + + + + + + + + + + + +
NameCodeDaysHours
+ +

Other Inputs

+ + + + + + + + + + + + + + + +
NameCodeAmount
+
+
+
+ + + hr_payroll_input_report.report_payslipdetails + + + +

Worked Days

+ + + + + + + + + + + + + + + + + +
NameCodeDaysHours
+ +

Other Inputs

+ + + + + + + + + + + + + + + +
NameCodeAmount
+
+
+
+ +
\ No newline at end of file diff --git a/hr_payroll_payment/__init__.py b/hr_payroll_payment/__init__.py new file mode 100755 index 00000000..6c77970b --- /dev/null +++ b/hr_payroll_payment/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import hr_payroll_register_payment diff --git a/hr_payroll_payment/__manifest__.py b/hr_payroll_payment/__manifest__.py new file mode 100755 index 00000000..8d5dce77 --- /dev/null +++ b/hr_payroll_payment/__manifest__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- + +{ + 'name': 'Payroll Payments', + 'author': 'Hibou Corp. ', + 'version': '11.0.0.0.0', + 'category': 'Human Resources', + 'sequence': 95, + 'summary': 'Register payments for Payroll Payslips', + 'description': """ +Adds the ability to register a payment on a payslip. + """, + 'website': 'https://hibou.io/', + 'depends': ['hr_payroll_account'], + 'data': [ + 'hr_payroll_register_payment.xml', + ], + 'installable': True, + 'application': False, +} diff --git a/hr_payroll_payment/hr_payroll_register_payment.py b/hr_payroll_payment/hr_payroll_register_payment.py new file mode 100755 index 00000000..0c9f6cf9 --- /dev/null +++ b/hr_payroll_payment/hr_payroll_register_payment.py @@ -0,0 +1,124 @@ +# -*- coding: utf-8 -*- + +from odoo import api, fields, models, _ +from odoo.exceptions import ValidationError + + +class HrPayslip(models.Model): + _inherit = 'hr.payslip' + + @api.multi + @api.depends('move_id', 'move_id.line_ids.full_reconcile_id') + def _is_paid(self): + for payslip in self: + payslip.is_paid = ( + payslip.move_id and len(payslip.move_id.line_ids.filtered(lambda l: ( + l.partner_id.id == payslip.employee_id.address_home_id.id and + l.account_id.internal_type == 'payable' and + not l.reconciled + ))) == 0 + ) + + is_paid = fields.Boolean(string="Has been Paid", compute='_is_paid', store=True) + + +class HrPayrollRegisterPaymentWizard(models.TransientModel): + + _name = "hr.payroll.register.payment.wizard" + _description = "Hr Payroll Register Payment wizard" + + @api.model + def _default_partner_id(self): + context = dict(self._context or {}) + active_ids = context.get('active_ids', []) + payslip = self.env['hr.payslip'].browse(active_ids) + return payslip.employee_id.address_home_id.id + + @api.model + def _default_amount(self): + context = dict(self._context or {}) + active_ids = context.get('active_ids', []) + payslip = self.env['hr.payslip'].browse(active_ids) + amount = 0.0 + for line in payslip.move_id.line_ids: + if line.account_id.internal_type == 'payable' and line.partner_id.id == payslip.employee_id.address_home_id.id: + amount += abs(line.balance) + return amount + + @api.model + def _default_communication(self): + context = dict(self._context or {}) + active_ids = context.get('active_ids', []) + payslip = self.env['hr.payslip'].browse(active_ids) + return payslip.number + + partner_id = fields.Many2one('res.partner', string='Partner', required=True, default=_default_partner_id) + journal_id = fields.Many2one('account.journal', string='Payment Method', required=True, domain=[('type', 'in', ('bank', 'cash'))]) + company_id = fields.Many2one('res.company', related='journal_id.company_id', string='Company', readonly=True, required=True) + payment_method_id = fields.Many2one('account.payment.method', string='Payment Type', required=True) + amount = fields.Monetary(string='Payment Amount', required=True, default=_default_amount) + currency_id = fields.Many2one('res.currency', string='Currency', required=True, default=lambda self: self.env.user.company_id.currency_id) + payment_date = fields.Date(string='Payment Date', default=fields.Date.context_today, required=True) + communication = fields.Char(string='Memo', default=_default_communication) + hide_payment_method = fields.Boolean(compute='_compute_hide_payment_method', + help="Technical field used to hide the payment method if the selected journal has only one available which is 'manual'") + + @api.one + @api.constrains('amount') + def _check_amount(self): + if not self.amount > 0.0: + raise ValidationError('The payment amount must be strictly positive.') + + @api.one + @api.depends('journal_id') + def _compute_hide_payment_method(self): + if not self.journal_id: + self.hide_payment_method = True + return + journal_payment_methods = self.journal_id.outbound_payment_method_ids + self.hide_payment_method = len(journal_payment_methods) == 1 and journal_payment_methods[0].code == 'manual' + + @api.onchange('journal_id') + def _onchange_journal(self): + if self.journal_id: + # Set default payment method (we consider the first to be the default one) + payment_methods = self.journal_id.outbound_payment_method_ids + self.payment_method_id = payment_methods and payment_methods[0] or False + # Set payment method domain (restrict to methods enabled for the journal and to selected payment type) + return {'domain': {'payment_method_id': [('payment_type', '=', 'outbound'), ('id', 'in', payment_methods.ids)]}} + return {} + + @api.multi + def payroll_post_payment(self): + self.ensure_one() + context = dict(self._context or {}) + active_ids = context.get('active_ids', []) + payslip = self.env['hr.payslip'].browse(active_ids) + + # Create payment and post it + payment = self.env['account.payment'].create({ + 'partner_type': 'supplier', + 'payment_type': 'outbound', + 'partner_id': self.partner_id.id, + 'journal_id': self.journal_id.id, + 'company_id': self.company_id.id, + 'payment_method_id': self.payment_method_id.id, + 'amount': self.amount, + 'currency_id': self.currency_id.id, + 'payment_date': self.payment_date, + 'communication': self.communication + }) + payment.post() + + # Reconcile the payment and the payroll, i.e. lookup on the payable account move lines + account_move_lines_to_reconcile = self.env['account.move.line'] + for line in payment.move_line_ids: + if line.account_id.internal_type == 'payable': + account_move_lines_to_reconcile |= line + for line in payslip.move_id.line_ids: + if line.account_id.internal_type == 'payable' and line.partner_id.id == self.partner_id.id: + account_move_lines_to_reconcile |= line + + account_move_lines_to_reconcile.reconcile() + + return {'type': 'ir.actions.act_window_close'} diff --git a/hr_payroll_payment/hr_payroll_register_payment.xml b/hr_payroll_payment/hr_payroll_register_payment.xml new file mode 100755 index 00000000..44e2a0b8 --- /dev/null +++ b/hr_payroll_payment/hr_payroll_register_payment.xml @@ -0,0 +1,82 @@ + + + + + + hr.payslip.select + hr.payslip + 20 + + + + + + + + + + + + + hr.payroll.register.payment.wizard.form + hr.payroll.register.payment.wizard + +
+ + +
+

Draft Payment

+
+ + + + + + + + + + + + +
+
+
+
+
+
+ + + + Register Payment + hr.payroll.register.payment.wizard + form + form + + new + {'default_payment_type': 'inbound'} + [('partner_type', '=', 'customer')] + + + + + hr.payslip.form + hr.payslip + + + +