From 2764390d4070e95fc840a96379596e261c3435d8 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 15 May 2023 14:29:40 +0200 Subject: [PATCH] Add module account_product_fiscal_classification_sale --- .../__init__.py | 1 + .../__manifest__.py | 32 +++++++++++++++++++ .../report/__init__.py | 1 + .../report/sale_report.py | 25 +++++++++++++++ .../report/sale_report_view.xml | 20 ++++++++++++ 5 files changed, 79 insertions(+) create mode 100644 account_product_fiscal_classification_sale/__init__.py create mode 100644 account_product_fiscal_classification_sale/__manifest__.py create mode 100644 account_product_fiscal_classification_sale/report/__init__.py create mode 100644 account_product_fiscal_classification_sale/report/sale_report.py create mode 100644 account_product_fiscal_classification_sale/report/sale_report_view.xml diff --git a/account_product_fiscal_classification_sale/__init__.py b/account_product_fiscal_classification_sale/__init__.py new file mode 100644 index 0000000..4c4f242 --- /dev/null +++ b/account_product_fiscal_classification_sale/__init__.py @@ -0,0 +1 @@ +from . import report diff --git a/account_product_fiscal_classification_sale/__manifest__.py b/account_product_fiscal_classification_sale/__manifest__.py new file mode 100644 index 0000000..e9eec71 --- /dev/null +++ b/account_product_fiscal_classification_sale/__manifest__.py @@ -0,0 +1,32 @@ +# Copyright 2023 Akretion France (http://www.akretion.com/) +# @author: Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'Account Product Fiscal Classification - Sale', + 'version': '16.0.1.0.0', + 'category': 'Sales', + 'license': 'AGPL-3', + 'summary': 'Glue module between account_product_fiscal_classification and sale', + 'description': """ +This module adds a **Start Date** and **End Date** field on invoice +lines. For example, if you have an insurance contrat for your company +that run from April 1st 2013 to March 31st 2014, you will enter these +dates as start and end dates on the supplier invoice line. If your +fiscal year ends on December 31st 2013, 3 months of expenses are part of +the 2014 fiscal year and should not be part of the 2013 fiscal year. So, +thanks to this module, you will create a *Prepaid Expense* on December +31st 2013 and OpenERP will identify this expense with the 3 months that +are after the cut-off date and propose to generate the appropriate +cut-off journal entry. + +This module has been written by Alexis de Lattre from Akretion +. + """, + 'author': 'Akretion', + 'maintainers': ['alexis-via'], + 'website': 'https://github.com/akretion/odoo-usability', + 'depends': ['sale', 'account_product_fiscal_classification'], + "data": ['report/sale_report_view.xml'], + 'auto_install': True, +} diff --git a/account_product_fiscal_classification_sale/report/__init__.py b/account_product_fiscal_classification_sale/report/__init__.py new file mode 100644 index 0000000..cd23411 --- /dev/null +++ b/account_product_fiscal_classification_sale/report/__init__.py @@ -0,0 +1 @@ +from . import sale_report diff --git a/account_product_fiscal_classification_sale/report/sale_report.py b/account_product_fiscal_classification_sale/report/sale_report.py new file mode 100644 index 0000000..5e4e980 --- /dev/null +++ b/account_product_fiscal_classification_sale/report/sale_report.py @@ -0,0 +1,25 @@ +# Copyright 2023 Akretion France (http://www.akretion.com) +# @author Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class SaleReport(models.Model): + _inherit = "sale.report" + + fiscal_classification_id = fields.Many2one( + "account.product.fiscal.classification", + string="Product Fiscal Classification", + readonly=True, + ) + + def _select_additional_fields(self): + res = super()._select_additional_fields() + res["fiscal_classification_id"] = "t.fiscal_classification_id" + return res + + def _group_by_sale(self): + res = super()._group_by_sale() + res += ", t.fiscal_classification_id" + return res diff --git a/account_product_fiscal_classification_sale/report/sale_report_view.xml b/account_product_fiscal_classification_sale/report/sale_report_view.xml new file mode 100644 index 0000000..5ba975b --- /dev/null +++ b/account_product_fiscal_classification_sale/report/sale_report_view.xml @@ -0,0 +1,20 @@ + + + + + + + sale.report + + + + + + + + +