diff --git a/__init__.py b/__init__.py
index 5412125..50b208d 100644
--- a/__init__.py
+++ b/__init__.py
@@ -17,6 +17,7 @@ def register():
report_close_statement.ReportCloseStatementStart,
report.ReportSaleProduct,
report.ReportSaleByUser,
+ report.ReportSaleByZone,
report.ReportSaleContext,
module='sale_fast_food', type_='model')
Pool.register(
diff --git a/locale/es.po b/locale/es.po
index 8749141..1b8e810 100644
--- a/locale/es.po
+++ b/locale/es.po
@@ -82,6 +82,14 @@ msgctxt "model:ir.ui.menu,name:menu_sale_fast_food_by_user"
msgid "Sales by User"
msgstr "Ventas Por Usuario"
+msgctxt "model:ir.action,name:act_report_sale_fast_food_zone"
+msgid "Sales by User"
+msgstr "Ventas Por Usuario"
+
+msgctxt "model:ir.ui.menu,name:menu_sale_fast_food_zone"
+msgid "Sales by Zone"
+msgstr "Ventas Por Zona"
+
msgctxt "field:sale_fast_food.reporting.product,product_pizza:"
msgid "Product"
msgstr "Pizza"
@@ -114,6 +122,34 @@ msgctxt "field:sale_fast_food.reporting.by_user,total_tip_amount:"
msgid "Total Tip Amount"
msgstr "Propinas"
+msgctxt "field:sale_fast_food.reporting.zone,zone:"
+msgid "Zone"
+msgstr "Zona"
+
+msgctxt "field:sale_fast_food.reporting.zone,table:"
+msgid "Table"
+msgstr "Mesa"
+
+msgctxt "field:sale_fast_food.reporting.zone,completed_sales:"
+msgid "Completed Sales"
+msgstr "# Ventas"
+
+msgctxt "field:sale_fast_food.reporting.zone,untaxed_amount:"
+msgid "Untaxed Amount"
+msgstr "Base Imponible"
+
+msgctxt "field:sale_fast_food.reporting.zone,tax_amount:"
+msgid "Tax Amount"
+msgstr "Impuestos"
+
+msgctxt "field:sale_fast_food.reporting.zone,total_amount:"
+msgid "Total Amount"
+msgstr "Total"
+
+msgctxt "field:sale_fast_food.reporting.zone,total_tip_amount:"
+msgid "Total Tip Amount"
+msgstr "Propinas"
+
msgctxt "wizard_button:sale.print_cash_register,start,end:"
msgid "Cancel"
msgstr "Cancelar"
diff --git a/report.py b/report.py
index 5509608..0755ef1 100644
--- a/report.py
+++ b/report.py
@@ -206,3 +206,75 @@ class ReportSaleByUser(ReportSaleAbstract, ModelView):
def _column_id(cls, tables):
sale = tables['sale.sale']
return Min(sale.id)
+
+
+class ReportSaleByZone(ReportSaleAbstract, ModelView):
+ """Report Sale Group by Zone"""
+ __name__ = 'sale_fast_food.reporting.zone'
+
+ zone = fields.Many2One('sale.zone', "Zone")
+ table = fields.Many2One('sale.table', "Table")
+ completed_sales = fields.Integer("Completed Sales")
+ untaxed_amount = fields.Numeric(
+ "Untaxed Amount", digits='currency', readonly=True)
+ tax_amount = fields.Numeric(
+ "Tax Amount", digits='currency', readonly=True)
+ total_amount = fields.Numeric(
+ "Total Amount", digits='currency', readonly=True)
+ total_tip_amount = fields.Numeric(
+ "Total Tip Amount", digits='currency', readonly=True)
+ currency = fields.Many2One(
+ 'currency.currency', 'Currency', required=True)
+
+ @classmethod
+ def _joins(cls):
+ pool = Pool()
+ tables = {}
+
+ Sale = pool.get('sale.sale')
+ tables['sale.sale'] = sale = Sale.__table__()
+
+ Table = pool.get('sale.table')
+ tables['sale.table'] = table = Table.__table__()
+
+ Zone = pool.get('sale.zone')
+ tables['sale.table'] = zone = Zone.__table__()
+
+ from_item = sale.left_join(
+ table,
+ condition=table.id == sale.table
+ ).left_join(
+ zone,
+ condition=zone.id == table.zone
+ )
+
+ return from_item, tables
+
+ @classmethod
+ def _columns(cls, tables):
+ sale = tables['sale.sale']
+ return super(ReportSaleByZone, cls)._columns(tables) + [
+ sale.zone.as_('zone'),
+ sale.table.as_('table'),
+ Count(Literal(1)).as_('completed_sales'),
+ Sum(sale.untaxed_amount_cache).as_('untaxed_amount'),
+ Sum(sale.tax_amount_cache).as_('tax_amount'),
+ Sum(sale.total_amount_cache).as_('total_amount'),
+ Sum(sale.total_tip_cache).as_('total_tip_amount'),
+ sale.currency.as_('currency'),
+ ]
+
+ @classmethod
+ def _group_by(cls, tables):
+ sale = tables['sale.sale']
+
+ return [
+ sale.zone,
+ sale.table,
+ sale.currency
+ ]
+
+ @classmethod
+ def _column_id(cls, tables):
+ sale = tables['sale.sale']
+ return Min(sale.id)
diff --git a/report.xml b/report.xml
index bf47690..681e2e0 100644
--- a/report.xml
+++ b/report.xml
@@ -47,6 +47,25 @@ this repository contains the full copyright notices and license terms. -->
+
+
+ sale_fast_food.reporting.zone
+ tree
+ sales_by_zone_list
+
+
+
+ Sales by Zone
+ sale_fast_food.reporting.zone
+ sale_fast_food.report.context
+
+
+
+
+
+
+
+