diff --git a/addons/point_of_sale/__openerp__.py b/addons/point_of_sale/__openerp__.py index 62df15f5954..e63acfb7881 100644 --- a/addons/point_of_sale/__openerp__.py +++ b/addons/point_of_sale/__openerp__.py @@ -52,7 +52,6 @@ Main features : 'wizard/pos_close_statement.xml', 'wizard/pos_box_entries.xml', 'wizard/pos_payment_report_user_view.xml', - 'wizard/pos_payment_report_date_view.xml', 'wizard/pos_box_out.xml', 'wizard/pos_sales_user.xml', 'wizard/pos_receipt_view.xml', diff --git a/addons/point_of_sale/point_of_sale_report.xml b/addons/point_of_sale/point_of_sale_report.xml index b8d5456f1cd..41ce5232ac3 100644 --- a/addons/point_of_sale/point_of_sale_report.xml +++ b/addons/point_of_sale/point_of_sale_report.xml @@ -43,17 +43,6 @@ rml="point_of_sale/report/pos_lines.rml" /> - - - [('origin','like','POS')] - diff --git a/addons/point_of_sale/report/__init__.py b/addons/point_of_sale/report/__init__.py index 171f323e337..bc85fb31084 100644 --- a/addons/point_of_sale/report/__init__.py +++ b/addons/point_of_sale/report/__init__.py @@ -30,7 +30,6 @@ import pos_details_summary import pos_payment_report import pos_sales_user import pos_sales_user_today -import pos_payment_report_date import pos_payment_report_user import pos_report import pos_order_report diff --git a/addons/point_of_sale/report/pos_details.py b/addons/point_of_sale/report/pos_details.py index 4c23a005674..1590866836a 100644 --- a/addons/point_of_sale/report/pos_details.py +++ b/addons/point_of_sale/report/pos_details.py @@ -27,9 +27,9 @@ class pos_details(report_sxw.rml_parse): def _get_invoice(self,inv_id,user): res={} if inv_id: - self.cr.execute("select name from account_invoice as ac where id = %s", (inv_id,)) + self.cr.execute("select number from account_invoice as ac where id = %s", (inv_id,)) res = self.cr.fetchone() - return res[0] + return res[0] or 'Draft' else: return '' diff --git a/addons/point_of_sale/report/pos_details.rml b/addons/point_of_sale/report/pos_details.rml index 7aa2c3a8ea0..12e8618accb 100644 --- a/addons/point_of_sale/report/pos_details.rml +++ b/addons/point_of_sale/report/pos_details.rml @@ -199,13 +199,13 @@ - + Date - Code + Order Product @@ -226,7 +226,7 @@
[[ repeatIn(pos_sales_details(data['form'],user), 'line_ids') ]] - + [[ formatLang(line_ids['date_order'],date_time = True) ]] @@ -258,7 +258,7 @@ - Mode of Taxes + Taxes @@ -289,7 +289,7 @@ - Mode of Payment + Payment diff --git a/addons/point_of_sale/report/pos_order_report_view.xml b/addons/point_of_sale/report/pos_order_report_view.xml index 494dceec93e..4ae53d0ad67 100644 --- a/addons/point_of_sale/report/pos_order_report_view.xml +++ b/addons/point_of_sale/report/pos_order_report_view.xml @@ -57,7 +57,7 @@ string="Invoiced" domain="[('state','=',('invoiced'))]"/> diff --git a/addons/point_of_sale/report/pos_payment_report_date.py b/addons/point_of_sale/report/pos_payment_report_date.py deleted file mode 100644 index 76cd9c12be7..00000000000 --- a/addons/point_of_sale/report/pos_payment_report_date.py +++ /dev/null @@ -1,79 +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 report import report_sxw - -class pos_payment_report_date(report_sxw.rml_parse): - - def __init__(self, cr, uid, name, context): - super(pos_payment_report_date, self).__init__(cr, uid, name, context=context) - self.total = 0.0 - self.localcontext.update({ - 'time': time, - 'pos_payment_date': self.__pos_payment_date__, - 'pos_payment_date_total':self.__pos_payment_date__total__, - }) - - def __pos_payment_date__(self,form): - dt1 = form['date_start'] + ' 00:00:00' - dt2 = form['date_end'] + ' 23:59:59' - data={} - if form['user_id']: - self.cr.execute ("select pt.name,pp.default_code as code,pol.qty,pu.name as uom,pol.discount,pol.price_unit, " \ - "(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)) as total " \ - "from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt,product_uom as pu " \ - "where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id and pu.id=pt.uom_id " \ - "and po.state IN ('paid','invoiced') and po.date_order >= %s and po.date_order <= %s and po.user_id IN %s " \ - ,(dt1,dt2,tuple(form['user_id']))) - else: - self.cr.execute ("select pt.name,pp.default_code as code,pol.qty,pu.name as uom,pol.discount,pol.price_unit, " \ - "(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)) as total " \ - "from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt,product_uom as pu " \ - "where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id and pu.id=pt.uom_id " \ - "and po.state IN ('paid','invoiced') and po.date_order >= %s and po.date_order <= %s" \ - ,(dt1,dt2)) - data=self.cr.dictfetchall() - return data - - def __pos_payment_date__total__(self,form): - dt1 = form['date_start'] + ' 00:00:00' - dt2 = form['date_end'] + ' 23:59:59' - res=[] - if form['user_id']: - self.cr.execute ("select sum(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)) " \ - "from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt " \ - "where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id " \ - "and po.state IN ('paid','invoiced') and po.date_order >= %s and po.date_order <= %s and po.user_id IN %s " \ - ,(dt1,dt2,tuple(form['user_id']))) - else: - self.cr.execute ("select sum(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)) " \ - "from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt " \ - "where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id " \ - "and po.state IN ('paid','invoiced') and po.date_order >= %s and po.date_order <= %s" \ - ,(dt1,dt2)) - res=self.cr.fetchone()[0] or 0.0 - return res - - -report_sxw.report_sxw('report.pos.payment.report.date', 'pos.order', 'addons/point_of_sale/report/pos_payment_report_date.rml', parser=pos_payment_report_date,header='internal') - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/point_of_sale/report/pos_payment_report_date.rml b/addons/point_of_sale/report/pos_payment_report_date.rml deleted file mode 100644 index ba7764fed28..00000000000 --- a/addons/point_of_sale/report/pos_payment_report_date.rml +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [[ repeatIn(objects,'order') ]] - Sales Lines - - - - - - - Company - - - Print Date - - - - - - - [[ company.name ]] - - - [[ formatLang(time.strftime('%Y-%m-%d'),date = True) ]] - - - - - - - - - - - - - Product - - - Qty - - - Disc(%) - - - Unit Price - - - Total - - - -
- [[ repeatIn(pos_payment_date(data['form']), 'line_ids') ]] - - - - [ [[ line_ids['code'] ]] ] [[ line_ids['name'] ]] - - - [[ formatLang(line_ids['qty']) ]] [[line_ids['uom'] ]] - - - [[ formatLang(line_ids['discount'], dp='Sale Price') ]] - - - [[ formatLang(line_ids['price_unit'], dp='Sale Price') ]] [[ company.currency_id.symbol ]] - - - [[ formatLang(line_ids['total'], dp='Sale Price') ]] [[ company.currency_id.symbol ]] - - - -
- - - - - - - - - Total: - - - [[ formatLang(pos_payment_date_total(data['form']), dp='Sale Price') or removeParentNode('blockTable')]] [[ company.currency_id.symbol ]] - - - - - - -
-
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 f3ea5995b9e..c7583b1549c 100644 --- a/addons/point_of_sale/test/point_of_sale_report.yml +++ b/addons/point_of_sale/test/point_of_sale_report.yml @@ -35,23 +35,7 @@ file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-receipt report'+format), 'wb+').write(data) - - Create a record for the root user in pos.payment.report.user (used by the next python block). -- - !record {model: pos.payment.report.user, id: pos_payment_report_user_1}: - user_id: [] -- - Print the POS Payment Report through the wizard -- - !python {model: ir.ui.menu}: | - import time - ctx={} - ctx.update({'model': 'ir.ui.menu','active_ids': []}) - data_dict = {'date_start': time.strftime('%Y-%m-%d'), 'date_end': time.strftime('%Y-%m-%d'), 'user_id': [(6,0,[ref('base.user_root')])] } - from tools import test_reports - test_reports.try_report_action(cr, uid, 'action_report_pos_payment_repport_date',wiz_data=data_dict, context=ctx, our_module='point_of_sale') - -- - Print the POS Details Report through the wizard + Print the POS Details Report through the wizard - !python {model: ir.ui.menu}: | import time diff --git a/addons/point_of_sale/wizard/__init__.py b/addons/point_of_sale/wizard/__init__.py index 0985ae906be..cb0a6a6da9a 100644 --- a/addons/point_of_sale/wizard/__init__.py +++ b/addons/point_of_sale/wizard/__init__.py @@ -30,7 +30,6 @@ import pos_sales_user import pos_sales_user_today import pos_receipt import pos_payment_report_user -import pos_payment_report_date import pos_payment_report import pos_payment diff --git a/addons/point_of_sale/wizard/pos_payment_report_date.py b/addons/point_of_sale/wizard/pos_payment_report_date.py deleted file mode 100644 index f97391c7f7d..00000000000 --- a/addons/point_of_sale/wizard/pos_payment_report_date.py +++ /dev/null @@ -1,68 +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 osv import osv -from osv import fields - - -class pos_payment_report_date(osv.osv_memory): - _name = 'pos.payment.report.date' - _description = 'POS Payment Report according to date' - - def print_report(self, cr, uid, ids, context=None): - """ - To get the date and print the report - @param self: The object pointer. - @param cr: A database cursor - @param uid: ID of the user currently logged in - @param context: A standard dictionary - @return : retrun report - """ - if context is None: - context = {} - datas = {'ids': context.get('active_ids', [])} - res = self.read(cr, uid, ids, ['date_start', 'date_end', 'user_id'], context=context) - res = res and res[0] or {} - datas['form'] = res - if res.get('id',False): - datas['ids']=[res['id']] - return { - 'type': 'ir.actions.report.xml', - 'report_name': 'pos.payment.report.date', - 'datas': datas, - } - - _columns = { - 'date_start': fields.date('Start Date', required=True), - 'date_end': fields.date('End Date', required=True), - 'user_id': fields.many2many('res.users', 'res_user_sale_date', 'user_id', 'sale_id', 'Salesman') - } - _defaults = { - 'date_start': lambda *a: time.strftime('%Y-%m-%d'), - 'date_end': lambda *a: time.strftime('%Y-%m-%d'), - } - -pos_payment_report_date() - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/point_of_sale/wizard/pos_payment_report_date_view.xml b/addons/point_of_sale/wizard/pos_payment_report_date_view.xml deleted file mode 100644 index 7c74ae1d9be..00000000000 --- a/addons/point_of_sale/wizard/pos_payment_report_date_view.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - pos.payment.report.date.form - pos.payment.report.date - form - -
- - - - - - - -