# -*- 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 . # r.employee_id as 'amount_salida': fields.float('Total Salida', readonly=True), # GROUP BY p.id ,l.partner_id,l.journal_id,l.create_date,l.amount_total,s.total ############################################################################## from openerp import tools from openerp.osv import fields, osv from openerp.tools.translate import _ from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT class salida_analisis(osv.osv): _name = "salida.analisis" _description = "Analisis de Salida S/ pagos a personal" _auto = False _columns = { 'rnumber': fields.char('Referencia', readonly=True), 'name': fields.char('Descripcion', readonly=True), 'partner_id': fields.many2one('res.partner', 'Proveedor', readonly=True), 'amount_salida': fields.float('Total Salida', readonly=True), 'date_x': fields.datetime('Date Order', readonly=True), } _order = 'date_x desc' def init(self, cr): tools.sql.drop_view_if_exists(cr, 'salida_analisis') cr.execute(""" CREATE OR REPLACE VIEW salida_analisis AS ( SELECT l.id as id, l.number as rnumber, r.ref as name, l.partner_id as partner_id, l.amount AS amount_salida, l.create_date as date_x FROM account_move r left join account_voucher l on (r.id=l.move_id) WHERE l.state='posted' and l.type='payment' GROUP BY l.id,l.number, r.ref,l.partner_id, l.amount,l.create_date ) """) salida_analisis()