mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Initial commit of hr_payroll_account_batch for 11.0
This commit is contained in:
2
hr_payroll_account_batch/__init__.py
Executable file
2
hr_payroll_account_batch/__init__.py
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
from . import models
|
||||||
|
from . import wizard
|
||||||
20
hr_payroll_account_batch/__manifest__.py
Executable file
20
hr_payroll_account_batch/__manifest__.py
Executable file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
'name': 'Payslip Batch Date',
|
||||||
|
'description': """
|
||||||
|
Set the Accounting Date on a Payslip Batch.
|
||||||
|
|
||||||
|
Additionally, changes to the Salary Journal and Date Account on the batch itself
|
||||||
|
will propagate to any draft payslip already existing on the batch.
|
||||||
|
""",
|
||||||
|
'version': '11.0.1.0.0',
|
||||||
|
'website': 'https://hibou.io/',
|
||||||
|
'author': 'Hibou Corp. <hello@hibou.io>',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'category': 'Human Resources',
|
||||||
|
'depends': [
|
||||||
|
'hr_payroll_account',
|
||||||
|
],
|
||||||
|
'data': [
|
||||||
|
'views/payroll_views.xml',
|
||||||
|
],
|
||||||
|
}
|
||||||
1
hr_payroll_account_batch/models/__init__.py
Normal file
1
hr_payroll_account_batch/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import payroll
|
||||||
30
hr_payroll_account_batch/models/payroll.py
Normal file
30
hr_payroll_account_batch/models/payroll.py
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
from odoo import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class HrPayslip(models.Model):
|
||||||
|
_inherit = 'hr.payslip'
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def create(self, vals):
|
||||||
|
if 'date' in self.env.context:
|
||||||
|
vals['date'] = self.env.context.get('date')
|
||||||
|
return super(HrPayslip, self).create(vals)
|
||||||
|
|
||||||
|
|
||||||
|
class PayslipBatch(models.Model):
|
||||||
|
_inherit = 'hr.payslip.run'
|
||||||
|
|
||||||
|
date = fields.Date('Date Account', states={'draft': [('readonly', False)]}, readonly=True,
|
||||||
|
help="Keep empty to use the period of the validation(Payslip) date.")
|
||||||
|
|
||||||
|
def write(self, values):
|
||||||
|
if 'date' in values or 'journal_id' in values:
|
||||||
|
slips = self.mapped('slip_ids').filtered(lambda s: s.state in ('draft', 'verify'))
|
||||||
|
slip_values = {}
|
||||||
|
if 'date' in values:
|
||||||
|
slip_values['date'] = values['date']
|
||||||
|
if 'journal_id' in values:
|
||||||
|
slip_values['journal_id'] = values['journal_id']
|
||||||
|
slips.write(slip_values)
|
||||||
|
|
||||||
|
return super(PayslipBatch, self).write(values)
|
||||||
13
hr_payroll_account_batch/views/payroll_views.xml
Normal file
13
hr_payroll_account_batch/views/payroll_views.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<record id="hr_payslip_run_form_inherit" model="ir.ui.view">
|
||||||
|
<field name="name">hr.payslip.run.form.inherit</field>
|
||||||
|
<field name="model">hr.payslip.run</field>
|
||||||
|
<field name="inherit_id" ref="hr_payroll_account.hr_payslip_run_form_inherit"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//field[@name='journal_id']" position="after">
|
||||||
|
<field name="date" />
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
1
hr_payroll_account_batch/wizard/__init__.py
Normal file
1
hr_payroll_account_batch/wizard/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import payroll_wizard
|
||||||
12
hr_payroll_account_batch/wizard/payroll_wizard.py
Normal file
12
hr_payroll_account_batch/wizard/payroll_wizard.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
from odoo import api, models
|
||||||
|
|
||||||
|
|
||||||
|
class HrPayslipEmployees(models.TransientModel):
|
||||||
|
_inherit = 'hr.payslip.employees'
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def compute_sheet(self):
|
||||||
|
date = False
|
||||||
|
if self.env.context.get('active_id'):
|
||||||
|
date = self.env['hr.payslip.run'].browse(self.env.context.get('active_id')).date
|
||||||
|
return super(HrPayslipEmployees, self.with_context(date=date)).compute_sheet()
|
||||||
Reference in New Issue
Block a user