Просмотр исходного кода

FIX Report lista de precios por compania

Sebas 7 лет назад
Родитель
Сommit
a8ee40d9f8
4 измененных файлов с 9 добавлено и 18 удалено
  1. 9 12
      report_productlist.py
  2. BIN
      report_productlist.pyc
  3. 0 4
      report_productlist.xml
  4. 0 2
      report_productlist_view.xml

+ 9 - 12
report_productlist.py

@@ -15,7 +15,7 @@
 #    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/>.
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>. and pv.price_grid= True
 #
 ##############################################################################
 
@@ -31,32 +31,29 @@ class report_productlist(osv.osv):
     _rec_name = 'product_id'
 
     _columns = {
-        'product_id': fields.many2one('product.product', 'Producto', readonly=True),
-        'name_template': fields.char('Descripción', readonly=True),
+        '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 = 'id desc'
+    _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,
-                            po.id AS product_id,
-                            po.name_template AS name_template,
+        			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_product po ON po.id = pl.product_tmpl_id
-				                LEFT JOIN product_template pt ON pt.id = po.product_tmpl_id
+				        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 pv.price_grid = True and pl.price_surcharge>0 and po.name_template <> ''
+		            where po.name_template <> ''
                     GROUP BY pl.id,
-                            po.id,
-                            po.name_template,
+                            pt.id,
                             pv.name,
 			                pl.price_surcharge,
                             pt.company_id)

BIN
report_productlist.pyc


+ 0 - 4
report_productlist.xml

@@ -44,7 +44,6 @@
 				<thead class="crm_tcab">
 					<tr class="active">
                         <th class="text-left">Codigo</th>
-                        <th class="text-left">Descripcion</th>
                         <th class="text-left">Lista de Precio</th>
 						<th class="text-left">Precio</th>
                         <th class="text-left">Compañia</th>
@@ -54,9 +53,6 @@
                 <tbody class="crmc_tbody">
                         <td class="text-left">
                             <span t-field="o.product_id"/>
-                        </td>
-                        <td class="text-left">
-                            <span t-field="o.name_template"/>
                         </td>
 						<td class="text-left">
                             <span t-field="o.list_price"/>

+ 0 - 2
report_productlist_view.xml

@@ -8,7 +8,6 @@
             <field name="arch" type="xml">
                 <tree string="Listado de Precios de Productos" create="false">
                     <field name="product_id"/>
-                    <field name="name_template"/>
                     <field name="list_price"/>
                     <field name="price_surcharge"/>
                     <field name="company_id"/>
@@ -25,7 +24,6 @@
                 <form string="Listado de Precios de Productos" create="false" edit="false">
                     <group>
                         <field name="product_id"/>
-                        <field name="name_template"/>
                         <field name="list_price"/>
                         <field name="price_surcharge"/>
                         <field name="company_id"/>