diff --git a/setup/shopinvader_sale_report/odoo/__init__.py b/setup/shopinvader_sale_report/odoo/__init__.py new file mode 100644 index 0000000000..de40ea7ca0 --- /dev/null +++ b/setup/shopinvader_sale_report/odoo/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/shopinvader_sale_report/odoo/addons/__init__.py b/setup/shopinvader_sale_report/odoo/addons/__init__.py new file mode 100644 index 0000000000..de40ea7ca0 --- /dev/null +++ b/setup/shopinvader_sale_report/odoo/addons/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/shopinvader_sale_report/odoo/addons/shopinvader_sale_report b/setup/shopinvader_sale_report/odoo/addons/shopinvader_sale_report new file mode 120000 index 0000000000..b78ecaf5e3 --- /dev/null +++ b/setup/shopinvader_sale_report/odoo/addons/shopinvader_sale_report @@ -0,0 +1 @@ +../../../../shopinvader_sale_report \ No newline at end of file diff --git a/setup/shopinvader_sale_report/setup.py b/setup/shopinvader_sale_report/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/shopinvader_sale_report/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/shopinvader_sale_report/__init__.py b/shopinvader_sale_report/__init__.py new file mode 100644 index 0000000000..d894b79947 --- /dev/null +++ b/shopinvader_sale_report/__init__.py @@ -0,0 +1,3 @@ +# Copyright 2019 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from . import reports diff --git a/shopinvader_sale_report/__manifest__.py b/shopinvader_sale_report/__manifest__.py new file mode 100644 index 0000000000..08d3e68b03 --- /dev/null +++ b/shopinvader_sale_report/__manifest__.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + 'name': "Shopinvader sale report", + 'description': """Shopinvader addons to extend sale report with backend""", + 'author': 'ACSONE SA/NV', + 'website': "http://acsone.eu", + 'category': 'e-commerce', + 'version': '10.0.1.0.0', + 'license': 'AGPL-3', + 'depends': [ + 'sale', + 'shopinvader', + ], +} diff --git a/shopinvader_sale_report/reports/__init__.py b/shopinvader_sale_report/reports/__init__.py new file mode 100644 index 0000000000..da40575f35 --- /dev/null +++ b/shopinvader_sale_report/reports/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from . import sale_report diff --git a/shopinvader_sale_report/reports/sale_report.py b/shopinvader_sale_report/reports/sale_report.py new file mode 100644 index 0000000000..b853d739f4 --- /dev/null +++ b/shopinvader_sale_report/reports/sale_report.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from odoo import api, fields, models + + +class SaleReport(models.Model): + _inherit = 'sale.report' + + shopinvader_backend_id = fields.Many2one( + comodel_name="shopinvader.backend", + string="Shopinvader backend", + ) + + @api.model + def _select(self): + select_query = super(SaleReport, self)._select() + select_backend = "s.shopinvader_backend_id AS shopinvader_backend_id" + select_query += ", " + select_backend + return select_query + + @api.model + def _group_by(self): + group_by_query = super(SaleReport, self)._group_by() + group_by_query += ", s.shopinvader_backend_id" + return group_by_query