Skip to content

Commit

Permalink
[MIG] hr_payroll_document : Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
peluko00 committed Nov 4, 2024
1 parent fa77b83 commit aa4d320
Show file tree
Hide file tree
Showing 22 changed files with 336 additions and 241 deletions.
6 changes: 4 additions & 2 deletions hr_payroll_document/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ Authors
Contributors
------------

- Antoni Marroig Campomar <[email protected]>
- Miquel Alzanillas Monserrat <[email protected]>
- `APSL-Nagarro <https://www.apsl.tech>`__:

- Antoni Marroig <[email protected]>
- Miquel Alzanillas <[email protected]>

Maintainers
-----------
Expand Down
3 changes: 2 additions & 1 deletion hr_payroll_document/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
"website": "https://github.com/OCA/payroll",
"license": "AGPL-3",
"category": "Payrolls",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"depends": ["hr", "base_vat"],
"maintainers": ["peluko00"],
"external_dependencies": {"python": ["pypdf"]},
"data": [
"wizard/payroll_management_wizard.xml",
"security/ir.model.access.csv",
"data/email_payroll_employee.xml",
"views/hr_employee_views.xml",
],
}
115 changes: 46 additions & 69 deletions hr_payroll_document/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-14 10:28+0000\n"
"PO-Revision-Date: 2023-12-14 10:28+0000\n"
"POT-Creation-Date: 2024-05-21 15:13+0000\n"
"PO-Revision-Date: 2024-05-21 15:13+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
Expand All @@ -23,34 +22,7 @@ msgid ""
" <html>\n"
" <head></head>\n"
" <body style=\"margin: 0; padding: 0;\">\n"
" <table style=\"padding:20px;background-color:#ededed; "
"border-collapse:separate\" width=\"100%\" cellpadding=\"0\" "
"border=\"0\"><tbody><!-- HEADER --><tr><td style=\"min-width:590px\" "
"align=\"center\"><table style=\"min-width:590px;background-color:#fff; "
"padding:20px; border-collapse:separate\" width=\"590\" cellpadding=\"0\" "
"border=\"0\"><tbody><tr><td style=\"text-align:right\" "
"valign=\"middle\"><img src=\"/logo.png\" style=\"padding:0px;margin:0px; "
"height:auto; width:80px\" alt=\"{{object.company_id.name}}\"></td></"
"tr><tr><td style=\"text-align:left\" valign=\"middle\"><h2 style=\"color:"
"rgb(28, 130, 156)\"><font style=\"color:rgb(107, 175, 103);\">Payroll <t t-"
"out=\"ctx.get('subject')\" contenteditable=\"false\" data-oe-t-"
"inline=\"true\"/></font></h2></td></tr></tbody></table></td></tr><!-- "
"CONTENT --><tr><td style=\"min-width:590px\" align=\"center\"><table "
"style=\"min-width:590px;background-color:rgb(255, 255, 255); padding:20px; "
"border-collapse:separate\" width=\"590\" cellpadding=\"0\" "
"border=\"0\"><tbody><tr><td style=\"font-family:Arial,Helvetica,sans-serif;"
"color:#555; font-size:14px\" valign=\"top\"><p> </p><p>Hello <t t-"
"out=\"object.name\" contenteditable=\"false\" data-oe-t-inline=\"true\"/>,</"
"p><br><p>We send you the payroll with the subject <t t-out=\"ctx."
"get('subject')\" contenteditable=\"false\" data-oe-t-inline=\"true\"/>.<br></"
"p></td></tr><tr><td style=\"font-family:Arial,Helvetica,sans-serif;color:"
"#555; font-size:14px\" valign=\"top\"><br></td></tr><tr><td style=\"font-"
"family:Arial,Helvetica,sans-serif;color:#555; font-size:14px\" "
"valign=\"top\"><br><p></p></td></tr></tbody></table></td></tr><!-- FOOTER --"
"><tr><td style=\"min-width:590px\" align=\"center\"><table style=\"min-"
"width:590px;background-color:#95ce3f; padding:20px; border-collapse:"
"separate\" width=\"590\" cellpadding=\"0\" border=\"0\"><tbody> </tbody></"
"table></td></tr></tbody></table>\n"
" <table style=\"padding:20px;background-color:#ededed; border-collapse:separate\" width=\"100%\" cellpadding=\"0\" border=\"0\"><tbody><!-- HEADER --><tr><td style=\"min-width:590px\" align=\"center\"><table style=\"min-width:590px;background-color:#fff; padding:20px; border-collapse:separate\" width=\"590\" cellpadding=\"0\" border=\"0\"><tbody><tr><td style=\"text-align:right\" valign=\"middle\"><img src=\"/logo.png\" style=\"padding:0px;margin:0px; height:auto; width:80px\" alt=\"{{object.company_id.name}}\"></td></tr><tr><td style=\"text-align:left\" valign=\"middle\"><h2 style=\"color:rgb(28, 130, 156)\"><font style=\"color:rgb(107, 175, 103);\">Payroll <t t-out=\"ctx.get('subject')\" contenteditable=\"false\" data-oe-t-inline=\"true\"/></font></h2></td></tr></tbody></table></td></tr><!-- CONTENT --><tr><td style=\"min-width:590px\" align=\"center\"><table style=\"min-width:590px;background-color:rgb(255, 255, 255); padding:20px; border-collapse:separate\" width=\"590\" cellpadding=\"0\" border=\"0\"><tbody><tr><td style=\"font-family:Arial,Helvetica,sans-serif;color:#555; font-size:14px\" valign=\"top\"><p> </p><p>Hello <t t-out=\"object.name\" contenteditable=\"false\" data-oe-t-inline=\"true\"/>,</p><br><p>We send you the payroll with the subject <t t-out=\"ctx.get('subject')\" contenteditable=\"false\" data-oe-t-inline=\"true\"/>.<br></p></td></tr><tr><td style=\"font-family:Arial,Helvetica,sans-serif;color:#555; font-size:14px\" valign=\"top\"><br></td></tr><tr><td style=\"font-family:Arial,Helvetica,sans-serif;color:#555; font-size:14px\" valign=\"top\"><br><p></p></td></tr></tbody></table></td></tr><!-- FOOTER --><tr><td style=\"min-width:590px\" align=\"center\"><table style=\"min-width:590px;background-color:#95ce3f; padding:20px; border-collapse:separate\" width=\"590\" cellpadding=\"0\" border=\"0\"><tbody> </tbody></table></td></tr></tbody></table>\n"
" <p></p>\n"
" </html>\n"
" \n"
Expand All @@ -60,34 +32,7 @@ msgstr ""
" <html>\n"
" <head></head>\n"
" <body style=\"margin: 0; padding: 0;\">\n"
" <table style=\"padding:20px;background-color:#ededed; "
"border-collapse:separate\" width=\"100%\" cellpadding=\"0\" "
"border=\"0\"><tbody><!-- HEADER --><tr><td style=\"min-width:590px\" "
"align=\"center\"><table style=\"min-width:590px;background-color:#fff; "
"padding:20px; border-collapse:separate\" width=\"590\" cellpadding=\"0\" "
"border=\"0\"><tbody><tr><td style=\"text-align:right\" "
"valign=\"middle\"><img src=\"/logo.png\" style=\"padding:0px;margin:0px; "
"height:auto; width:80px\" alt=\"{{object.company_id.name}}\"></td></"
"tr><tr><td style=\"text-align:left\" valign=\"middle\"><h2 style=\"color:"
"rgb(28, 130, 156)\"><font style=\"color:rgb(107, 175, 103);\">Nómina <t t-"
"out=\"ctx.get('month')\" contenteditable=\"false\" data-oe-t-inline=\"true\"/"
"></font></h2></td></tr></tbody></table></td></tr><!-- CONTENT --><tr><td "
"style=\"min-width:590px\" align=\"center\"><table style=\"min-width:590px;"
"background-color:rgb(255, 255, 255); padding:20px; border-collapse:"
"separate\" width=\"590\" cellpadding=\"0\" border=\"0\"><tbody><tr><td "
"style=\"font-family:Arial,Helvetica,sans-serif;color:#555; font-size:14px\" "
"valign=\"top\"><p> </p><p>Hola <t t-out=\"object.name\" "
"contenteditable=\"false\" data-oe-t-inline=\"true\"/>,</p><br><p>Te enviamos "
"la nómina del mes de <t t-out=\"ctx.get('subject')\" "
"contenteditable=\"false\" data-oe-t-inline=\"true\"/>.<br></p></td></"
"tr><tr><td style=\"font-family:Arial,Helvetica,sans-serif;color:#555; font-"
"size:14px\" valign=\"top\"><br></td></tr><tr><td style=\"font-family:Arial,"
"Helvetica,sans-serif;color:#555; font-size:14px\" valign=\"top\"><br><p></"
"p></td></tr></tbody></table></td></tr><!-- FOOTER --><tr><td style=\"min-"
"width:590px\" align=\"center\"><table style=\"min-width:590px;background-"
"color:#95ce3f; padding:20px; border-collapse:separate\" width=\"590\" "
"cellpadding=\"0\" border=\"0\"><tbody> </tbody></table></td></tr></tbody></"
"table>\n"
" <table style=\"padding:20px;background-color:#ededed; border-collapse:separate\" width=\"100%\" cellpadding=\"0\" border=\"0\"><tbody><!-- HEADER --><tr><td style=\"min-width:590px\" align=\"center\"><table style=\"min-width:590px;background-color:#fff; padding:20px; border-collapse:separate\" width=\"590\" cellpadding=\"0\" border=\"0\"><tbody><tr><td style=\"text-align:right\" valign=\"middle\"><img src=\"/logo.png\" style=\"padding:0px;margin:0px; height:auto; width:80px\" alt=\"{{object.company_id.name}}\"></td></tr><tr><td style=\"text-align:left\" valign=\"middle\"><h2 style=\"color:rgb(28, 130, 156)\"><font style=\"color:rgb(107, 175, 103);\">Nómina <t t-out=\"ctx.get('month')\" contenteditable=\"false\" data-oe-t-inline=\"true\"/></font></h2></td></tr></tbody></table></td></tr><!-- CONTENT --><tr><td style=\"min-width:590px\" align=\"center\"><table style=\"min-width:590px;background-color:rgb(255, 255, 255); padding:20px; border-collapse:separate\" width=\"590\" cellpadding=\"0\" border=\"0\"><tbody><tr><td style=\"font-family:Arial,Helvetica,sans-serif;color:#555; font-size:14px\" valign=\"top\"><p> </p><p>Hola <t t-out=\"object.name\" contenteditable=\"false\" data-oe-t-inline=\"true\"/>,</p><br><p>Te enviamos la nómina con el asunto <t t-out=\"ctx.get('subject')\" contenteditable=\"false\" data-oe-t-inline=\"true\"/>.<br></p></td></tr><tr><td style=\"font-family:Arial,Helvetica,sans-serif;color:#555; font-size:14px\" valign=\"top\"><br></td></tr><tr><td style=\"font-family:Arial,Helvetica,sans-serif;color:#555; font-size:14px\" valign=\"top\"><br><p></p></td></tr></tbody></table></td></tr><!-- FOOTER --><tr><td style=\"min-width:590px\" align=\"center\"><table style=\"min-width:590px;background-color:#95ce3f; padding:20px; border-collapse:separate\" width=\"590\" cellpadding=\"0\" border=\"0\"><tbody> </tbody></table></td></tr></tbody></table>\n"
" <p></p>\n"
" </html>\n"
" \n"
Expand All @@ -96,8 +41,9 @@ msgstr ""
#. module: hr_payroll_document
#: model:ir.model,name:hr_payroll_document.model_ir_attachment
#: model:ir.model.fields,field_description:hr_payroll_document.field_ir_attachment__payrol_rel
#: model:ir.model.fields,field_description:hr_payroll_document.field_product_document__payrol_rel
msgid "Attachment"
msgstr "Adjunto"
msgstr "Archivo adjunto"

