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 @@ + + + + + + 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: