diff --git a/report/close_statement.fodt b/report/close_statement.fodt
index 110623d..5869ea6 100644
--- a/report/close_statement.fodt
+++ b/report/close_statement.fodt
@@ -1,24 +1,24 @@
- LibreOffice/7.0.4.2$Linux_X86_64 LibreOffice_project/00$Build-22008-06-07T15:28:222009-01-10T16:03:331PT0S
+ LibreOffice/7.0.4.2$Linux_X86_64 LibreOffice_project/00$Build-22008-06-07T15:28:222009-01-10T16:03:331PT0S
- 5263
+ 9620
0
15843
- 7299
+ 7410
true
false
view2
- 6846
- 7574
+ 5671
+ 11726
0
- 5263
+ 9620
15841
- 12561
+ 17029
0
0
false
@@ -85,7 +85,7 @@
true
true
- 2335270
+ 2365837
true
false
@@ -140,7 +140,6 @@
-
@@ -155,7 +154,7 @@
-
+
@@ -350,6 +349,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -370,57 +384,77 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -492,8 +526,8 @@
-
-
+
+
/9j/4AAQSkZJRgABAQEAYABgAAD/4S6eRXhpZgAATU0AKgAAAAgABgALAAIAAAAmAAAIYgES
AAMAAAABAAEAAAExAAIAAAAmAAAIiAEyAAIAAAAUAAAIrodpAAQAAAABAAAIwuocAAcAAAgM
AAAAVgAAEUYc6gAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
@@ -1640,54 +1674,91 @@
-
- NIT: 901575528
- Regimen Común
- TRANSV 46 E 42 ESTE 789 32667
- SANTA ELENA
- Cel: 3014287624
-
-
+
+ NIT: 901575528
+ Regimen Común
+ TRANSV 46 E 42 ESTE 789 32667
+ SANTA ELENA
+ Cel: 3014287624
+
+
- Base
+ Base
- Impuestos
+ Impuestos
- Total
+ Total
- <untaxed_amount>
+ <untaxed_amount>
- <tax_amount>
+ <tax_amount>
- <total_amount>
+ <total_amount>
-
+
- Pizzas vendidas
+ Pizzas vendidas
- <number_pizzas_sold>
+ <number_pizzas_sold>
+
+
+
+
+
+ Extractos del día
+
+
+
+
+
+
+ <for each="statement in statements">
+
+
+
+
+
+
+ <statement['name']>
+
+
+ <statement['total_amount']>
+
+
+
+
+
+
+
+ </for>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/report_close_statement.py b/report_close_statement.py
index 8ed4339..f5ab2e5 100644
--- a/report_close_statement.py
+++ b/report_close_statement.py
@@ -57,13 +57,31 @@ class CashRegister(Report):
"Extracto"
__name__ = 'sale.cash_register'
- def get_number_pizzas_sold(lines):
+ def _get_number_pizzas_sold(lines):
pizzas = 0
for line in lines:
- if line.bougth_pizza:
+ if line.bought_pizza:
pizzas += line.quantity
return pizzas
+ def _get_statements_by_date(date):
+ pool = Pool()
+ User = pool.get('res.user')
+ Statement = pool.get('account.statement')
+ user = Transaction().user
+ user = User(user)
+ device = user.sale_device
+
+ if not device:
+ return
+ journals = [j.id for j in device.journals]
+ statements = Statement.search([
+ ('journal', 'in', journals),
+ ('state', 'in', ['validated', 'posted']),
+ ('date', '=', date)
+ ])
+ return statements
+
@classmethod
def get_context(cls, records, header, data):
report_context = super(
@@ -79,21 +97,26 @@ class CashRegister(Report):
if not today_sales:
return
-
untaxed_amount = 0
tax_amount = 0
total_amount = 0
number_pizzas_sold = 0
-
for sale in today_sales:
untaxed_amount += sale.untaxed_amount
tax_amount += sale.tax_amount
- number_pizzas_sold += cls.get_number_pizzas_sold(sale.lines)
+ number_pizzas_sold += cls._get_number_pizzas_sold(sale.lines)
total_amount+=sale.total_amount
+ statements = cls._get_statements_by_date(data['date'])
+
+ if statements:
+ report_context['statements'] = [{
+ 'name': statement.journal.name,
+ 'total_amount':statement.total_amount
+ } for statement in statements]
+
report_context['untaxed_amount'] = untaxed_amount
report_context['tax_amount'] = tax_amount
report_context['total_amount'] = total_amount
report_context['number_pizzas_sold'] = number_pizzas_sold
-
return report_context
diff --git a/sale.py b/sale.py
index 4d98998..b5e48ab 100644
--- a/sale.py
+++ b/sale.py
@@ -329,7 +329,7 @@ class Line(metaclass=PoolMeta):
pizza = fields.Integer("Pizza")
impreso = fields.Boolean("Impreso")
- bougth_pizza = fields.Boolean("Sold pizza")
+ bought_pizza = fields.Boolean("Sold pizza")
@fields.depends('product', 'unit', 'sale',
'_parent_sale.party', '_parent_sale.invoice_party',
@@ -340,9 +340,9 @@ class Line(metaclass=PoolMeta):
super(Line, self).on_change_product()
if self.product and self.product.pizza:
self.pizza = self.sale.pizza_number
- self.bougth_pizza = True
+ self.bought_pizza = True
else:
- self.bougth_pizza = False
+ self.bought_pizza = False
def get_production(self):
"Return production for the sale line"
diff --git a/view/sale_line_form.xml b/view/sale_line_form.xml
index 7364776..5a0105a 100644
--- a/view/sale_line_form.xml
+++ b/view/sale_line_form.xml
@@ -7,7 +7,7 @@
-
-
+
+