#. module: hr_payroll_document
#: model:ir.model.fields,field_description:hr_payroll_document.field_ir_attachment_payroll_custom__attachment_id
Expand Down Expand Up @@ -131,9 +77,21 @@ msgstr "Creado el"
msgid "Display Name"
msgstr "Nombre para mostrar"

#. module: hr_payroll_document
#: model:ir.model.fields,field_description:hr_payroll_document.field_ir_attachment__document_type
#: model:ir.model.fields,field_description:hr_payroll_document.field_product_document__document_type
msgid "Document Type"
msgstr "Tipo de documento"

#. module: hr_payroll_document
#: model_terms:ir.ui.view,arch_db:hr_payroll_document.view_payroll_tree
msgid "Download"
msgstr "Descargar"

#. module: hr_payroll_document
#: model:ir.model,name:hr_payroll_document.model_hr_employee
#: model:ir.model.fields,field_description:hr_payroll_document.field_ir_attachment_payroll_custom__employee
#: model_terms:ir.ui.view,arch_db:hr_payroll_document.view_payroll_filter
msgid "Employee"
msgstr "Empleado"

Expand All @@ -147,9 +105,15 @@ msgstr "Empleados no encontrados"

#. module: hr_payroll_document
#: model:ir.model.fields,help:hr_payroll_document.field_payroll_management_wizard__subject
msgid "Enter the title of the payroll whether it is the month, week, day, etc."
msgid ""
"Enter the title of the payroll whether it is the month, week, day, etc."
msgstr "Introduzca el título de la nómina ya sea el mes, semana, día , etc.."

