diff --git a/__manifest__.py b/__manifest__.py index 383dc02f1c956109faa9c7466e7f652d4a5f67e4..058b54fe4c48535bc7998e191300144e8b3c084a 100755 --- a/__manifest__.py +++ b/__manifest__.py @@ -15,9 +15,11 @@ "multi_company_menu", ], "data": [ + "security/security_rules.xml", "security/ir.model.access.csv", "views/account_invoice.xml", "views/res_config_settings.xml", + "views/scop_cotisation_task.xml", ], 'post_init_hook': '_configure_journals', } diff --git a/models/__init__.py b/models/__init__.py index e635914026dba332f843a202f89ba79e07b16612..048e4e94e13a361fe412066f25da613b3ed1c868 100755 --- a/models/__init__.py +++ b/models/__init__.py @@ -7,3 +7,4 @@ from . import res_company from . import res_config_settings from . import scop_contribution from . import scop_cotisation +from . import scop_cotisation_task diff --git a/models/res_config_settings.py b/models/res_config_settings.py index 78f240d676bb29297eb857df9c2f1aa1909ff123..8214d9c80651f6ce32b66c8e3bbcbaa57943e6fe 100644 --- a/models/res_config_settings.py +++ b/models/res_config_settings.py @@ -46,7 +46,11 @@ class CotisationsConfigSettings(models.TransientModel): menu_cotiz = self.env.ref( 'cgscop_cotisation.menu_scop_cotisation') + menu_cotiz_task_create = self.env.ref( + 'cgscop_cotisation.menu_scop_cotisation_list_task') + bool_condition = self.is_contribution self.add_company_to_menu(menu_cotiz, bool_condition) + self.add_company_to_menu(menu_cotiz_task_create, bool_condition) return res diff --git a/models/scop_cotisation_task.py b/models/scop_cotisation_task.py new file mode 100644 index 0000000000000000000000000000000000000000..9cf5fd7bcbc807cbff4b24515a8794661e8f4346 --- /dev/null +++ b/models/scop_cotisation_task.py @@ -0,0 +1,24 @@ +# © 2021 Le Filament (<http://www.le-filament.com>) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class CotisationTask(models.Model): + _name = 'scop.cotisation.task' + _description = 'Gestion des créations des cotisations' + + year = fields.Integer('Année') + message = fields.Char("Message") + cotiz_created = fields.Integer("Appels de cotisation créés") + cotiz_to_create = fields.Integer("Appels de cotisation à créer") + is_error = fields.Boolean('En erreur', default=False) + status = fields.Selection([ + ('in_process', 'En cours'), + ('done', 'Terminé') + ], string='Statut') + company_id = fields.Many2one( + comodel_name='res.company', + string='Company', change_default=True, + required=True, readonly=True, + default=lambda self: self.env.user.company_id) diff --git a/security/ir.model.access.csv b/security/ir.model.access.csv index 97dd8b917b8a258799a3ebf0095f13ff73d7cf68..e20c8308a728efd5f82e307bdc0f250490c415a3 100755 --- a/security/ir.model.access.csv +++ b/security/ir.model.access.csv @@ -1 +1,3 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_scop_cotisation_task,access_scop_cotisation_task,model_scop_cotisation_task,account.group_account_manager,1,1,1,0 +admin_access_scop_cotisation_task,admin_access_scop_cotisation_task,model_scop_cotisation_task,cgscop_partner.group_cg_administrator,1,1,1,1 diff --git a/security/security_rules.xml b/security/security_rules.xml new file mode 100644 index 0000000000000000000000000000000000000000..e4498049d5eb339c0203f2eceecbd4a5062e7e7c --- /dev/null +++ b/security/security_rules.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2020 Le Filament + License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> + +<odoo> + <data noupdate="0"> + + <record id="cg_cotisation_task_rule" model="ir.rule"> + <field name="name">Tâches créations cotisations consultables que pour sa société</field> + <field name="model_id" ref="cgscop_cotisation.model_scop_cotisation_task"/> + <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field> + <field name="perm_read" eval="True"/> + <field name="perm_write" eval="True"/> + <field name="perm_create" eval="True"/> + <field name="perm_unlink" eval="True"/> + </record> + + </data> +</odoo> \ No newline at end of file diff --git a/views/scop_cotisation_task.xml b/views/scop_cotisation_task.xml new file mode 100644 index 0000000000000000000000000000000000000000..08280db1767791af6097239d1ba346ad60f8b5b9 --- /dev/null +++ b/views/scop_cotisation_task.xml @@ -0,0 +1,40 @@ +<?xml version="1.0"?> +<!-- Copyright 2021 Le Filament + License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> + +<odoo> + <data> + + <!-- TREE VIEW --> + <record model="ir.ui.view" id="view_scop_cotisation_task_tree"> + <field name="name">scop.cotisation.task.tree</field> + <field name="model">scop.cotisation.task</field> + <field name="arch" type="xml"> + <tree create="false" string="Taches création cotisations"> + <field name="create_date"/> + <field name="year"/> + <field name='status'/> + <field name='cotiz_created'/> + <field name='cotiz_to_create'/> + <field name='is_error'/> + <field name="message"/> + </tree> + </field> + </record> + + <!-- ACTIONS VIEWS--> + <record model="ir.actions.act_window" id="action_scop_cotisation_task"> + <field name="name">Taches cotisation</field> + <field name="res_model">scop.cotisation.task</field> + <field name="view_mode">tree,form</field> + </record> + + <!-- MENU --> + <menuitem id="menu_scop_cotisation_list_task" + parent="account.menu_finance_configuration" + name="Taches création cotisations" + sequence="50" + action="action_scop_cotisation_task"/> + + </data> +</odoo> \ No newline at end of file