From 3ab974cf26d2ddbc55cf27fc1cced29a0450c15d Mon Sep 17 00:00:00 2001 From: Elouan Le Bars Date: Thu, 14 Nov 2019 14:49:58 +0100 Subject: [PATCH 01/20] [MIG] emc_taxshelter_report : migration to 10.0 --- .../{__openerp__.py => __manifest__.py} | 6 +++--- .../models/tax_shelter_declaration.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) rename easy_my_coop_taxshelter_report/{__openerp__.py => __manifest__.py} (91%) diff --git a/easy_my_coop_taxshelter_report/__openerp__.py b/easy_my_coop_taxshelter_report/__manifest__.py similarity index 91% rename from easy_my_coop_taxshelter_report/__openerp__.py rename to easy_my_coop_taxshelter_report/__manifest__.py index 8e35b61..f78d1cb 100644 --- a/easy_my_coop_taxshelter_report/__openerp__.py +++ b/easy_my_coop_taxshelter_report/__manifest__.py @@ -21,15 +21,15 @@ { # todo check ir model access "name": "Easy My Coop tax shelter report", - "version": "1.0", + "version": "10.0.1.0.0, "depends": ["easy_my_coop"], "author": "Houssine BAKKALI ", "category": "Cooperative management", 'website': "www.coopiteasy.be", "license": "AGPL-3", "description": """ - This module allows to create a fiscal declaration year and to print - tax shelter declaration each cooperator + This module allows you to create a fiscal declaration year and to print + tax shelter declaration for each cooperator. """, 'data': [ 'security/ir.model.access.csv', diff --git a/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py b/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py index 774a38a..a070a1a 100644 --- a/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py +++ b/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import base64 -from openerp import api, fields, models +from odoo import api, fields, models TYPE_MAP = { 'subscription': 'subscribed', From 3f1490876148faf5d56a849934f1ef75e14eda99 Mon Sep 17 00:00:00 2001 From: Elouan Le Bars Date: Thu, 14 Nov 2019 14:55:30 +0100 Subject: [PATCH 02/20] [MIG] emc_taxshelter_report : migration to 11.0 --- easy_my_coop_taxshelter_report/__manifest__.py | 2 +- easy_my_coop_taxshelter_report/i18n/fr_BE.po | 4 ++-- .../models/tax_shelter_declaration.py | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/easy_my_coop_taxshelter_report/__manifest__.py b/easy_my_coop_taxshelter_report/__manifest__.py index f78d1cb..b68170e 100644 --- a/easy_my_coop_taxshelter_report/__manifest__.py +++ b/easy_my_coop_taxshelter_report/__manifest__.py @@ -21,7 +21,7 @@ { # todo check ir model access "name": "Easy My Coop tax shelter report", - "version": "10.0.1.0.0, + "version": "11.0.1.0.0", "depends": ["easy_my_coop"], "author": "Houssine BAKKALI ", "category": "Cooperative management", diff --git a/easy_my_coop_taxshelter_report/i18n/fr_BE.po b/easy_my_coop_taxshelter_report/i18n/fr_BE.po index cab1ccc..6e3b616 100644 --- a/easy_my_coop_taxshelter_report/i18n/fr_BE.po +++ b/easy_my_coop_taxshelter_report/i18n/fr_BE.po @@ -572,12 +572,12 @@ msgid "Tax shelter eligible" msgstr "Eligible au Tax Shelter" #. module: easy_my_coop_taxshelter_report -#: model:ir.actions.report.xml,name:easy_my_coop_taxshelter_report.action_tax_shelter_shares_report +#: model:ir.actions.report,name:easy_my_coop_taxshelter_report.action_tax_shelter_shares_report msgid "Tax shelter shares report" msgstr "Attestation de parts Tax Shelter" #. module: easy_my_coop_taxshelter_report -#: model:ir.actions.report.xml,name:easy_my_coop_taxshelter_report.action_tax_shelter_subscription_report +#: model:ir.actions.report,name:easy_my_coop_taxshelter_report.action_tax_shelter_subscription_report msgid "Tax shelter subscription report" msgstr "Attestation de souscription Tax Shelter" diff --git a/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py b/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py index a070a1a..1364b0b 100644 --- a/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py +++ b/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import base64 from odoo import api, fields, models From 7cfc2a4944b59a6ea46990563ad36bb97b491705 Mon Sep 17 00:00:00 2001 From: Elouan Le Bars Date: Thu, 14 Nov 2019 14:57:57 +0100 Subject: [PATCH 03/20] [MIG] emc_taxshelter_report : migration to 12.0 --- easy_my_coop_taxshelter_report/__manifest__.py | 2 +- .../data/scheduler_data.xml | 11 +++++------ easy_my_coop_taxshelter_report/i18n/fr_BE.po | 2 +- .../models/tax_shelter_declaration.py | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/easy_my_coop_taxshelter_report/__manifest__.py b/easy_my_coop_taxshelter_report/__manifest__.py index b68170e..1dceb4b 100644 --- a/easy_my_coop_taxshelter_report/__manifest__.py +++ b/easy_my_coop_taxshelter_report/__manifest__.py @@ -21,7 +21,7 @@ { # todo check ir model access "name": "Easy My Coop tax shelter report", - "version": "11.0.1.0.0", + "version": "12.0.1.0.0", "depends": ["easy_my_coop"], "author": "Houssine BAKKALI ", "category": "Cooperative management", diff --git a/easy_my_coop_taxshelter_report/data/scheduler_data.xml b/easy_my_coop_taxshelter_report/data/scheduler_data.xml index 6b191f6..99eccfd 100644 --- a/easy_my_coop_taxshelter_report/data/scheduler_data.xml +++ b/easy_my_coop_taxshelter_report/data/scheduler_data.xml @@ -3,14 +3,13 @@ Tax shelter mail batch mail - + + code + model.batch_send_tax_shelter_certificate() 1 hours -1 - - - - + - \ No newline at end of file + diff --git a/easy_my_coop_taxshelter_report/i18n/fr_BE.po b/easy_my_coop_taxshelter_report/i18n/fr_BE.po index 6e3b616..b0786ad 100644 --- a/easy_my_coop_taxshelter_report/i18n/fr_BE.po +++ b/easy_my_coop_taxshelter_report/i18n/fr_BE.po @@ -593,7 +593,7 @@ msgstr "Montant total" #. module: easy_my_coop_taxshelter_report #: model:ir.model.fields,field_description:easy_my_coop_taxshelter_report.field_tax_shelter_certificate_total_amount_eligible -msgid "Total amount eligible To Tax shelter" +msgid "Total eligible amount" msgstr "Montant total éligible au Tax Shelter" #. module: easy_my_coop_taxshelter_report diff --git a/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py b/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py index 1364b0b..cd33bc1 100644 --- a/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py +++ b/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py @@ -280,7 +280,7 @@ class TaxShelterCertificate(models.Model): certificate.total_amount_resold = total_amount_resold certificate.total_amount = certificate.total_amount_previously_subscribed + certificate.total_amount_subscribed + certificate.total_amount_resold + certificate.total_amount_transfered - @api.multi + @api.depends('lines') def _compute_certificate_lines(self): for certificate in self: certificate.previously_subscribed_lines = certificate.lines.filtered(lambda r: r.type == 'subscribed' and r.transaction_date < certificate.declaration_id.date_from) From 4842b52e960d65aec5c63ead3d9cc6211532964a Mon Sep 17 00:00:00 2001 From: Elouan Le Bars Date: Thu, 14 Nov 2019 15:24:30 +0100 Subject: [PATCH 04/20] [MIG] emc_taxshelter_report : change access rules from energiris to easy_my_coop --- .../security/ir.model.access.csv | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/easy_my_coop_taxshelter_report/security/ir.model.access.csv b/easy_my_coop_taxshelter_report/security/ir.model.access.csv index 92e0a57..f17ad41 100644 --- a/easy_my_coop_taxshelter_report/security/ir.model.access.csv +++ b/easy_my_coop_taxshelter_report/security/ir.model.access.csv @@ -1,7 +1,7 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_tax_shelter_declaration,tax.shelter.declaration,model_tax_shelter_declaration,easy_my_coop.group_energiris_user,1,0,0,0 -access_tax_shelter_declaration,tax.shelter.declaration,model_tax_shelter_declaration,easy_my_coop.group_energiris_manager,1,1,1,1 -access_tax_shelter_certificate,tax.shelter.certificate,model_tax_shelter_certificate,easy_my_coop.group_energiris_user,1,0,0,0 -access_tax_shelter_certificate,tax.shelter.certificate,model_tax_shelter_certificate,easy_my_coop.group_energiris_manager,1,1,1,1 -access_certificate_line,certificate.line,model_certificate_line,easy_my_coop.group_energiris_user,1,0,0,0 -access_certificate_line,certificate.line,model_certificate_line,easy_my_coop.group_energiris_manager,1,1,1,1 \ No newline at end of file +access_tax_shelter_declaration,tax.shelter.declaration,model_tax_shelter_declaration,easy_my_coop.group_easy_my_coop_user,1,0,0,0 +access_tax_shelter_declaration,tax.shelter.declaration,model_tax_shelter_declaration,easy_my_coop.group_easy_my_coop_manager,1,1,1,1 +access_tax_shelter_certificate,tax.shelter.certificate,model_tax_shelter_certificate,easy_my_coop.group_easy_my_coop_user,1,0,0,0 +access_tax_shelter_certificate,tax.shelter.certificate,model_tax_shelter_certificate,easy_my_coop.group_easy_my_coop_manager,1,1,1,1 +access_certificate_line,certificate.line,model_certificate_line,easy_my_coop.group_easy_my_coop_user,1,0,0,0 +access_certificate_line,certificate.line,model_certificate_line,easy_my_coop.group_easy_my_coop_manager,1,1,1,1 From e4a42b6ca10bef7023e32a31dbecf239e64d28aa Mon Sep 17 00:00:00 2001 From: Elouan Le Bars Date: Thu, 14 Nov 2019 18:19:13 +0100 Subject: [PATCH 05/20] [ADD] emc_taxshelter_report : demo datas --- .../__manifest__.py | 3 ++ .../demo/tax_shelter_demo.xml | 40 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 easy_my_coop_taxshelter_report/demo/tax_shelter_demo.xml diff --git a/easy_my_coop_taxshelter_report/__manifest__.py b/easy_my_coop_taxshelter_report/__manifest__.py index 1dceb4b..dbdf468 100644 --- a/easy_my_coop_taxshelter_report/__manifest__.py +++ b/easy_my_coop_taxshelter_report/__manifest__.py @@ -40,5 +40,8 @@ 'data/mail_template_data.xml', 'data/scheduler_data.xml', ], + 'demo': [ + 'demo/tax_shelter_demo.xml', + ], 'installable': True, } diff --git a/easy_my_coop_taxshelter_report/demo/tax_shelter_demo.xml b/easy_my_coop_taxshelter_report/demo/tax_shelter_demo.xml new file mode 100644 index 0000000..fecc9a4 --- /dev/null +++ b/easy_my_coop_taxshelter_report/demo/tax_shelter_demo.xml @@ -0,0 +1,40 @@ + + + + + 2019 + 2018 + 2018-01-01 + 2018-12-31 + January + December + 45 + validated + 143875.00 + 0.00 + + + + 1 + + + sent + + + + + + 25 + 12 + + + subscribed + + + + + + From 6d6471d7e5a6c115369dfb3a4378d31a1f74521c Mon Sep 17 00:00:00 2001 From: Elouan Le Bars Date: Fri, 14 Feb 2020 12:09:33 +0100 Subject: [PATCH 06/20] [MIG] easy_my_coop_taxshelter_report : adapt to version 12.0 --- .../models/tax_shelter_declaration.py | 20 +++-- .../reports/tax_shelter_resold_report.xml | 81 ++++++------------ .../reports/tax_shelter_shares_report.xml | 83 ++++++------------- .../tax_shelter_subscription_report.xml | 82 ++++++------------ 4 files changed, 84 insertions(+), 182 deletions(-) diff --git a/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py b/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py index cd33bc1..50ec191 100644 --- a/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py +++ b/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py @@ -237,15 +237,17 @@ class TaxShelterCertificate(models.Model): certificate.state = 'no_eligible' self.env.cr.commit() - @api.multi - def print_subscription_certificate(self): - self.ensure_one() - return self.env['report'].get_action(self, 'easy_my_coop_taxshelter_report.tax_shelter_subscription_report') - - @api.multi - def print_shares_certificate(self): - self.ensure_one() - return self.env['report'].get_action(self, 'easy_my_coop_taxshelter_report.tax_shelter_shares_report') + @api.multi + def print_subscription_certificate(self): + self.ensure_one() + report = self.env.ref("easy_my_coop_taxshelter_report.action_tax_shelter_subscription_report") + return report.report_action(self) + + @api.multi + def print_shares_certificate(self): + self.ensure_one() + report = self.env.ref("easy_my_coop_taxshelter_report.action_tax_shelter_shares_report") + return report.report_action(self) @api.multi def _compute_amounts(self): diff --git a/easy_my_coop_taxshelter_report/reports/tax_shelter_resold_report.xml b/easy_my_coop_taxshelter_report/reports/tax_shelter_resold_report.xml index e5abd65..21faf8d 100644 --- a/easy_my_coop_taxshelter_report/reports/tax_shelter_resold_report.xml +++ b/easy_my_coop_taxshelter_report/reports/tax_shelter_resold_report.xml @@ -2,74 +2,42 @@ - + diff --git a/easy_my_coop_taxshelter_report/reports/tax_shelter_shares_report.xml b/easy_my_coop_taxshelter_report/reports/tax_shelter_shares_report.xml index 21f311c..5f6134b 100644 --- a/easy_my_coop_taxshelter_report/reports/tax_shelter_shares_report.xml +++ b/easy_my_coop_taxshelter_report/reports/tax_shelter_shares_report.xml @@ -2,75 +2,43 @@ - + diff --git a/easy_my_coop_taxshelter_report/reports/tax_shelter_subscription_report.xml b/easy_my_coop_taxshelter_report/reports/tax_shelter_subscription_report.xml index 4cec67e..5b46546 100644 --- a/easy_my_coop_taxshelter_report/reports/tax_shelter_subscription_report.xml +++ b/easy_my_coop_taxshelter_report/reports/tax_shelter_subscription_report.xml @@ -2,74 +2,41 @@ - + From c9eff8a827817650c47b4aca59decfab5ab4e054 Mon Sep 17 00:00:00 2001 From: Manuel Claeys Bouuaert Date: Fri, 21 Feb 2020 21:15:48 +0100 Subject: [PATCH 07/20] [FIX] emc_taxshelter_report: adapt to v12 report functions --- .../models/tax_shelter_declaration.py | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py b/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py index 50ec191..e2800f0 100644 --- a/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py +++ b/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py @@ -10,11 +10,11 @@ TYPE_MAP = { REPORT_DIC = { 'subscription': ( - 'easy_my_coop_taxshelter_report.tax_shelter_subscription_report', + 'easy_my_coop_taxshelter_report.action_tax_shelter_subscription_report', 'Tax Shelter Subscription' ), 'shares': ( - 'easy_my_coop_taxshelter_report.tax_shelter_shares_report', + 'easy_my_coop_taxshelter_report.action_tax_shelter_shares_report', 'Tax Shelter Shares' ) } @@ -23,6 +23,7 @@ REPORT_DIC = { class TaxShelterDeclaration(models.Model): _name = "tax.shelter.declaration" + _description = "Tax Shelter Declaration" name = fields.Char(string='Declaration year', required=True) fiscal_year = fields.Char(String="Fiscal year", required=True) @@ -149,7 +150,7 @@ class TaxShelterDeclaration(models.Model): class TaxShelterCertificate(models.Model): _name = "tax.shelter.certificate" - + _description = "Tax Shelter Certificate" _order = "cooperator_number asc" cooperator_number = fields.Integer(string='Cooperator number', @@ -164,7 +165,7 @@ class TaxShelterCertificate(models.Model): string='State', required=True, default="draft") declaration_id = fields.Many2one('tax.shelter.declaration', string='Declaration', required=True, - readonly=True) + readonly=True, ondelete="restrict") lines = fields.One2many('certificate.line', 'tax_shelter_certificate', string='Certificate lines', readonly=True) @@ -207,8 +208,8 @@ class TaxShelterCertificate(models.Model): string="Company") def generate_pdf_report(self, report_type): - report_action, name = REPORT_DIC[report_type] - report = self.env['report'].get_pdf(self, report_action) + report, name = REPORT_DIC[report_type] + report = self.env.ref(report).render_qweb_pdf(self) report = base64.b64encode(report) report_name = self.partner_id.name + ' ' + name + ' ' + self.declaration_id.name + '.pdf' @@ -237,17 +238,17 @@ class TaxShelterCertificate(models.Model): certificate.state = 'no_eligible' self.env.cr.commit() - @api.multi - def print_subscription_certificate(self): - self.ensure_one() - report = self.env.ref("easy_my_coop_taxshelter_report.action_tax_shelter_subscription_report") - return report.report_action(self) - - @api.multi - def print_shares_certificate(self): - self.ensure_one() - report = self.env.ref("easy_my_coop_taxshelter_report.action_tax_shelter_shares_report") - return report.report_action(self) + @api.multi + def print_subscription_certificate(self): + self.ensure_one() + report, name = REPORT_DIC['subscription'] + return self.env.ref(report).report_action(self) + + @api.multi + def print_shares_certificate(self): + self.ensure_one() + report, name = REPORT_DIC['shares'] + return self.env.ref(report).report_action(self) @api.multi def _compute_amounts(self): @@ -300,6 +301,7 @@ class TaxShelterCertificate(models.Model): class TaxShelterCertificateLine(models.Model): _name = "certificate.line" + _description = "Tax Shelter Certificate Line" declaration_id = fields.Many2one(related='tax_shelter_certificate.declaration_id', string="Declaration") From 3c409e707f3bbd5ac7b8851bf98050f8e828fb55 Mon Sep 17 00:00:00 2001 From: Manuel Claeys Bouuaert Date: Fri, 21 Feb 2020 21:16:31 +0100 Subject: [PATCH 08/20] [FIX] emc_taxshelter_report: WIP fix bootstrap 4 compatibility --- .../reports/tax_shelter_subscription_report.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/easy_my_coop_taxshelter_report/reports/tax_shelter_subscription_report.xml b/easy_my_coop_taxshelter_report/reports/tax_shelter_subscription_report.xml index 5b46546..2c3554d 100644 --- a/easy_my_coop_taxshelter_report/reports/tax_shelter_subscription_report.xml +++ b/easy_my_coop_taxshelter_report/reports/tax_shelter_subscription_report.xml @@ -3,9 +3,9 @@