#. module: hr_payroll_document
#: model_terms:ir.ui.view,arch_db:hr_payroll_document.view_payroll_filter
msgid "Group By"
msgstr ""

#. module: hr_payroll_document
#: model:ir.model.fields,field_description:hr_payroll_document.field_ir_attachment_payroll_custom__id
#: model:ir.model.fields,field_description:hr_payroll_document.field_payroll_management_wizard__id
Expand All @@ -166,15 +130,10 @@ msgstr "IDs de los empleados que no se han encontrado: "

#. module: hr_payroll_document
#: model:ir.model.fields,field_description:hr_payroll_document.field_ir_attachment_payroll_custom__identification_id
#: model_terms:ir.ui.view,arch_db:hr_payroll_document.view_payroll_filter
msgid "Identification ID"
msgstr "Identificación ID"

#. module: hr_payroll_document
#: model:ir.model.fields,field_description:hr_payroll_document.field_ir_attachment_payroll_custom____last_update
#: model:ir.model.fields,field_description:hr_payroll_document.field_payroll_management_wizard____last_update
msgid "Last Modified on"
msgstr "Última modificación el"

#. module: hr_payroll_document
#: model:ir.model.fields,field_description:hr_payroll_document.field_ir_attachment_payroll_custom__write_uid
#: model:ir.model.fields,field_description:hr_payroll_document.field_payroll_management_wizard__write_uid
Expand All @@ -197,6 +156,7 @@ msgstr "Los archivos tienen que ser de tipo pdf"
#. module: hr_payroll_document
#. odoo-python
#: code:addons/hr_payroll_document/wizard/payroll_management_wizard.py:0
#: model:ir.model.fields.selection,name:hr_payroll_document.selection__ir_attachment__document_type__payroll
#, python-format
msgid "Payroll"
msgstr "Nómina"
Expand All @@ -208,6 +168,11 @@ msgstr "Nómina"
msgid "Payroll "
msgstr "Nómina "

#. module: hr_payroll_document
#: model:ir.model.fields,field_description:hr_payroll_document.field_hr_employee__payroll_count
msgid "Payroll Count"
msgstr "Recuento de Nóminas"

#. module: hr_payroll_document
#: model:mail.template,name:hr_payroll_document.payroll_employee_email_template
msgid "Payroll Employee"
Expand All @@ -226,10 +191,16 @@ msgstr "Adjunto Nómina"
#. module: hr_payroll_document
#: model:mail.template,subject:hr_payroll_document.payroll_employee_email_template
msgid "Payroll {{ctx.get('subject')}}"
msgstr "Nómina {{ctx.get('month')}}"
msgstr "Nómina {{ctx.get('subject')}}"

#. module: hr_payroll_document
#: model:ir.actions.act_window,name:hr_payroll_document.payrolls_view_action
#: model:ir.model.fields,field_description:hr_payroll_document.field_payroll_management_wizard__payrolls
#: model:ir.ui.menu,name:hr_payroll_document.payrolls_menu_action
#: model_terms:ir.ui.view,arch_db:hr_payroll_document.hr_employee_view_tree_payroll
#: model_terms:ir.ui.view,arch_db:hr_payroll_document.res_users_view_form_profile_inherit
#: model_terms:ir.ui.view,arch_db:hr_payroll_document.view_payroll_filter
#: model_terms:ir.ui.view,arch_db:hr_payroll_document.view_payroll_tree
msgid "Payrolls"
msgstr "Nóminas"

