From 12e9d218b009e832255731d5472f79d33cc57cfd Mon Sep 17 00:00:00 2001 From: openerp-sle Date: Wed, 12 Feb 2014 19:22:47 +0100 Subject: [PATCH] [IMP] Sale order report converted to QWeb bzr revid: openerp-sle@openerp-sle.home-20140212182247-0ahbbrgob4ssz9bn --- addons/sale/__openerp__.py | 1 + addons/sale/report/__init__.py | 1 - addons/sale/report/sale_order.py | 45 ---- addons/sale/report/sale_order.rml | 322 ------------------------- addons/sale/sale_report.xml | 13 +- addons/sale/views/report_saleorder.xml | 137 +++++++++++ 6 files changed, 146 insertions(+), 373 deletions(-) delete mode 100644 addons/sale/report/sale_order.py delete mode 100644 addons/sale/report/sale_order.rml create mode 100644 addons/sale/views/report_saleorder.xml diff --git a/addons/sale/__openerp__.py b/addons/sale/__openerp__.py index 2bea86b41af..bb5bac89e46 100644 --- a/addons/sale/__openerp__.py +++ b/addons/sale/__openerp__.py @@ -77,6 +77,7 @@ The Dashboard for the Sales Manager will include 'board_sale_view.xml', 'edi/sale_order_action_data.xml', 'res_config_view.xml', + 'views/report_saleorder.xml', ], 'demo': ['sale_demo.xml'], 'test': [ diff --git a/addons/sale/report/__init__.py b/addons/sale/report/__init__.py index 6986639d942..12d484c3e25 100644 --- a/addons/sale/report/__init__.py +++ b/addons/sale/report/__init__.py @@ -19,7 +19,6 @@ # ############################################################################## -import sale_order import sale_report # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/sale/report/sale_order.py b/addons/sale/report/sale_order.py deleted file mode 100644 index 134e87a0c2e..00000000000 --- a/addons/sale/report/sale_order.py +++ /dev/null @@ -1,45 +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.report import report_sxw - -class order(report_sxw.rml_parse): - def __init__(self, cr, uid, name, context=None): - super(order, self).__init__(cr, uid, name, context=context) - self.localcontext.update({ - 'time': time, - 'show_discount':self._show_discount, - }) - - def _show_discount(self, uid, context=None): - cr = self.cr - try: - group_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'sale', 'group_discount_per_so_line')[1] - except: - return False - return group_id in [x.id for x in self.pool.get('res.users').browse(cr, uid, uid, context=context).groups_id] - -report_sxw.report_sxw('report.sale.order', 'sale.order', 'addons/sale/report/sale_order.rml', parser=order, header="external") - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/sale/report/sale_order.rml b/addons/sale/report/sale_order.rml deleted file mode 100644 index 3bddf81ade8..00000000000 --- a/addons/sale/report/sale_order.rml +++ /dev/null @@ -1,322 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [[repeatIn(objects,'o')]] - [[ setLang(o.partner_id.lang) ]] - - - - - Description - - - Tax - - - Quantity - - - Unit Price - - - Disc.(%) - - - Price - - - - - - - - - - - - - - Shipping address : - [[ (o.partner_shipping_id and o.partner_id.title and o.partner_shipping_id.title.name) or '' ]] [[ (o.partner_shipping_id and o.partner_shipping_id.name) or '' ]] - [[ o.partner_shipping_id and display_address(o.partner_shipping_id) ]] - - - - Invoice address : - [[ (o.partner_invoice_id and o.partner_invoice_id.title and o.partner_invoice_id.title.name) or '' ]] [[ (o.partner_invoice_id and o.partner_invoice_id.name) or '' ]] - [[ o.partner_invoice_id and display_address(o.partner_invoice_id) ]] - - - - - - - - [[ (o.partner_id and o.partner_id.title and o.partner_id.title.name) or '' ]] [[ (o.partner_id and o.partner_id.name) or '' ]] - [[ o.partner_id and display_address(o.partner_id) ]] - - - - Tel. : [[ (o.partner_id.phone) or removeParentNode('para') ]] - Fax : [[ (o.partner_id.fax) or removeParentNode('para') ]] - TVA : [[ (o.partner_id.vat) or removeParentNode('para') ]] - - - - - - - - - - [[ o.state not in ['draft','sent'] and removeParentNode('para') ]] Quotation N° [[ o.name ]] - [[ o.state in ['draft','sent'] and removeParentNode('para') ]] Order N° [[ o.name ]] - - - - - - - Your Reference - - - [[ o.state in ['draft','sent'] and removeParentNode('para') ]] Date Ordered - [[ o.state not in ['draft','sent'] and removeParentNode('para') ]] Quotation Date - - - Salesperson - - - Payment Term - - - - - - - [[ o.client_order_ref ]] - - - [[ formatLang(o.date_order,date = True) ]] - - - [[ (o.user_id and o.user_id.name) or '' ]] - - - [[ (o.payment_term and o.payment_term.name) or '' ]] - - - - - - - - - - Description - - - Tax - - - Quantity - - - Unit Price - - - [[not show_discount(user.id) and removeParentNode('para') ]]Disc.(%) - - - Price - - - -
- [[repeatIn(o.order_line,'line')]] - - - - [[ format(line.name) ]] - - - [[ ', '.join(map(lambda x: x.name, line.tax_id)) ]] - - - [[ formatLang(line.product_uos and line.product_uos_qty or line.product_uom_qty) ]] [[ line.product_uos and line.product_uos.name or line.product_uom.name ]] - - - [[ formatLang(line.price_unit , digits=get_digits(dp='Product Price'))]] - - - [[show_discount(user.id) and formatLang(line.discount, digits=get_digits(dp='Discount')) or '']] - - - [[ formatLang(line.price_subtotal, digits=get_digits(dp='Account'), currency_obj=o.pricelist_id.currency_id) ]] - - - -
- - - - - - - - - Net Total : - - - [[ formatLang(o.amount_untaxed, dp='Account', currency_obj=o.pricelist_id.currency_id) ]] - - - - - - - - - - Taxes : - - - [[ formatLang(o.amount_tax, dp='Account', currency_obj=o.pricelist_id.currency_id) ]] - - - - - - - - - - Total : - - - [[ formatLang(o.amount_total, dp='Account', currency_obj=o.pricelist_id.currency_id) ]] - - - - - - - [[ format(o.note or '') ]] - - - - [[ format(o.payment_term and o.payment_term.note or (o.partner_id.property_payment_term and o.partner_id.property_payment_term.note or '')) ]] - - - - - - -
-
-
diff --git a/addons/sale/sale_report.xml b/addons/sale/sale_report.xml index 0f77913a3c9..7a8614b139b 100644 --- a/addons/sale/sale_report.xml +++ b/addons/sale/sale_report.xml @@ -1,10 +1,13 @@ - - - + diff --git a/addons/sale/views/report_saleorder.xml b/addons/sale/views/report_saleorder.xml new file mode 100644 index 00000000000..2249a7810a1 --- /dev/null +++ b/addons/sale/views/report_saleorder.xml @@ -0,0 +1,137 @@ + + + + + +