|
@@ -0,0 +1,65 @@
|
|
|
+# -*- coding: utf-8 -*-
|
|
|
+##############################################################################
|
|
|
+#
|
|
|
+# OpenERP, Open Source Management Solution
|
|
|
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
|
|
+#
|
|
|
+# 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 <http://www.gnu.org/licenses/>.
|
|
|
+#
|
|
|
+##############################################################################
|
|
|
+
|
|
|
+from openerp import tools
|
|
|
+from openerp.osv import fields, osv
|
|
|
+from datetime import datetime
|
|
|
+
|
|
|
+
|
|
|
+class report_productlist(osv.osv):
|
|
|
+ _name = "report.productlist"
|
|
|
+ _description = "Lista de Precios"
|
|
|
+ _auto = False
|
|
|
+ _rec_name = 'product_id'
|
|
|
+
|
|
|
+ _columns = {
|
|
|
+ 'product_id': fields.many2one('product.product', 'Producto', readonly=True),
|
|
|
+ 'name_template': fields.char('Descripción', readonly=True),
|
|
|
+ 'list_price': fields.char('Lista de Precio', readonly=True),
|
|
|
+ 'price_surcharge': fields.float('Precio', readonly=True),
|
|
|
+ 'company_id': fields.many2one('res.company', 'Compañia', readonly=True),
|
|
|
+ }
|
|
|
+ _order = 'id desc'
|
|
|
+
|
|
|
+ def init(self, cr):
|
|
|
+ tools.drop_view_if_exists(cr, 'report_productlist')
|
|
|
+ cr.execute("""
|
|
|
+ create or replace view report_productlist as (
|
|
|
+ SELECT row_number() over (ORDER BY pl.id) as id,
|
|
|
+ po.id AS product_id,
|
|
|
+ po.name_template AS name_template,
|
|
|
+ pv.name as list_price,
|
|
|
+ pl.price_surcharge as price_surcharge,
|
|
|
+ pt.company_id
|
|
|
+ from product_pricelist_item pl
|
|
|
+ LEFT JOIN product_product po ON po.id = pl.product_tmpl_id
|
|
|
+ LEFT JOIN product_template pt ON pt.id = po.product_tmpl_id
|
|
|
+ LEFT JOIN product_pricelist_version pv ON pv.id = pl.price_version_id
|
|
|
+ where pv.price_grid = True and pl.price_surcharge>0 and po.name_template <> ''
|
|
|
+ GROUP BY pl.id,
|
|
|
+ po.id,
|
|
|
+ po.name_template,
|
|
|
+ pv.name,
|
|
|
+ pl.price_surcharge,
|
|
|
+ pt.company_id)
|
|
|
+ """)
|
|
|
+
|
|
|
+ # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|