Expand Down Expand Up @@ -263,6 +234,7 @@ msgstr "Enviar"
#. module: hr_payroll_document
#: model:ir.model.fields,field_description:hr_payroll_document.field_ir_attachment_payroll_custom__subject
#: model:ir.model.fields,field_description:hr_payroll_document.field_payroll_management_wizard__subject
#: model_terms:ir.ui.view,arch_db:hr_payroll_document.view_payroll_filter
msgid "Subject"
msgstr "Asunto"

Expand All @@ -273,6 +245,11 @@ msgstr "Asunto"
msgid "The field identification ID is not valid"
msgstr "El campo identificativo ID no es válido"

#. module: hr_payroll_document
#: model:ir.model,name:hr_payroll_document.model_res_users
msgid "User"
msgstr "Usuario"

#. module: hr_payroll_document
#. odoo-python
#: code:addons/hr_payroll_document/wizard/payroll_management_wizard.py:0
Expand Down
1 change: 1 addition & 0 deletions hr_payroll_document/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import ir_attachment_payroll_custom
from . import ir_attachment
from . import hr_employee
from . import res_users
32 changes: 31 additions & 1 deletion hr_payroll_document/models/hr_employee.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,40 @@
from odoo import _, models
from odoo import _, fields, models
from odoo.exceptions import ValidationError


class Employee(models.Model):
_inherit = "hr.employee"

payroll_count = fields.Integer(
compute="_compute_payroll_count",
)

def _compute_payroll_count(self):
self.payroll_count = len(

Check warning on line 13 in hr_payroll_document/models/hr_employee.py

View check run for this annotation

Codecov / codecov/patch

hr_payroll_document/models/hr_employee.py#L13

Added line #L13 was not covered by tests
self.env["ir.attachment"].search(
[
("document_type", "=", "payroll"),
("res_model", "=", self._name),
("res_id", "in", self.ids),
]
)
)

