diff --git a/l10n_do_gov_job_expense/__init__.py b/l10n_do_gov_job_expense/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/l10n_do_gov_job_expense/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/l10n_do_gov_job_expense/__manifest__.py b/l10n_do_gov_job_expense/__manifest__.py new file mode 100644 index 0000000..a786cbf --- /dev/null +++ b/l10n_do_gov_job_expense/__manifest__.py @@ -0,0 +1,15 @@ +{ + "name": "Dominican Gov Job Expenses", + "summary": """ + Short (1 phrase/line) summary of the module's purpose, used as + subtitle on modules listing or apps.openerp.com""", + "author": "Indexa", + "website": "https://www.indexa.do", + "category": "Uncategorized", + "version": "12.0.0.0.1", + "depends": ["hr_expense"], + "data": [ + "views/hr_job_views.xml", + "views/hr_expense_views.xml", + ], +} diff --git a/l10n_do_gov_job_expense/i18n/es_DO.po b/l10n_do_gov_job_expense/i18n/es_DO.po new file mode 100644 index 0000000..ba1d300 --- /dev/null +++ b/l10n_do_gov_job_expense/i18n/es_DO.po @@ -0,0 +1,63 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_do_gov_job_expense +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-06-27 21:43+0000\n" +"PO-Revision-Date: 2022-06-27 17:43-0400\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: es_DO\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" +"X-Generator: Poedit 3.1\n" + +#. module: l10n_do_gov_job_expense +#: model:ir.model.fields,help:l10n_do_gov_job_expense.field_hr_job__l10n_do_gov_expense_product_ids +msgid "Allowed expense products for this job position" +msgstr "Productos de gasto permitidos para este puesto de trabajo" + +#. module: l10n_do_gov_job_expense +#: model:ir.model.fields,field_description:l10n_do_gov_job_expense.field_hr_expense__display_name +#: model:ir.model.fields,field_description:l10n_do_gov_job_expense.field_hr_job__display_name +msgid "Display Name" +msgstr "Nombre mostrado" + +#. module: l10n_do_gov_job_expense +#: model:ir.model,name:l10n_do_gov_job_expense.model_hr_expense +msgid "Expense" +msgstr "Gasto" + +#. module: l10n_do_gov_job_expense +#: model:ir.model.fields,field_description:l10n_do_gov_job_expense.field_hr_job__l10n_do_gov_expense_product_ids +#: model_terms:ir.ui.view,arch_db:l10n_do_gov_job_expense.view_hr_job_form_inherited +msgid "Expense products" +msgstr "Productos para gastos" + +#. module: l10n_do_gov_job_expense +#: model:ir.model.fields,field_description:l10n_do_gov_job_expense.field_hr_expense__id +#: model:ir.model.fields,field_description:l10n_do_gov_job_expense.field_hr_job__id +msgid "ID" +msgstr "ID (identificación)" + +#. module: l10n_do_gov_job_expense +#: model:ir.model,name:l10n_do_gov_job_expense.model_hr_job +#: model:ir.model.fields,field_description:l10n_do_gov_job_expense.field_hr_expense__job_id +msgid "Job Position" +msgstr "Puesto de trabajo" + +#. module: l10n_do_gov_job_expense +#: model:ir.model.fields,field_description:l10n_do_gov_job_expense.field_hr_expense____last_update +#: model:ir.model.fields,field_description:l10n_do_gov_job_expense.field_hr_job____last_update +msgid "Last Modified on" +msgstr "Última modificación el" + +#. module: l10n_do_gov_job_expense +#: model:ir.model.fields,field_description:l10n_do_gov_job_expense.field_hr_expense__product_id +msgid "Product" +msgstr "Producto" diff --git a/l10n_do_gov_job_expense/models/__init__.py b/l10n_do_gov_job_expense/models/__init__.py new file mode 100644 index 0000000..7a9132e --- /dev/null +++ b/l10n_do_gov_job_expense/models/__init__.py @@ -0,0 +1,2 @@ +from . import hr_job +from . import hr_expense diff --git a/l10n_do_gov_job_expense/models/hr_expense.py b/l10n_do_gov_job_expense/models/hr_expense.py new file mode 100644 index 0000000..64662c1 --- /dev/null +++ b/l10n_do_gov_job_expense/models/hr_expense.py @@ -0,0 +1,25 @@ +from odoo import models, fields, api + + +class Expense(models.Model): + _inherit = "hr.expense" + + job_id = fields.Many2one("hr.job", related="employee_id.job_id") + product_id = fields.Many2one( + domain=[] + # domain=lambda self: [ + # ("id", "in", self.job_id.l10n_do_gov_expense_product_ids.ids)] + ) + + @api.onchange("employee_id") + def _onchange_employee_id(self): + expense_product_ids = [] + if self.employee_id: + expense_product_ids = self.job_id.l10n_do_gov_expense_product_ids.ids + return { + "domain": { + "product_id": [ + ("id", "in", expense_product_ids) + ] + } + } diff --git a/l10n_do_gov_job_expense/models/hr_job.py b/l10n_do_gov_job_expense/models/hr_job.py new file mode 100644 index 0000000..87bf439 --- /dev/null +++ b/l10n_do_gov_job_expense/models/hr_job.py @@ -0,0 +1,12 @@ +from odoo import models, fields + + +class Job(models.Model): + _inherit = "hr.job" + + l10n_do_gov_expense_product_ids = fields.Many2many( + "product.product", + string="Expense products", + domain=[("can_be_expensed", "=", True)], + help="Allowed expense products for this job position", + ) diff --git a/l10n_do_gov_job_expense/security/ir.model.access.csv b/l10n_do_gov_job_expense/security/ir.model.access.csv new file mode 100644 index 0000000..ad0cead --- /dev/null +++ b/l10n_do_gov_job_expense/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_template_module_template_module,template_module.template_module,model_template_module_template_module,,1,0,0,0 \ No newline at end of file diff --git a/l10n_do_gov_job_expense/views/hr_expense_views.xml b/l10n_do_gov_job_expense/views/hr_expense_views.xml new file mode 100644 index 0000000..9e16bbc --- /dev/null +++ b/l10n_do_gov_job_expense/views/hr_expense_views.xml @@ -0,0 +1,17 @@ + + + + + hr.expense.view.form.inherited + hr.expense + + + + + + + + + diff --git a/l10n_do_gov_job_expense/views/hr_job_views.xml b/l10n_do_gov_job_expense/views/hr_job_views.xml new file mode 100644 index 0000000..74c0b4b --- /dev/null +++ b/l10n_do_gov_job_expense/views/hr_job_views.xml @@ -0,0 +1,31 @@ + + + + + view.hr.job.form.inherited + hr.job + + + + + + + + + + + + + + + + + + + +