diff --git a/product_brand_pos_report/__init__.py b/product_brand_pos_report/__init__.py new file mode 100644 index 00000000..b4edecf6 --- /dev/null +++ b/product_brand_pos_report/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import reports diff --git a/product_brand_pos_report/__manifest__.py b/product_brand_pos_report/__manifest__.py new file mode 100644 index 00000000..9d253628 --- /dev/null +++ b/product_brand_pos_report/__manifest__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 PlanetaTIC - Marc Poch +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'Product Brand POS Report', + 'summary': 'Product Brand in Point of Sale Report', + 'version': '10.0.1.0.0', + 'description': 'Show product Brand in pos order report', + 'category': 'Point Of Sale', + 'author': 'PlanetaTIC', + 'website': 'https://www.planetatic.com', + 'license': 'AGPL-3', + 'application': False, + 'installable': True, + 'depends': [ + 'point_of_sale', + 'product_brand', + ], + 'data': [ + 'reports/pos_order_report_view.xml', + ], +} diff --git a/product_brand_pos_report/i18n/es.po b/product_brand_pos_report/i18n/es.po new file mode 100644 index 00000000..63b3a005 --- /dev/null +++ b/product_brand_pos_report/i18n/es.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_brand_pos_report +# +# Translators: +# PlanetaTIC - Marc Poch , 2019 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-04-03 18:07+0000\n" +"PO-Revision-Date: 2018-04-03 18:07+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: product_brand_pos_report +#: model:ir.model.fields,field_description:product_brand_pos_report.field_report_pos_order_product_brand_id +#: model:ir.ui.view,arch_db:product_brand_pos_report.view_report_pos_order_search +msgid "Brand" +msgstr "Marca" + +#. module: product_brand_pos_report +#: model:ir.model,name:product_brand_pos_report.model_report_pos_order +msgid "Point of Sale Orders Statistics" +msgstr "Punto de venta. Estadísticas pedidos" + diff --git a/product_brand_pos_report/i18n/product_brand_sale_report.pot b/product_brand_pos_report/i18n/product_brand_sale_report.pot new file mode 100644 index 00000000..70d770f4 --- /dev/null +++ b/product_brand_pos_report/i18n/product_brand_sale_report.pot @@ -0,0 +1,26 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_brand_sale_report +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0c\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: product_brand_sale_report +#: model:ir.model.fields,field_description:product_brand_sale_report.field_sale_report_product_brand_id +#: model:ir.ui.view,arch_db:product_brand_sale_report.view_order_product_search +msgid "Brand" +msgstr "" + +#. module: product_brand_sale_report +#: model:ir.model,name:product_brand_sale_report.model_sale_report +msgid "Sales Orders Statistics" +msgstr "" + diff --git a/product_brand_pos_report/readme/CONTRIBUTORS.rst b/product_brand_pos_report/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..935cbb3d --- /dev/null +++ b/product_brand_pos_report/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Marc Poch Mallandrich diff --git a/product_brand_pos_report/readme/DESCRIPTION.rst b/product_brand_pos_report/readme/DESCRIPTION.rst new file mode 100644 index 00000000..69c227a1 --- /dev/null +++ b/product_brand_pos_report/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Show product Brand in pos order report \ No newline at end of file diff --git a/product_brand_pos_report/reports/__init__.py b/product_brand_pos_report/reports/__init__.py new file mode 100644 index 00000000..1c73aa09 --- /dev/null +++ b/product_brand_pos_report/reports/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import pos_order_report diff --git a/product_brand_pos_report/reports/pos_order_report.py b/product_brand_pos_report/reports/pos_order_report.py new file mode 100644 index 00000000..fe88da0a --- /dev/null +++ b/product_brand_pos_report/reports/pos_order_report.py @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 PlanetaTIC - Marc Poch +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from openerp import api, fields, models, tools + + +class PosOrderReport(models.Model): + _inherit = "report.pos.order" + _auto = False + + config_id = fields.Many2one('pos.config', string='Point of Sale', + readonly=True) + product_brand_id = fields.Many2one( + 'product.brand', + string='Brand', + ) + + @api.model_cr + def init(self): + tools.drop_view_if_exists(self._cr, 'report_pos_order') + self._cr.execute(""" + CREATE OR REPLACE VIEW report_pos_order AS ( + SELECT + MIN(l.id) AS id, + COUNT(*) AS nbr_lines, + s.date_order AS date, + SUM(l.qty) AS product_qty, + SUM(l.qty * l.price_unit) AS price_sub_total, + SUM( +(l.qty * l.price_unit) * (100 - l.discount) / 100) AS price_total, + SUM( +(l.qty * l.price_unit) * (l.discount / 100)) AS total_discount, + (SUM( +l.qty*l.price_unit)/SUM(l.qty * u.factor))::decimal AS average_price, + SUM( +cast(to_char(date_trunc('day',s.date_order) - date_trunc( +'day',s.create_date),'DD') AS INT)) AS delay_validation, + s.id as order_id, + s.partner_id AS partner_id, + s.state AS state, + s.user_id AS user_id, + s.location_id AS location_id, + s.company_id AS company_id, + s.sale_journal AS journal_id, + l.product_id AS product_id, + pt.categ_id AS product_categ_id, + p.product_tmpl_id, + ps.config_id, + pt.pos_categ_id, + pc.stock_location_id, + s.pricelist_id, + s.session_id, + s.invoice_id IS NOT NULL AS invoiced, + pt.product_brand_id + FROM pos_order_line AS l + LEFT JOIN pos_order s ON (s.id=l.order_id) + LEFT JOIN product_product p ON (l.product_id=p.id) + LEFT JOIN product_template pt ON (p.product_tmpl_id=pt.id) + LEFT JOIN product_uom u ON (u.id=pt.uom_id) + LEFT JOIN pos_session ps ON (s.session_id=ps.id) + LEFT JOIN pos_config pc ON (ps.config_id=pc.id) + GROUP BY + s.id, s.date_order, s.partner_id,s.state, pt.categ_id, + s.user_id, s.location_id, s.company_id, s.sale_journal, + s.pricelist_id, s.invoice_id, s.create_date, s.session_id, + l.product_id, + pt.categ_id, pt.pos_categ_id, + p.product_tmpl_id, + ps.config_id, + pc.stock_location_id, + pt.product_brand_id + HAVING + SUM(l.qty * u.factor) != 0 + ) + """) diff --git a/product_brand_pos_report/reports/pos_order_report_view.xml b/product_brand_pos_report/reports/pos_order_report_view.xml new file mode 100644 index 00000000..35fd0463 --- /dev/null +++ b/product_brand_pos_report/reports/pos_order_report_view.xml @@ -0,0 +1,16 @@ + + + + + + + report.pos.order + + + + + + + + diff --git a/product_brand_pos_report/static/description/icon.png b/product_brand_pos_report/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/product_brand_pos_report/static/description/icon.png differ