def action_get_payroll_tree_view(self):
action = self.env.ref("base.action_attachment").sudo().read()[0]
action["context"] = {

Check warning on line 25 in hr_payroll_document/models/hr_employee.py

View check run for this annotation

Codecov / codecov/patch

hr_payroll_document/models/hr_employee.py#L24-L25

Added lines #L24 - L25 were not covered by tests
"default_res_model": self._name,
"default_res_id": self.ids[0],
}
action["domain"] = str(

Check warning on line 29 in hr_payroll_document/models/hr_employee.py

View check run for this annotation

Codecov / codecov/patch

hr_payroll_document/models/hr_employee.py#L29

Added line #L29 was not covered by tests
[
("document_type", "=", "payroll"),
("res_model", "=", self._name),
("res_id", "in", self.ids),
]
)
return action

Check warning on line 36 in hr_payroll_document/models/hr_employee.py

View check run for this annotation

Codecov / codecov/patch

hr_payroll_document/models/hr_employee.py#L36

Added line #L36 was not covered by tests

def write(self, vals):
res = super().write(vals)
if "identification_id" in vals and not self.env["res.partner"].simple_vat_check(
Expand Down
2 changes: 1 addition & 1 deletion hr_payroll_document/models/ir_attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ class Attachment(models.Model):
"attachment_id3",
"document_id",
string="Attachment",
invisible=1,
)
document_type = fields.Selection([("payroll", "Payroll")])
7 changes: 6 additions & 1 deletion hr_payroll_document/models/ir_attachment_payroll_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ class IRAttachmentPayrollCustom(models.Model):
comodel_name="ir.attachment",
string="Attachment File",
prefetch=False,
invisible=True,
ondelete="cascade",
)
employee = fields.Char()
identification_id = fields.Char("Identification ID")
create_date = fields.Date(default=fields.Date.context_today)
subject = fields.Char()

def download(self):
return {

Check warning on line 20 in hr_payroll_document/models/ir_attachment_payroll_custom.py

View check run for this annotation

Codecov / codecov/patch

hr_payroll_document/models/ir_attachment_payroll_custom.py#L20

Added line #L20 was not covered by tests
"type": "ir.actions.act_url",
"url": "web/content/" + str(self.attachment_id.id) + "/?download=True",
}
20 changes: 20 additions & 0 deletions hr_payroll_document/models/res_users.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from odoo import models


class ResUsers(models.Model):
_inherit = "res.users"

def action_get_attachment_tree_view(self):
action = self.env.ref("base.action_attachment").sudo().read()[0]
action["context"] = {

Check warning on line 9 in hr_payroll_document/models/res_users.py

View check run for this annotation

Codecov / codecov/patch

hr_payroll_document/models/res_users.py#L8-L9

Added lines #L8 - L9 were not covered by tests
"default_res_model": self._name,
"default_res_id": self.employee_id.id,
}
action["domain"] = str(

Check warning on line 13 in hr_payroll_document/models/res_users.py

View check run for this annotation

Codecov / codecov/patch

hr_payroll_document/models/res_users.py#L13

Added line #L13 was not covered by tests
[
("document_type", "=", "payroll"),
("res_model", "=", self.employee_id._name),
("res_id", "in", [self.employee_id.id]),
]
)
return action

Check warning on line 20 in hr_payroll_document/models/res_users.py

View check run for this annotation

Codecov / codecov/patch

hr_payroll_document/models/res_users.py#L20

Added line #L20 was not covered by tests
5 changes: 3 additions & 2 deletions hr_payroll_document/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
- Antoni Marroig Campomar \<<[email protected]>\>
- Miquel Alzanillas Monserrat \<<[email protected]>\>
- [APSL-Nagarro](https://www.apsl.tech):
- Antoni Marroig \<<[email protected]>\>
- Miquel Alzanillas \<<[email protected]>\>
3 changes: 1 addition & 2 deletions hr_payroll_document/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
This module have a wizard view to manage the different payrolls of
employees which is identified by the identification_id attribute.
This module have a wizard view to manage the different payrolls of employees which is identified by the identification_id attribute.
Loading

0 comments on commit aa4d320

Please sign in to comment.