# -*- 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 . and pv.price_grid= True # ############################################################################## 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.template', 'Producto', 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 = 'product_id asc' 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, pt.id AS product_id, pv.name as list_price, pl.price_surcharge as price_surcharge, pt.company_id from product_pricelist_item pl LEFT JOIN product_template pt ON pt.id = pl.product_tmpl_id LEFT JOIN product_product po ON po.product_tmpl_id = pt.id LEFT JOIN product_pricelist_version pv ON pv.id = pl.price_version_id where po.name_template <> '' GROUP BY pl.id, pt.id, pv.name, pl.price_surcharge, pt.company_id) """) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: