mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Merge branch 'mig/14.0/hr_payslip_line_date' into '14.0'
mig/14.0/hr_payslip_line_date into 14.0 See merge request hibou-io/hibou-odoo/suite!1309
This commit is contained in:
1
hr_payslip_line_date/__init__.py
Normal file
1
hr_payslip_line_date/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
24
hr_payslip_line_date/__manifest__.py
Executable file
24
hr_payslip_line_date/__manifest__.py
Executable file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
'name': 'Date on Payslip Lines',
|
||||
'author': 'Hibou Corp. <hello@hibou.io>',
|
||||
'license': 'AGPL-3',
|
||||
'category': 'Human Resources',
|
||||
'depends': ['hr_payroll_account'],
|
||||
'version': '14.0.1.0.0',
|
||||
'description': """
|
||||
Date on Payslip Lines
|
||||
=====================
|
||||
|
||||
* Adds "Date Account" (date) field to payslip line from payslip
|
||||
* Adds group by date to Payslip Line search view
|
||||
* Allows filtering by "Date Account" for easy period reporting
|
||||
""",
|
||||
|
||||
'auto_install': True,
|
||||
'website': 'https://hibou.io/',
|
||||
'data': [
|
||||
'views/payslip_view.xml',
|
||||
'views/payslip_menu.xml',
|
||||
],
|
||||
'installable': True
|
||||
}
|
||||
1
hr_payslip_line_date/models/__init__.py
Executable file
1
hr_payslip_line_date/models/__init__.py
Executable file
@@ -0,0 +1 @@
|
||||
from . import payslip
|
||||
7
hr_payslip_line_date/models/payslip.py
Executable file
7
hr_payslip_line_date/models/payslip.py
Executable file
@@ -0,0 +1,7 @@
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class PayslipLine(models.Model):
|
||||
_inherit = 'hr.payslip.line'
|
||||
|
||||
date = fields.Date(string="Date Account", related='slip_id.date', store=True)
|
||||
35
hr_payslip_line_date/payslip_view.xml
Executable file
35
hr_payslip_line_date/payslip_view.xml
Executable file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="payslip_line_filter_date" model="ir.ui.view">
|
||||
<field name="name">hr.payslip.line.select</field>
|
||||
<field name="model">hr.payslip.line</field>
|
||||
<field name="priority">20</field>
|
||||
<field name="inherit_id" ref="hr_payroll.view_hr_payslip_line_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//group" position="before">
|
||||
<separator string="Date Account"/>
|
||||
<filter name="this_week" string="This Week" domain="[('date', '>=', (context_today() - datetime.timedelta(days=7)).strftime('%Y-%m-%d')), ('date', '<', (context_today() - datetime.timedelta(days=0)).strftime('%Y-%m-%d'))]"/>
|
||||
<filter name="last_week" string="Last Week" domain="[('date', '>=', (context_today() - datetime.timedelta(days=14)).strftime('%Y-%m-%d')), ('date', '<', (context_today() - datetime.timedelta(days=7)).strftime('%Y-%m-%d'))]"/>
|
||||
<filter name="last_two_week" string="Two Weeks Ago" domain="[('date', '>=', (context_today() - datetime.timedelta(days=21)).strftime('%Y-%m-%d')), ('date', '<', (context_today() - datetime.timedelta(days=14)).strftime('%Y-%m-%d'))]"/>
|
||||
<filter name="last_three_week" string="Three Weeks Ago" domain="[('date', '>=', (context_today() - datetime.timedelta(days=28)).strftime('%Y-%m-%d')), ('date', '<', (context_today() - datetime.timedelta(days=21)).strftime('%Y-%m-%d'))]"/>
|
||||
<filter name="this_month" string="This Month" domain="[('date', '>=', context_today().strftime('%Y-%m-01')), ('date', '<=', (context_today().replace(day=28) + datetime.timedelta(days=4)).strftime('%Y-%m-01'))]"/>
|
||||
<filter name="last_month" string="Last Month" domain="[('date', '<', context_today().strftime('%Y-%m-01')), ('date', '>=', (context_today().replace(day=1) - datetime.timedelta(days=1)).strftime('%Y-%m-01'))]"/>
|
||||
<separator string="This Year"/>
|
||||
<filter name="this_year_q1" string="This Year Q1" domain="[('date', '>=', context_today().strftime('%Y-01-01')), ('date', '<', context_today().strftime('%Y-04-01'))]" />
|
||||
<filter name="this_year_q2" string="This Year Q2" domain="[('date', '>=', context_today().strftime('%Y-04-01')), ('date', '<', context_today().strftime('%Y-07-01'))]" />
|
||||
<filter name="this_year_q3" string="This Year Q3" domain="[('date', '>=', context_today().strftime('%Y-07-01')), ('date', '<', context_today().strftime('%Y-10-01'))]" />
|
||||
<filter name="this_year_q4" string="This Year Q4" domain="[('date', '>=', context_today().strftime('%Y-10-01')), ('date', '<=', context_today().strftime('%Y-12-31'))]" />
|
||||
<separator string="Last Year"/>
|
||||
<filter name="this_year_q1" string="Last Year Q1" domain="[('date', '>=', (context_today() - datetime.timedelta(days=365)).strftime('%Y-01-01')), ('date', '<', (context_today() - datetime.timedelta(days=365)).strftime('%Y-04-01'))]" />
|
||||
<filter name="this_year_q2" string="Last Year Q2" domain="[('date', '>=', (context_today() - datetime.timedelta(days=365)).strftime('%Y-04-01')), ('date', '<', (context_today() - datetime.timedelta(days=365)).strftime('%Y-07-01'))]" />
|
||||
<filter name="this_year_q3" string="Last Year Q3" domain="[('date', '>=', (context_today() - datetime.timedelta(days=365)).strftime('%Y-07-01')), ('date', '<', (context_today() - datetime.timedelta(days=365)).strftime('%Y-10-01'))]" />
|
||||
<filter name="this_year_q4" string="Last Year Q4" domain="[('date', '>=', (context_today() - datetime.timedelta(days=365)).strftime('%Y-10-01')), ('date', '<=', (context_today() - datetime.timedelta(days=365)).strftime('%Y-12-31'))]" />
|
||||
</xpath>
|
||||
<xpath expr="//group" position="inside">
|
||||
<filter string="Account Date" name="date" context="{'group_by':'date'}"/>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
16
hr_payslip_line_date/views/payslip_menu.xml
Normal file
16
hr_payslip_line_date/views/payslip_menu.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<odoo>
|
||||
|
||||
<record id="action_payslip_lines" model="ir.actions.act_window">
|
||||
<field name="name">Payslip Lines</field>
|
||||
<field name="res_model">hr.payslip.line</field>
|
||||
<field name="view_mode">tree,pivot</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="payslip_reporting_view"
|
||||
name="Payslip Lines"
|
||||
parent="hr_payroll.menu_hr_payroll_report"
|
||||
action="action_payslip_lines" />
|
||||
|
||||
</odoo>
|
||||
64
hr_payslip_line_date/views/payslip_view.xml
Executable file
64
hr_payslip_line_date/views/payslip_view.xml
Executable file
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="payslip_line_filter_date" model="ir.ui.view">
|
||||
<field name="name">hr.payslip.line.select</field>
|
||||
<field name="model">hr.payslip.line</field>
|
||||
<field name="priority">20</field>
|
||||
<field name="inherit_id" ref="hr_payroll.hr_payslip_line_view_search_register"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//filter[@name='last_month']" position="attributes">
|
||||
<attribute name="string">Last Month (Date From)</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//filter[@name='last_quarter']" position="attributes">
|
||||
<attribute name="string">Last Quarter (Date From)</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//group" position="before">
|
||||
<separator string="Date Account"/>
|
||||
<filter name="this_week" string="This Week" domain="[('date', '>=', (context_today() - datetime.timedelta(days=7)).strftime('%Y-%m-%d')), ('date', '<', (context_today() - datetime.timedelta(days=0)).strftime('%Y-%m-%d'))]"/>
|
||||
<filter name="last_week" string="Last Week" domain="[('date', '>=', (context_today() - datetime.timedelta(days=14)).strftime('%Y-%m-%d')), ('date', '<', (context_today() - datetime.timedelta(days=7)).strftime('%Y-%m-%d'))]"/>
|
||||
<filter name="last_two_week" string="Two Weeks Ago" domain="[('date', '>=', (context_today() - datetime.timedelta(days=21)).strftime('%Y-%m-%d')), ('date', '<', (context_today() - datetime.timedelta(days=14)).strftime('%Y-%m-%d'))]"/>
|
||||
<filter name="last_three_week" string="Three Weeks Ago" domain="[('date', '>=', (context_today() - datetime.timedelta(days=28)).strftime('%Y-%m-%d')), ('date', '<', (context_today() - datetime.timedelta(days=21)).strftime('%Y-%m-%d'))]"/>
|
||||
<filter name="this_month" string="This Month" domain="[('date', '>=', context_today().strftime('%Y-%m-01')), ('date', '<=', (context_today().replace(day=28) + datetime.timedelta(days=4)).strftime('%Y-%m-01'))]"/>
|
||||
<filter name="last_month" string="Last Month" domain="[('date', '<', context_today().strftime('%Y-%m-01')), ('date', '>=', (context_today().replace(day=1) - datetime.timedelta(days=1)).strftime('%Y-%m-01'))]"/>
|
||||
<separator string="This Year"/>
|
||||
<filter name="this_year_q1" string="This Year Q1" domain="[('date', '>=', context_today().strftime('%Y-01-01')), ('date', '<', context_today().strftime('%Y-04-01'))]" />
|
||||
<filter name="this_year_q2" string="This Year Q2" domain="[('date', '>=', context_today().strftime('%Y-04-01')), ('date', '<', context_today().strftime('%Y-07-01'))]" />
|
||||
<filter name="this_year_q3" string="This Year Q3" domain="[('date', '>=', context_today().strftime('%Y-07-01')), ('date', '<', context_today().strftime('%Y-10-01'))]" />
|
||||
<filter name="this_year_q4" string="This Year Q4" domain="[('date', '>=', context_today().strftime('%Y-10-01')), ('date', '<=', context_today().strftime('%Y-12-31'))]" />
|
||||
<separator string="Last Year"/>
|
||||
<filter name="this_year_q1" string="Last Year Q1" domain="[('date', '>=', (context_today() - datetime.timedelta(days=365)).strftime('%Y-01-01')), ('date', '<', (context_today() - datetime.timedelta(days=365)).strftime('%Y-04-01'))]" />
|
||||
<filter name="this_year_q2" string="Last Year Q2" domain="[('date', '>=', (context_today() - datetime.timedelta(days=365)).strftime('%Y-04-01')), ('date', '<', (context_today() - datetime.timedelta(days=365)).strftime('%Y-07-01'))]" />
|
||||
<filter name="this_year_q3" string="Last Year Q3" domain="[('date', '>=', (context_today() - datetime.timedelta(days=365)).strftime('%Y-07-01')), ('date', '<', (context_today() - datetime.timedelta(days=365)).strftime('%Y-10-01'))]" />
|
||||
<filter name="this_year_q4" string="Last Year Q4" domain="[('date', '>=', (context_today() - datetime.timedelta(days=365)).strftime('%Y-10-01')), ('date', '<=', (context_today() - datetime.timedelta(days=365)).strftime('%Y-12-31'))]" />
|
||||
</xpath>
|
||||
<xpath expr="//group" position="inside">
|
||||
<filter string="Account Date" name="date" context="{'group_by':'date'}"/>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_hr_payslip_line_tree_extend" model="ir.ui.view">
|
||||
<field name="name">hr.payslip.line.tree.extend</field>
|
||||
<field name="model">hr.payslip.line</field>
|
||||
<field name="inherit_id" ref="hr_payroll.view_hr_payslip_line_tree" />
|
||||
<field name="arch" type="xml">
|
||||
|
||||
<xpath expr="//tree" position="attributes">
|
||||
<attribute name="editable" />
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//field[@name='sequence']" position="attributes">
|
||||
<attribute name="invisible">True</attribute>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//field[@name='category_id']" position="before">
|
||||
<field name="slip_id"/>
|
||||
</xpath>
|
||||
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user