@@ -70,12 +70,12 @@
-
+
|
- Net Total:
+ Net Total
|
-
-
+ |
+
|
From 28fa8ebb8cb267ca3a30afba81aafb1eb9399894 Mon Sep 17 00:00:00 2001
From: Simon Lejeune
Date: Mon, 14 Apr 2014 16:44:27 +0200
Subject: [PATCH 04/10] [IMP] point of sale: added a session summary report
bzr revid: sle@openerp.com-20140414144427-ry3yxybx385a4pop
---
addons/point_of_sale/__openerp__.py | 1 +
addons/point_of_sale/point_of_sale_report.xml | 9 ++
.../views/report_sessionsummary.xml | 120 ++++++++++++++++++
3 files changed, 130 insertions(+)
create mode 100644 addons/point_of_sale/views/report_sessionsummary.xml
diff --git a/addons/point_of_sale/__openerp__.py b/addons/point_of_sale/__openerp__.py
index 9f3a023f062..ad82c7e05a6 100644
--- a/addons/point_of_sale/__openerp__.py
+++ b/addons/point_of_sale/__openerp__.py
@@ -77,6 +77,7 @@ Main Features
'views/report_saleslines.xml',
'views/report_detailsofsales.xml',
'views/report_payment.xml',
+ 'views/report_sessionsummary.xml',
],
'demo': [
'point_of_sale_demo.xml',
diff --git a/addons/point_of_sale/point_of_sale_report.xml b/addons/point_of_sale/point_of_sale_report.xml
index a4c1f4648a3..6ae4dbe9c30 100644
--- a/addons/point_of_sale/point_of_sale_report.xml
+++ b/addons/point_of_sale/point_of_sale_report.xml
@@ -58,5 +58,14 @@
name="point_of_sale.report_payment"
file="point_of_sale.report_payment"
/>
+
+
diff --git a/addons/point_of_sale/views/report_sessionsummary.xml b/addons/point_of_sale/views/report_sessionsummary.xml
new file mode 100644
index 00000000000..705b8bc93d0
--- /dev/null
+++ b/addons/point_of_sale/views/report_sessionsummary.xml
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+ Session Summary:
+
+
+
+ Responsible:
+
+
+
+ Point of Sale:
+
+
+
+ Opening Date:
+
+
+
+ Closing Date:
+
+
+
+
+
+
+
+ |
+ Reference
+ |
+
+ Journal
+ |
+
+ Starting Balance
+ |
+
+ Total Transactions
+ |
+
+ Ending Balance
+ |
+
+ Difference
+ |
+
+ Currency
+ |
+
+ Status
+ |
+
+
+
+
+
+ |
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+ |
+
+
+
+ |
+ |
+ |
+ |
+ Description |
+ Partner |
+ Type |
+ Amount |
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
From 7be29e97c44035b594c490a94215b0ac39bdca40 Mon Sep 17 00:00:00 2001
From: Simon Lejeune
Date: Mon, 14 Apr 2014 17:52:12 +0200
Subject: [PATCH 05/10] [IMP] Product pricelist converted to QWeb
bzr revid: sle@openerp.com-20140414155212-4l3gvys24prccln6
---
addons/product/__openerp__.py | 4 +-
addons/product/product_report.xml | 16 +-
addons/product/report/product_pricelist.py | 17 +-
addons/product/report/product_pricelist.rml | 266 --------------------
addons/product/views/report_pricelist.xml | 68 +++++
addons/product/wizard/product_price.py | 9 +-
6 files changed, 89 insertions(+), 291 deletions(-)
delete mode 100644 addons/product/report/product_pricelist.rml
create mode 100644 addons/product/views/report_pricelist.xml
diff --git a/addons/product/__openerp__.py b/addons/product/__openerp__.py
index c628fca6aa8..5b5e546fa61 100644
--- a/addons/product/__openerp__.py
+++ b/addons/product/__openerp__.py
@@ -59,7 +59,8 @@ Print product labels with barcode.
'product_view.xml',
'pricelist_view.xml',
'partner_view.xml',
- 'process/product_process.xml'
+ 'process/product_process.xml',
+ 'views/report_pricelist.xml',
],
'test': [
'product_pricelist_demo.yml',
@@ -69,4 +70,5 @@ Print product labels with barcode.
'auto_install': False,
'images': ['images/product_uom.jpeg','images/product_pricelists.jpeg','images/products_categories.jpeg', 'images/products_form.jpeg'],
}
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/product/product_report.xml b/addons/product/product_report.xml
index 791063696c4..5d2c3b99f62 100644
--- a/addons/product/product_report.xml
+++ b/addons/product/product_report.xml
@@ -2,14 +2,14 @@
-
diff --git a/addons/product/report/product_pricelist.py b/addons/product/report/product_pricelist.py
index 44433f39055..cd7054aa1a3 100644
--- a/addons/product/report/product_pricelist.py
+++ b/addons/product/report/product_pricelist.py
@@ -20,10 +20,9 @@
##############################################################################
import time
-
from openerp.osv import osv
from openerp.report import report_sxw
-from openerp.tools.translate import _
+
class product_pricelist(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
@@ -34,7 +33,6 @@ class product_pricelist(report_sxw.rml_parse):
'time': time,
'get_pricelist': self._get_pricelist,
'get_currency': self._get_currency,
- 'get_currency_symbol': self._get_currency_symbol, # TODO 7.0 - remove this - unused
'get_categories': self._get_categories,
'get_price': self._get_price,
'get_titles': self._get_titles,
@@ -69,12 +67,6 @@ class product_pricelist(report_sxw.rml_parse):
pricelist = self.pool.get('product.pricelist').read(self.cr, self.uid, [pricelist_id], ['currency_id'], context=self.localcontext)[0]
return pricelist['currency_id'][1]
- # TODO 7.0 - remove this method, its unused
- def _get_currency_symbol(self, pricelist_id):
- pricelist = self.pool.get('product.pricelist').read(self.cr, self.uid, [pricelist_id], ['currency_id'], context=self.localcontext)[0]
- symbol = self.pool.get('res.currency').read(self.cr, self.uid, [pricelist['currency_id'][0]], ['symbol'], context=self.localcontext)[0]
- return symbol['symbol'] or ''
-
def _get_categories(self, products, form):
cat_ids=[]
res=[]
@@ -120,4 +112,11 @@ class product_pricelist(report_sxw.rml_parse):
price = self.formatLang(res[0]['list_price'], digits=sale_price_digits, currency_obj=pricelist.currency_id)
return price
+
+class report_product_pricelist(osv.AbstractModel):
+ _name = 'report.product.report_pricelist'
+ _inherit = 'report.abstract_report'
+ _template = 'product.report_pricelist'
+ _wrapped_report_class = product_pricelist
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/product/report/product_pricelist.rml b/addons/product/report/product_pricelist.rml
deleted file mode 100644
index 62f1dc4ef4b..00000000000
--- a/addons/product/report/product_pricelist.rml
+++ /dev/null
@@ -1,266 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
- Description
- [[repeatIn(get_titles(data['form']), 'k')]]
- |
-
- [[ (k.has_key('qty1') and k['qty1']) or '' ]]
- |
-
- [[ (k.has_key('qty2') and k['qty2']) or '' ]]
- |
-
- [[ (k.has_key('qty3') and k['qty3']) or '' ]]
- |
-
- [[ (k.has_key('qty4') and k['qty4']) or '' ]]
- |
-
- [[ (k.has_key('qty5') and k['qty5']) or '' ]]
- |
-
-
-
-
-
-
- Price List
-
-
-
-
-
- |
- Price List Name
- |
-
- Currency
- |
-
- Printing Date
- |
-
-
-
-
- |
- [[ get_pricelist(data['form']['price_list']) ]]
- |
-
- [[ get_currency ( data['form']['price_list']) ]]
- |
-
- [[ formatLang(time.strftime('%Y-%m-%d'), date=True) ]]
- |
-
-
-
-
-
-
-
-
-
-
- |
- Description
- [[repeatIn(get_titles(data['form']), 'k')]]
- |
-
- [[ (k.has_key('qty1') and k['qty1']) or '' ]]
- |
-
- [[ (k.has_key('qty2') and k['qty2']) or '' ]]
- |
-
- [[ (k.has_key('qty3') and k['qty3']) or '' ]]
- |
-
- [[ (k.has_key('qty4') and k['qty4']) or '' ]]
- |
-
- [[ (k.has_key('qty5') and k['qty5']) or '' ]]
- |
-
-
-
- [[repeatIn(get_categories(objects,data['form']), 'c')]]
-
-
- |
- [[ c['name'] ]]
- |
-
-
-
-
- |
-
-
-
-
-
-
- [[repeatIn(c['products'], 'p')]]
-
-
- |
- [[ p['code'] and '[' + p['code'] + '] ' or '' ]] [[ p['name'] ]]
- |
-
- [[ (p.has_key('qty1') and p['qty1']) or '' ]]
- |
-
- [[ (p.has_key('qty2') and p['qty2']) or '' ]]
- |
-
- [[ (p.has_key('qty3') and p['qty3']) or '' ]]
- |
-
- [[ (p.has_key('qty4') and p['qty4']) or '' ]]
- |
-
- [[ (p.has_key('qty5') and p['qty5']) or '' ]]
- |
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/addons/product/views/report_pricelist.xml b/addons/product/views/report_pricelist.xml
new file mode 100644
index 00000000000..9b990f3c068
--- /dev/null
+++ b/addons/product/views/report_pricelist.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+ Price List
+
+
+
+ Price List Name:
+
+
+
+ Currency:
+
+
+
+ Print date:
+
+
+
+
+
+
+
+ |
+ Description
+ |
+
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+ |
+
+ |
+
+
+ |
+
+ []
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/product/wizard/product_price.py b/addons/product/wizard/product_price.py
index 5b5c4ccd834..b43bc74e8ec 100644
--- a/addons/product/wizard/product_price.py
+++ b/addons/product/wizard/product_price.py
@@ -20,7 +20,6 @@
##############################################################################
from openerp.osv import fields, osv
-from openerp.tools.translate import _
class product_price_list(osv.osv_memory):
@@ -55,10 +54,6 @@ class product_price_list(osv.osv_memory):
res = res and res[0] or {}
res['price_list'] = res['price_list'][0]
datas['form'] = res
- return {
- 'type': 'ir.actions.report.xml',
- 'report_name': 'product.pricelist',
- 'datas': datas,
- }
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+ return self.pool['report'].get_action(cr, uid, [], 'product.report_pricelist', data=datas, context=context)
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
From 0d6ea88e57a6d9f995c4cb812e62cd705e33688c Mon Sep 17 00:00:00 2001
From: Simon Lejeune
Date: Mon, 28 Apr 2014 18:20:32 +0200
Subject: [PATCH 06/10] [FIX] pos test reports: typo
bzr revid: sle@openerp.com-20140428162032-9s1s0wwxkboqeo2z
---
addons/point_of_sale/test/point_of_sale_report.yml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/addons/point_of_sale/test/point_of_sale_report.yml b/addons/point_of_sale/test/point_of_sale_report.yml
index 0dda85879c6..910afe54776 100644
--- a/addons/point_of_sale/test/point_of_sale_report.yml
+++ b/addons/point_of_sale/test/point_of_sale_report.yml
@@ -7,7 +7,7 @@
from openerp import tools
data, format = openerp.report.render_report(cr, uid, [ref('pos_order_pos1')], 'point_of_sale.report_invoice', {}, {})
if tools.config['test_report_directory']:
- file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-invoice report'+format), 'wb+').write(data)
+ file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-invoice_report.'+format), 'wb+').write(data)
-
In order to test the PDF reports defined on a Point Of Sale, we will print a POS Lines Report
@@ -18,7 +18,7 @@
from openerp import tools
data, format = openerp.report.render_report(cr, uid, [ref('pos_order_pos1')], 'point_of_sale.report_saleslines', {}, {})
if tools.config['test_report_directory']:
- file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-lines report'+format), 'wb+').write(data)
+ file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-lines_report.'+format), 'wb+').write(data)
-
In order to test the PDF reports defined on a Point of Sale, we will print a POS Receipt Report
@@ -29,7 +29,7 @@
from openerp import tools
data, format = openerp.report.render_report(cr, uid, [ref('pos_order_pos1')], 'point_of_sale.report_receipt', {}, {})
if tools.config['test_report_directory']:
- file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-receipt report'+format), 'wb+').write(data)
+ file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-receipt_report.'+format), 'wb+').write(data)
-
Print the POS Details Report through the wizard
@@ -51,4 +51,4 @@
from openerp import tools
data, format = openerp.report.render_report(cr, uid, [ref('pos_order_pos0')], 'point_of_sale.report_payment', {}, {})
if tools.config['test_report_directory']:
- file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-payment_report'+format), 'wb+').write(data)
+ file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-payment_report.'+format), 'wb+').write(data)
From 58233749eff6a7110e0d5f85a910372a30f9b485 Mon Sep 17 00:00:00 2001
From: Simon Lejeune
Date: Tue, 29 Apr 2014 12:07:38 +0200
Subject: [PATCH 07/10] [FIX] point of sale session summary report: better
display, divide the tables
bzr revid: sle@openerp.com-20140429100738-t5tvsucuu7ss42v8
---
.../views/report_sessionsummary.xml | 113 ++++++++++--------
1 file changed, 60 insertions(+), 53 deletions(-)
diff --git a/addons/point_of_sale/views/report_sessionsummary.xml b/addons/point_of_sale/views/report_sessionsummary.xml
index 705b8bc93d0..5f0f2617654 100644
--- a/addons/point_of_sale/views/report_sessionsummary.xml
+++ b/addons/point_of_sale/views/report_sessionsummary.xml
@@ -27,7 +27,9 @@
-
+ Statement Summary
+
+
|
@@ -57,60 +59,65 @@
|
-
-
- |
- |
-
-
- |
-
-
- |
-
-
- |
-
-
- |
-
-
- |
- |
-
-
-
- |
- |
- |
- |
- Description |
- Partner |
- Type |
- Amount |
-
-
- |
- |
- |
- |
- |
- |
- |
-
-
- |
-
-
-
+
+ |
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+ |
+
+
+
+ Statement Details:
+
+
+
+
+ | Date |
+ Description |
+ Reference |
+ Partner |
+ Type |
+ Account |
+ Amount |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+ |
+
+
+
+
From 8db594758ee67f49e67eeb9af18c11d0c7cfa93c Mon Sep 17 00:00:00 2001
From: Simon Lejeune
Date: Tue, 29 Apr 2014 13:40:45 +0200
Subject: [PATCH 08/10] [REM] point_of_sale: removed closed cashbox report that
is nearly the session resume report
bzr revid: sle@openerp.com-20140429114045-kaj86qq00dovj75o
---
addons/point_of_sale/__openerp__.py | 1 -
.../account_statement_report.xml | 8 -
addons/point_of_sale/report/__init__.py | 1 -
.../report/all_closed_cashbox_of_the_day.py | 147 ------------------
addons/point_of_sale/report/pos_report.py | 1 -
.../test/account_statement_reports.yml | 11 --
.../views/report_closedcashbox.xml | 68 --------
7 files changed, 237 deletions(-)
delete mode 100644 addons/point_of_sale/report/all_closed_cashbox_of_the_day.py
delete mode 100644 addons/point_of_sale/views/report_closedcashbox.xml
diff --git a/addons/point_of_sale/__openerp__.py b/addons/point_of_sale/__openerp__.py
index ad82c7e05a6..8b97062f0c2 100644
--- a/addons/point_of_sale/__openerp__.py
+++ b/addons/point_of_sale/__openerp__.py
@@ -72,7 +72,6 @@ Main Features
'res_partner_view.xml',
'views/report_statement.xml',
'views/report_usersproduct.xml',
- 'views/report_closedcashbox.xml',
'views/report_receipt.xml',
'views/report_saleslines.xml',
'views/report_detailsofsales.xml',
diff --git a/addons/point_of_sale/account_statement_report.xml b/addons/point_of_sale/account_statement_report.xml
index 2f08ee7f6d8..61cc1b891f4 100644
--- a/addons/point_of_sale/account_statement_report.xml
+++ b/addons/point_of_sale/account_statement_report.xml
@@ -17,13 +17,5 @@
file="point_of_sale.report_usersproduct"
report_type="qweb-pdf"
/>
-
diff --git a/addons/point_of_sale/report/__init__.py b/addons/point_of_sale/report/__init__.py
index aa8d4c080d8..ce424c84b1b 100644
--- a/addons/point_of_sale/report/__init__.py
+++ b/addons/point_of_sale/report/__init__.py
@@ -21,7 +21,6 @@
import pos_users_product
import account_statement
-import all_closed_cashbox_of_the_day
import pos_receipt
import pos_invoice
import pos_lines
diff --git a/addons/point_of_sale/report/all_closed_cashbox_of_the_day.py b/addons/point_of_sale/report/all_closed_cashbox_of_the_day.py
deleted file mode 100644
index 1bb51e82048..00000000000
--- a/addons/point_of_sale/report/all_closed_cashbox_of_the_day.py
+++ /dev/null
@@ -1,147 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-import time
-from openerp.osv import osv
-from openerp.report import report_sxw
-
-
-class all_closed_cashbox_of_the_day(report_sxw.rml_parse):
- #TOFIX: sql injection problem: SQL Request must be pass from sql injection...
- def __init__(self, cr, uid, name, context):
- super(all_closed_cashbox_of_the_day, self).__init__(cr, uid, name, context=context)
- self.localcontext.update({
- 'time': time,
- 'get_data':self._get_data,
- 'get_bal':self._get_bal,
- 'get_lines':self._get_lines,
- 'get_partner':self._get_partner,
- 'get_net_total':self._get_net_total,
- 'get_user':self._get_user,
- 'get_sub_total':self._get_sub_total,
- 'get_net_total_starting':self._get_net_total_starting,
- })
-
- def _get_user(self, line_ids):
- sql = "select login from res_users where id = %d"%(line_ids['create_uid'])
- self.cr.execute(sql)
- user = self.cr.fetchone()
- return user[0]
-
- def _get_data(self, user):
- data = {}
- sql = """ SELECT abs.journal_id,abs.id,abs.date,abs.closing_date,abs.name as statement,aj.name as journal,ap.name as period,ru.partner_id as user,rc.name as company,
- abs.state,abs.balance_end_real FROM account_bank_statement as abs
- LEFT JOIN account_journal as aj ON aj.id = abs.journal_id
- LEFT JOIN account_period as ap ON ap.id = abs.period_id
- LEFT JOIN res_users as ru ON ru.id = abs.user_id
- LEFT JOIN res_company as rc ON rc.id = abs.company_id
- WHERE to_char(date_trunc('day',abs.date),'YYYY-MM-DD')::date = current_date and abs.state IN ('confirm','open') and abs.user_id = %d"""%(user.id)
- self.cr.execute(sql)
- data = self.cr.dictfetchall()
- return data
-
- def _get_lines(self, statement):
- data = {}
- sql = """ select absl.* from account_bank_statement_line as absl, account_bank_statement as abs
- where absl.statement_id = abs.id and abs.id = %d"""%(statement['id'])
- self.cr.execute(sql)
- data = self.cr.dictfetchall()
- return data
-
- def _get_bal(self, data):
- res = {}
- sql =""" select sum(pieces*number_closing) as bal from account_cashbox_line where bank_statement_id = %d """%(data['id'])
- self.cr.execute(sql)
- res = self.cr.dictfetchall()
- if res:
- return res[0]['bal']
- else:
- return 0
-
- def _get_sub_total(self, user, data, date):
- res={}
- self.cr.execute(""" select sum(absl.amount) from account_bank_statement as abs
- LEFT JOIN account_bank_statement_line as absl ON abs.id = absl.statement_id
- WHERE abs.journal_id = %d
- and abs.state IN ('confirm','open')
- and abs.date = '%s'
- and abs.user_id = %d
- """%(data,date,user.id))
- res = self.cr.fetchall()
- if res[0][0]:
- return res[0][0]
- else:
- return False
-
- def _get_partner(self, statement):
- res = {}
- if statement['pos_statement_id']:
- sql =""" select rp.name from account_bank_statement_line as absl,res_partner as rp
- where absl.partner_id = rp.id
- and absl.pos_statement_id = %d"""%(statement['pos_statement_id'])
- self.cr.execute(sql)
- res = self.cr.dictfetchall() or {}
- return res and res[0]['name']
- else:
- return 0.00
-
- def _get_net_total_starting(self, user):
- lst = []
- res={}
- total_ending_bal = 0.0
- total_starting_bal = 0.0
- sql = """ SELECT abs.id,abs.balance_end_real as net_total FROM account_bank_statement as abs
- WHERE to_char(date_trunc('day',abs.date),'YYYY-MM-DD')::date = current_date
- and abs.state IN ('confirm','open')
- and abs.user_id = %d"""%(user.id)
- self.cr.execute(sql)
- res = self.cr.dictfetchall()
- for r in res:
- total_ending_bal += (r['net_total'] or 0.0)
- sql1 =""" select sum(pieces*number_closing) as bal from account_cashbox_line where bank_statement_id = %d"""%(r['id'])
- self.cr.execute(sql1)
- data = self.cr.dictfetchall()
- if data[0]['bal']:
- total_starting_bal += data[0]['bal']
- lst.append(total_ending_bal)
- lst.append(total_starting_bal)
- return lst
-
- def _get_net_total(self, user):
- res={}
- sql = """select sum(absl.amount) as net_total from account_bank_statement as abs
- LEFT JOIN account_bank_statement_line as absl ON abs.id = absl.statement_id
- where abs.state IN ('confirm','open') and abs.user_id = %d
- and to_char(date_trunc('day',abs.date),'YYYY-MM-DD')::date = current_date """%(user.id)
-
- self.cr.execute(sql)
- res = self.cr.dictfetchall()
- return res[0]['net_total'] or 0.0
-
-
-class report_closed_cashbox(osv.AbstractModel):
- _name = 'report.point_of_sale.report_closedcashbox'
- _inherit = 'report.abstract_report'
- _template = 'point_of_sale.report_closedcashbox'
- _wrapped_report_class = all_closed_cashbox_of_the_day
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/report/pos_report.py b/addons/point_of_sale/report/pos_report.py
index 96b056fb0fc..82c5ba3b7d2 100644
--- a/addons/point_of_sale/report/pos_report.py
+++ b/addons/point_of_sale/report/pos_report.py
@@ -20,7 +20,6 @@
##############################################################################
from openerp.osv import fields, osv
-import time
from openerp import tools
class report_transaction_pos(osv.osv):
diff --git a/addons/point_of_sale/test/account_statement_reports.yml b/addons/point_of_sale/test/account_statement_reports.yml
index 30eb7d5741d..99a11a7b3e8 100644
--- a/addons/point_of_sale/test/account_statement_reports.yml
+++ b/addons/point_of_sale/test/account_statement_reports.yml
@@ -59,17 +59,6 @@
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-statement.'+format), 'wb+').write(data)
--
- Print the closed cashbox of the day report
--
- !python {model: account.bank.statement}: |
- import os
- import openerp.report
- from openerp import tools
- data, format = openerp.report.render_report(cr, uid, [ref('account_bank_statement_0')], 'point_of_sale.report_closedcashbox', {}, {})
- if tools.config['test_report_directory']:
- file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-closedcashbox.'+format), 'wb+').write(data)
-
-
Printing the user s product report
-
diff --git a/addons/point_of_sale/views/report_closedcashbox.xml b/addons/point_of_sale/views/report_closedcashbox.xml
deleted file mode 100644
index 4b936468341..00000000000
--- a/addons/point_of_sale/views/report_closedcashbox.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-
-
-
-
-
-
- Today's Closed Cashbox
- User:
-
-
-
-
- | St.Name |
- Journal |
- Opening Date |
- Closing Date |
- Starting Balance |
- Ending Balance |
-
-
- | Total: |
- |
-
-
- |
-
-
- |
-
-
-
-
-
- |
- |
- |
- |
-
-
-
-
- |
-
-
-
-
- |
-
-
- |
- |
- |
-
-
- |
-
-
-
-
-
-
-
-
-
-
-
From ba6e63d6904361acd0893abbe24978bf64f78208 Mon Sep 17 00:00:00 2001
From: Simon Lejeune
Date: Tue, 29 Apr 2014 14:13:29 +0200
Subject: [PATCH 09/10] [IMP] point of sale: better check before printing a
potential invoice from a pos order
bzr revid: sle@openerp.com-20140429121329-lxgwpbuccdy67r4v
---
addons/point_of_sale/report/pos_invoice.py | 25 ++++++++++------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/addons/point_of_sale/report/pos_invoice.py b/addons/point_of_sale/report/pos_invoice.py
index 6ab06c4e99f..f83da570812 100644
--- a/addons/point_of_sale/report/pos_invoice.py
+++ b/addons/point_of_sale/report/pos_invoice.py
@@ -27,28 +27,25 @@ class PosInvoiceReport(osv.AbstractModel):
_name = 'report.point_of_sale.report_invoice'
def render_html(self, cr, uid, ids, data=None, context=None):
- if context is None:
- context = {}
-
report_obj = self.pool['report']
+ posorder_obj = self.pool['pos.order']
report = report_obj._get_report_from_name(cr, uid, 'account.report_invoice')
- selected_posorders = self.pool['pos.order'].browse(cr, uid, ids, context=context)
+ selected_orders = posorder_obj.browse(cr, uid, ids, context=context)
- invoiced_posorders = []
invoiced_posorders_ids = []
- for order in selected_posorders:
+ for order in selected_orders:
if order.invoice_id:
- invoiced_posorders.append(order)
invoiced_posorders_ids.append(order.id)
- if not invoiced_posorders:
- raise osv.except_osv(_('Error!'), _('Please create an invoice for this sale.'))
+ not_invoiced_orders_ids = list(set(ids) - set(invoiced_posorders_ids))
+ if not_invoiced_orders_ids:
+ not_invoiced_posorders = posorder_obj.browse(cr, uid, not_invoiced_orders_ids, context=context)
+ not_invoiced_orders_names = list(map(lambda a: a.name, not_invoiced_posorders))
+ raise osv.except_osv(_('Error!'), _('No link to an invoice for %s.' % ', '.join(not_invoiced_orders_names)))
docargs = {
- 'doc_ids': invoiced_posorders_ids,
+ 'doc_ids': ids,
'doc_model': report.model,
- 'docs': invoiced_posorders,
+ 'docs': selected_orders,
}
- return report_obj.render(cr, uid, invoiced_posorders_ids, 'account.report_invoice', docargs, context=context)
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+ return report_obj.render(cr, uid, ids, 'account.report_invoice', docargs, context=context)
From 0d2a0e8109ed7de5c765953498e182922ffac4cd Mon Sep 17 00:00:00 2001
From: Simon Lejeune
Date: Tue, 29 Apr 2014 14:24:00 +0200
Subject: [PATCH 10/10] [FIX] point of sale: payment report bad behaviour when
printing multiple documents
bzr revid: sle@openerp.com-20140429122400-s2ey704e8qfifzzj
---
.../report/pos_payment_report.py | 1 +
addons/point_of_sale/views/report_payment.xml | 39 ++++++++++---------
2 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/addons/point_of_sale/report/pos_payment_report.py b/addons/point_of_sale/report/pos_payment_report.py
index 5fbc8d5971e..a2b5698c40b 100644
--- a/addons/point_of_sale/report/pos_payment_report.py
+++ b/addons/point_of_sale/report/pos_payment_report.py
@@ -36,6 +36,7 @@ class pos_payment_report(report_sxw.rml_parse):
})
def _pos_payment(self, obj):
+ self.total = 0
data={}
sql = """ select id from pos_order where id = %d"""%(obj.id)
self.cr.execute(sql)
diff --git a/addons/point_of_sale/views/report_payment.xml b/addons/point_of_sale/views/report_payment.xml
index 81c644b6fef..939391ca532 100644
--- a/addons/point_of_sale/views/report_payment.xml
+++ b/addons/point_of_sale/views/report_payment.xml
@@ -3,23 +3,24 @@
-
-
- Today's Payments
-
-
-
- Company:
-
+
+
+
+ Today's Payments
+
+
+ Company:
+
+
+
+
+ Print date:
+
+
+
-
- Print date:
-
-
-
-
-
-
+
+
|
@@ -40,7 +41,7 @@
|
-
+
|
@@ -81,8 +82,8 @@
|
-
-
+
+
|