Пример #1
0
            AND ai.company_id IN (%s)
            AND pp.excluded_product IS NOT TRUE
            AND ai.date_invoice BETWEEN '%s' AND '%s' %s
        """
        cr.execute(_sql %
                   (','.join(str(com_id.id) for com_id in form.company_ids),
                    form.from_dt, form.to_dt, _salesman_filter))

        return [(record[0]) for record in cr.fetchall()]

    def validate_parameters(self, cr, uid, form, context=None):
        if len(form.company_ids) == 0:
            raise osv.except_osv(_('Caution !'),
                                 _('No page will be printed !'))

    def print_report(self, cr, uid, form, context=None):
        self.validate_parameters(cr, uid, form, context=context)

        _ails = self.get_ail(cr, uid, form, context=context)
        _ails_table = list_to_pgTable(_ails, _ARRAY_NAME, [('id', 'INTEGER')])
        form.add_marshalled_data(_TABLE_NAME, _ails_table)
        form.add_marshalled_data('RPT_SQL', RPT_SQL)
        prec = self.pool.get('decimal.precision').precision_get(
            cr, uid, 'Product UoM')
        zero = '0' * prec
        form.add_marshalled_data('QTY_FORMAT',
                                 "#,##0.%s;-#,##0.%s" % (zero, zero))


register_report_wizard(RPT_NAME, wizard)
            raise osv.except_osv(_('Caution !'),
                                 _('No page will be printed !'))

    def print_report(self, cr, uid, form, context=None):
        self.validate_parameters(cr, uid, form, context=context)
        form.add_marshalled_data('SQL_PARAMS', ar_cust_sql())
        if len(form.customer_addr_ids) == 0:
            #TODO: Nothing
            sql_cust_ids = ''
        else:
            cust_list = form.get_customer_addr_ids(context=None)
            cust_addr_ids = ",".join(str(n) for n in cust_list)
            sql_cust_ids = ' AND id.address_id IN (%s)' % cust_addr_ids
        form.add_marshalled_data('CUSTOMER_ADDR_IDS', sql_cust_ids)
        receivable = self.get_receivable(cr, uid, form, context=context)
        receivable_table = list_to_pgTable(receivable,
                                             'receivable_table',
                                             [('partner_id', 'INTEGER'),
                                              ('receivable', 'NUMERIC')])
        form.add_marshalled_data('RECEIVABLE_TABLE', receivable_table)
        payable = self.get_payable(cr, uid, form, context=context)
        payable_table = list_to_pgTable(payable,
                                             'payable_table',
                                             [('partner_id', 'INTEGER'),
                                              ('payable', 'NUMERIC')])
        form.add_marshalled_data('PAYABLE_TABLE', payable_table)
        currency_company = self.get_currency_company(cr, uid, form, context=context)
        form.add_marshalled_data('CURRENCY_SYMBOL', currency_company)

register_report_wizard(RPT_NAME, wizard)