Example #1
0
class PrintAEAT(Wizard):
    'Print AEAT'
    __name__ = 'account.reporting.aeat'
    start = StateView('account.reporting.aeat.start',
        'account_es.print_aeat_start_view_form', [
            Button('Cancel', 'end', 'tryton-cancel'),
            Button('Print', 'choice', 'tryton-ok', default=True),
            ])
    choice = StateTransition()
    model_111 = StateReport('account.reporting.aeat111')
    model_115 = StateReport('account.reporting.aeat115')
    model_303 = StateReport('account.reporting.aeat303')

    def transition_choice(self):
        validate = getattr(self, 'validate_%s' % self.start.report, None)
        if validate:
            validate()
        return 'model_%s' % self.start.report

    def open_report(self, action):
        return action, {'ids': [p.id for p in self.start.periods]}

    do_model_111 = open_report
    do_model_115 = open_report
    do_model_303 = open_report

    def validate_303(self):
        if len(set(p.fiscalyear for p in self.start.periods)) > 1:
            raise PrintError(
                gettext('account_es.msg_report_same_fiscalyear'))
Example #2
0
class PrintTmiReport(Wizard):
    'Print Tmi Report'
    __name__ = 'print.tmi.report'

    start = StateView(
        'print.tmi.report.start', 'tmi.print_tmi_report_start_form', [
            Button('Cancel', 'end', 'tryton-cancel'),
            Button('Print', 'print_', 'tryton-print', default=True),
        ])
    print_ = StateReport('tmi.report')

    def do_print_(self, action):
        start_date = self.start.start_date
        end_date = self.start.end_date
        if self.start.group:
            data = {
                'company': self.start.company.id,
                'group': self.start.group.id,
                'start_date': self.start.start_date,
                'end_date': self.start.end_date,
                'type': self.start.type,
                'child_type': self.start.child_type,
                'posted': self.start.posted,
            }
        else:
            data = {
                'company': self.start.company.id,
                'start_date': self.start.start_date,
                'end_date': self.start.end_date,
                'type': self.start.type,
                'child_type': self.start.child_type,
                'posted': self.start.posted,
            }
        return action, data
Example #3
0
class ProcessDunning:
    __metaclass__ = PoolMeta
    __name__ = 'account.dunning.process'
    print_letter = StateReport('account.dunning.letter')

    @classmethod
    def __setup__(cls):
        super(ProcessDunning, cls).__setup__()
        cls._actions.append('print_letter')

    def do_print_letter(self, action):
        pool = Pool()
        Dunning = pool.get('account.dunning')
        dunnings = Dunning.browse(Transaction().context['active_ids'])
        ids = [
            d.id for d in dunnings if d.state == 'done' and not d.blocked
            and d.party and d.level.print_on_letter
        ]
        if ids:
            return action, {
                'id': ids[0],
                'ids': ids,
            }

    def transition_print_letter(self):
        return self.next_state('print_letter')
Example #4
0
class ComputerLoanScheduleWiz(Wizard):
    'Computer Loan Schedule Wizard'

    __name__ = 'computer.loan.schedule.wiz'

    start_state = 'raises'
    raises = StateView('computer.loan.schedule',
                       'hr_loan.form_wiz_computer_loan_schedule_view', [
                           Button('Cancel', 'end', 'tryton-cancel'),
                           Button(
                               'Print',
                               'print_report',
                               'tryton-go-next',
                               default=True,
                           )
                       ])
    print_report = StateReport('computer.loan.report')

    def do_print_report(self, action):
        data = {
            'month': self.raises.month,
            'year': self.raises.year,
            'department': self.raises.department.name,
        }
        return action, data
Example #5
0
class WizardSalePayment(metaclass=PoolMeta):
    __name__ = 'sale.payment'
    print_ = StateReport('sale_pos.sale_ticket')

    def default_start(self, fields):
        Sale = Pool().get('sale.sale')
        sale = Sale(Transaction().context['active_id'])
        result = super(WizardSalePayment, self).default_start(fields)
        result['self_pick_up'] = sale.self_pick_up
        return result

    def transition_pay_(self):
        pool = Pool()
        Sale = pool.get('sale.sale')
        active_id = Transaction().context.get('active_id', False)
        sale = Sale(active_id)
        result = super(WizardSalePayment, self).transition_pay_()
        Sale.print_ticket([sale])
        if result == 'end':
            return 'print_'
        return result

    def transition_print_(self):
        return 'end'

    def do_print_(self, action):
        data = {}
        data['id'] = Transaction().context['active_ids'].pop()
        data['ids'] = [data['id']]
        return action, data
Example #6
0
class PrintIncomeStatement(Wizard):
    'Income Statement Balance'
    __name__ = 'print.income_statement'

    start = StateView(
        'print.income_statement.start',
        'account_report.print_income_statement_start_form', [
            Button('Cancel', 'end', 'tryton-cancel'),
            Button('Print', 'print_', 'tryton-print', default=True),
        ])
    print_ = StateReport('income_statement.report')

    def do_print_(self, action):
        start_date = self.start.start_date
        end_date = self.start.end_date
        start_date = Date(start_date.year, start_date.month, start_date.day)
        end_date = Date(end_date.year, end_date.month, end_date.day)
        data = {
            'company': self.start.company.id,
            'account': self.start.account.id,
            #'fiscalyear': self.start.fiscalyear.name,
            'start_date': self.start.start_date,
            'end_date': self.start.end_date,
            'omit_zero': self.start.omit_zero,
        }
        action['pyson_context'] = PYSONEncoder().encode({
            'company':
            self.start.company.id,
            'start_date':
            start_date,
            'end_date':
            end_date,
        })
        return action, data
Example #7
0
class PrintJournal(Wizard):
    'Print Journal'
    __name__ = 'account_jasper_reports.print_journal'
    start = StateView(
        'account_jasper_reports.print_journal.start',
        'account_jasper_reports.print_journal_start_view_form', [
            Button('Cancel', 'end', 'tryton-cancel'),
            Button('Print', 'print_', 'tryton-print', default=True),
        ])
    print_ = StateReport('account_jasper_reports.journal')

    def do_print_(self, action):
        start_period = self.start.fiscalyear.periods[0].id
        if self.start.start_period:
            start_period = self.start.start_period.id
        end_period = self.start.fiscalyear.periods[-1].id
        if self.start.end_period:
            end_period = self.start.end_period.id
        data = {
            'company': self.start.company.id,
            'open_close_account_moves': self.start.open_close_account_moves,
            'open_move_description': self.start.open_move_description,
            'close_move_description': self.start.close_move_description,
            'fiscalyear': self.start.fiscalyear.id,
            'start_period': start_period,
            'end_period': end_period,
            'journals': [x.id for x in self.start.journals],
            'output_format': self.start.output_format,
        }
        return action, data

    def transition_print_(self):
        return 'end'
Example #8
0
class TutionFeeScheduleWiz(Wizard):
    'Tution Fee Schedule Wizard'

    __name__ = 'tution.fee.schedule.wiz'

    start_state = 'raises'
    raises = StateView('tution.fee.schedule',
                       'hr_cea.form_wiz_tution_fee_schedule_view', [
                           Button('Cancel', 'end', 'tryton-cancel'),
                           Button(
                               'Print',
                               'print_report',
                               'tryton-go-next',
                               default=True,
                           )
                       ])
    print_report = StateReport('tution.fee.report')

    def do_print_report(self, action):
        data = {
            'month': self.raises.month,
            'year': self.raises.year,
            'department': self.raises.department.name,
        }
        return action, data
class ProcessDunning(metaclass=PoolMeta):
    __name__ = 'account.dunning.process'
    mipago = StateReport('account.dunning.mipago')

    @classmethod
    def __setup__(cls):
        super(ProcessDunning, cls).__setup__()
        cls._actions.append('mipago')

    def do_mipago(self, action):
        pool = Pool()
        Dunning = pool.get('account.dunning')
        dunnings = Dunning.browse(Transaction().context['active_ids'])
        ids = [
            d.id for d in dunnings if d.state == 'waiting' and not d.blocked
            and d.party and d.level.mipago
        ]
        if ids:
            return action, {
                'id': ids[0],
                'ids': ids,
            }

    def transition_mipago(self):
        return self.next_state('mipago')
Example #10
0
class BankStatementScheduleWiz(Wizard):
    'Bank Statement Schedule Wizard'

    __name__ = 'bank.schedule.wiz'

    start_state = 'raises'
    raises = StateView('bank.statement.schedule',
                       'hr_bank.form_wiz_bank_statement_schedule_view', [
                           Button('Cancel', 'end', 'tryton-cancel'),
                           Button(
                               'Print',
                               'print_report',
                               'tryton-go-next',
                               default=True,
                           )
                       ])
    print_report = StateReport('bank.statement.report')

    def do_print_report(self, action):
        data = {
            'month': self.raises.month,
            'year': self.raises.year,
            'employee_group': self.raises.employee_group,
            'department': self.raises.department.name,
        }
        return action, data
class MiPagoCustomerWizard(Wizard):
    'Dunning MiPago Customer'
    __name__ = 'account.dunning.mipago.customer_wizard'
    start = StateView(
        'account.dunning.mipago.customer_wizard.start',
        'account_dunning_mipago.mipago_customer_start_view_form', [
            Button('Cancel', 'end', 'tryton-cancel'),
            Button('Process', 'customer', 'tryton-ok', default=True),
        ])
    customer = StateReport('account.dunning.mipago.customer_report')

    def do_customer(self, action):
        pool = Pool()
        Dunning = pool.get('account.dunning')
        dunnings = Dunning.search([])
        ids = list(
            set([
                d.party.id for d in dunnings
                if not d.blocked and d.party and d.level.mipago
            ]))
        if ids:
            return action, {
                'id': ids[0],
                'ids': ids,
            }
Example #12
0
class PrintBudgetReport(Wizard): 
    'Print Budget Report'
    __name__ = 'print.budget_report'

    start = StateView('print.budget_report.start',
        'account_budget.print_budget_report_start_form', [
            Button('Cancel', 'end', 'tryton-cancel'),
            Button('Print', 'print_', 'tryton-print', default=True),
            ])
    print_ = StateReport('budget.report')

    def do_print_(self, action):
        start_date = self.start.fiscalyear.start_date
        end_date = self.start.fiscalyear.end_date
        fiscalyear = self.start.fiscalyear.id
        start_date = Date(start_date.year, start_date.month, start_date.day)
        end_date = Date(end_date.year, end_date.month, end_date.day)
        data = {
            'company': self.start.company.id,
            'budget': self.start.budget.id,
            'fiscalyear': self.start.fiscalyear.name,
            'start_date': self.start.fiscalyear.start_date,
            'end_date': self.start.fiscalyear.end_date,
            }
        action['pyson_context'] = PYSONEncoder().encode({
                'company': self.start.company.id,
                'fiscalyear': self.start.fiscalyear.id,
                })
        if self.start.fiscalyear:
            action['name'] += ' - %s' % self.start.fiscalyear.rec_name
        return action, data
Example #13
0
class IncomeTaxScheduleWiz(Wizard):
    'Income Tax Schedule Wizard'

    __name__ = 'bank.schedule.wiz'

    start_state = 'raises'
    raises = StateView('income.tax.schedule',
                       'hr_payroll.form_wiz_income_tax_schedule_view', [
                           Button('Cancel', 'end', 'tryton-cancel'),
                           Button(
                               'Print',
                               'print_report',
                               'tryton-go-next',
                               default=True,
                           )
                       ])
    print_report = StateReport('income.tax.report')

    def do_print_report(self, action):
        data = {
            'month': self.raises.month,
            'year': self.raises.year,
            'department': self.raises.department.name,
        }
        return action, data
Example #14
0
class PrintFinancialIndicator(Wizard):
    'Financial Indicator Balance'
    __name__ = 'print.financial_indicator'

    start = StateView(
        'print.financial_indicator.start',
        'account_financial_indicator.print_financial_indicator_start_form', [
            Button('Cancel', 'end', 'tryton-cancel'),
            Button('Print', 'print_', 'tryton-print', default=True),
        ])
    print_ = StateReport('financial_indicator.report')

    def do_print_(self, action):
        start_date = self.start.from_date
        end_date = self.start.to_date
        start_date = Date(start_date.year, start_date.month, start_date.day)
        end_date = Date(end_date.year, end_date.month, end_date.day)
        data = {
            'company': self.start.company.id,
            #'fiscalyear': self.start.fiscalyear.name,
            #'fiscalyear_id': self.start.fiscalyear.id,
            'start_date': self.start.from_date,
            'end_date': self.start.to_date,
        }
        action['pyson_context'] = PYSONEncoder().encode({
            #'company': self.start.company.id,
            'start_date': start_date,
            'end_date': end_date,
        })
        return action, data
Example #15
0
class OAScheduleWiz(Wizard):
    'Office Association Fund Schedule Wizard'

    __name__ = 'oa.schedule.wiz'

    start_state = 'raises'
    raises = StateView(
        'oa.schedule',
        'hr_schedule.form_wiz_oa_view',
        [
            Button('Cancel', 'end', 'tryton-cancel'),
            Button(
                'Print',
                'print_report',
                'tryton-go-next',
                default=True,
            )
        ]
    )
    print_report = StateReport('oa.report')

    def do_print_report(self, action):
        data = {
            'month': self.raises.month,
            'year': self.raises.year,
            'department': self.raises.department.name,
        }
        return action, data
class PrintTaxesByInvoiceAndPeriod(Wizard):
    'Print TaxesByInvoiceAndPeriod'
    __name__ = 'account_jasper_reports.print_taxes_by_invoice'
    start = StateView(
        'account_jasper_reports.print_taxes_by_invoice.start',
        'account_jasper_reports.print_taxes_by_invoice_start_view_form', [
            Button('Cancel', 'end', 'tryton-cancel'),
            Button('Print', 'print_', 'tryton-print', default=True),
        ])
    print_ = StateReport('account_jasper_reports.taxes_by_invoice')

    def do_print_(self, action):
        fiscalyear = (self.start.fiscalyear.id
                      if self.start.fiscalyear else None)
        if self.start.start_date:
            fiscalyear = None

        data = {
            'company': self.start.company.id,
            'fiscalyear': fiscalyear,
            'start_date': self.start.start_date,
            'end_date': self.start.end_date,
            'periods': [x.id for x in self.start.periods],
            'parties': [x.id for x in self.start.parties],
            'output_format': self.start.output_format,
            'partner_type': self.start.partner_type,
            'totals_only': self.start.totals_only,
            'grouping': self.start.grouping,
            'tax_type': self.start.tax_type,
        }

        if data['grouping'] == 'invoice':
            state_action = StateAction('account_jasper_reports.'
                                       'report_taxes_by_invoice_and_period')
            action = state_action.get_action()
        return action, data

    def transition_print_(self):
        return 'end'

    def default_start(self, fields):
        Party = Pool().get('party.party')
        party_ids = []
        if Transaction().context.get('model') == 'party.party':
            for party in Party.browse(Transaction().context.get('active_ids')):
                party_ids.append(party.id)
        return {
            'parties': party_ids,
        }
Example #17
0
class PrintGeneralLedger(Wizard):
    'Print General Ledger'
    __name__ = 'account_reports.print_general_ledger'
    start = StateView(
        'account_reports.print_general_ledger.start',
        'account_reports.print_general_ledger_start_view_form', [
            Button('Cancel', 'end', 'tryton-cancel'),
            Button('Print', 'print_', 'tryton-print', default=True),
        ])
    print_ = StateReport('account_reports.general_ledger')

    def do_print_(self, action):
        start_period = None
        if self.start.start_period:
            start_period = self.start.start_period.id
        end_period = None
        if self.start.end_period:
            end_period = self.start.end_period.id
        data = {
            'company': self.start.company.id,
            'fiscalyear': self.start.fiscalyear.id,
            'start_period': start_period,
            'end_period': end_period,
            'accounts': [x.id for x in self.start.accounts],
            'all_accounts': self.start.all_accounts,
            'parties': [x.id for x in self.start.parties],
            'output_format': self.start.output_format,
        }
        return action, data

    def transition_print_(self):
        return 'end'

    def default_start(self, fields):
        Party = Pool().get('party.party')
        account_ids = []
        party_ids = []
        if Transaction().context.get('model') == 'party.party':
            for party in Party.browse(Transaction().context.get('active_ids')):
                if party.account_payable:
                    account_ids.append(party.account_payable.id)
                if party.account_receivable:
                    account_ids.append(party.account_receivable.id)
                party_ids.append(party.id)
        return {
            'accounts': account_ids,
            'parties': party_ids,
        }
class PrintProductionMassBalance(Wizard):
    'Print Production Mass Balance'
    __name__ = 'production.print_mass_balance'
    start = StateView(
        'production.mass_balance.start',
        'production_mass_balance_report.print_production_mass_balance_start_view_form',
        [
            Button('Cancel', 'end', 'tryton-cancel'),
            Button('Print', 'print_', 'tryton-print', default=True),
        ])
    print_ = StateReport('production.mass_balance.report')

    def default_start(self, fields):
        context = Transaction().context

        res = {}
        if context.get('active_model'):
            Model = Pool().get(context['active_model'])
            id = Transaction().context['active_id']
            if Model.__name__ == 'product.template':
                template = Model(id)
                if template.products:
                    res['product'] = template.products[0].id
            elif Model.__name__ == 'product.product':
                res['product'] = id
            elif Model.__name__ == 'stock.lot':
                lot = Model(id)
                res['lot'] = lot.id
                res['product'] = lot.product.id
        return res

    def do_print_(self, action):
        context = Transaction().context
        data = {
            'direction': self.start.direction,
            'from_date': self.start.from_date,
            'to_date': self.start.to_date,
            'product': self.start.product.id,
            'model': context.get('active_model'),
            'ids': context.get('active_ids') or [],
        }
        try:
            Lot = Pool().get('stock.lot')
        except:
            Lot = None
        if Lot:
            data['lot'] = self.start.lot.id if self.start.lot else None
        return action, data
Example #19
0
class WizardCombustible(Wizard):
    'Wizard Combustible'
    __name__ = 'oci.wizard.combustible'

    start = StateView('oci.desde.hasta.fechas', 'oci.oci_desde_hasta_fechas', [
        Button('Cancel', 'end', 'tryton-cancel'),
        Button('OK', 'print_', 'tryton-ok', default=True),
    ])

    print_ = StateReport('oci.report.combustible')

    def do_print_(self, action):
        data = {
            'fecha1': self.start.fecha1,
            'fecha2': self.start.fecha2,
        }
        return action, data
Example #20
0
class SubdiarioPurchase(Wizard):
    'Subdiario de Compras'
    __name__ = 'subdiario.purchase'

    start = StateView('subdiario.purchase.start',
                      'subdiario.purchase_start_view_form', [
                          Button('Cancel', 'end', 'tryton-cancel'),
                          Button('OK', 'print_', 'tryton-print', True),
                      ])
    print_ = StateReport('subdiario.purchase_report')

    def do_print_(self, action):
        data = {
            'company': self.start.company.id,
            'from_date': self.start.from_date,
            'to_date': self.start.to_date,
            'date': self.start.date,
        }
        return action, data
Example #21
0
class PrintGradeOverdueReport(Wizard):
    'Grade Overdue Report'
    __name__ = 'grade.overdue.report.print'

    start = StateView(
        'grade.overdue.report.print.start',
        'training.print_grade_overdue_report_start_form', [
            Button('Cancel', 'end', 'tryton-cancel'),
            Button('Print', 'print_', 'tryton-print', default=True),
        ])
    print_ = StateReport('grade.overdue.report')

    def do_print_(self, action):
        data = {
            'date': self.start.date,
            'user': self.start.user.name,
            'grade': self.start.grade.id,
        }
        return action, data
Example #22
0
class SubdiarioSaleSubdivision(Wizard):
    'Subdiario de Ventas por jurisdicción'
    __name__ = 'subdiario.sale.subdivision'

    start = StateView('subdiario.sale.start', 'subdiario.sale_start_view_form',
                      [
                          Button('Cancel', 'end', 'tryton-cancel'),
                          Button('OK', 'print_', 'tryton-print', True),
                      ])
    print_ = StateReport('subdiario.sale_subdivision_report')

    def do_print_(self, action):
        data = {
            'company': self.start.company.id,
            'from_date': self.start.from_date,
            'to_date': self.start.to_date,
            'pos': [p.id for p in self.start.pos],
        }
        return action, data
Example #23
0
class ProcessDunning:
    __metaclass__ = PoolMeta
    __name__ = 'account.dunning.process'
    print_letter = StateReport('account.dunning.letter')

    @classmethod
    def __setup__(cls):
        super(ProcessDunning, cls).__setup__()
        cls._actions.append('print_letter')

    def do_print_letter(self, action):
        # TODO return None if nothing to print
        return action, {
            'id': Transaction().context['active_id'],
            'ids': Transaction().context['active_ids'],
        }

    def transition_print_letter(self):
        return self.next_state('print_letter')
Example #24
0
class ImprimirReporteLiderCero(Wizard):
    'Imprimir Reporte Lider Cero'
    __name__ = 'disc.reporte.lider.cero.imprimir'
    
    start = StateView('disc.reporte.lider.cero.imprimir.inicio',
        'discipulado.imprimir_reporte_lider_cero_inicio_form', [
            Button('Cancelar', 'end', 'tryton-cancel'),
            Button('Imprimir', 'print_', 'tryton-print', default=True),
            ])
    print_ = StateReport('disc.reporte.lider.cero')

    def do_print_(self, action):
        data = {
            'fecha_inicio': self.start.fecha_inicio,
            'fecha_fin': self.start.fecha_fin,
            'fecha': self.start.fecha,
            'distrito': self.start.distrito.id,
            'usuario': self.start.usuario.name,
            }
        return action, data
class CommissionReportWiz(Wizard):
    'CommissionsReportWiz'
    __name__ = 'reports.commission'
    start = StateView('reports.commission.start',
                      'reports_commission.commission_report_start_view_form', [
                          Button('Cancel', 'end', 'tryton-cancel'),
                          Button('Print', 'print_', 'tryton-print', True),
                      ])
    print_ = StateReport('reports.commission')

    def do_print_(self, action):
        data = {
            'from_date': self.start.from_date,
            'to_date': self.start.to_date,
        }
        if self.start.agents:
            data.update({
                'agents': [p.id for p in self.start.agents],
            })
        return action, data
class AccountDebt(Wizard):
    'Account Debt'
    __name__ = 'account.debt'

    start = StateView('account.debt.start',
                      'account_debt.account_debt_start_view_form', [
                          Button('Cancel', 'end', 'tryton-cancel'),
                          Button('OK', 'print_', 'tryton-print', True),
                      ])
    print_ = StateReport('account.debt.report')

    def do_print_(self, action):
        data = {
            'company': self.start.company.id,
        }
        if self.start.parties:
            data.update({
                'parties': [p.id for p in self.start.parties],
            })
        return action, data
class PrintStockTraceability(Wizard):
    'Print Stock Traceability'
    __name__ = 'stock.print_traceability'
    start = StateView(
        'stock.traceability.start',
        'stock_traceability_report.print_stock_traceability_start_view_form', [
            Button('Cancel', 'end', 'tryton-cancel'),
            Button('Print', 'print_', 'tryton-print', default=True),
        ])
    print_ = StateReport('stock.traceability.report')

    def do_print_(self, action):
        context = Transaction().context
        data = {
            'from_date': self.start.from_date,
            'to_date': self.start.to_date,
            'warehouse': self.start.warehouse.id,
            'model': context.get('active_model'),
            'ids': context.get('active_ids'),
        }
        return action, data
Example #28
0
class PrintAbreviatedJournal(Wizard):
    'Print Abreviated Journal'
    __name__ = 'account_jasper_reports.print_abreviated_journal'
    start = StateView('account_jasper_reports.print_abreviated_journal.start',
        'account_jasper_reports.print_abreviated_journal_start_view_form', [
            Button('Cancel', 'end', 'tryton-cancel'),
            Button('Print', 'print_', 'tryton-print', default=True),
            ])
    print_ = StateReport('account_jasper_reports.abreviated_journal')

    def do_print_(self, action):
        data = {
            'company': self.start.company.id,
            'fiscalyear': self.start.fiscalyear.id,
            'display_account': self.start.display_account,
            'level': self.start.level,
            'output_format': self.start.output_format,
            }
        return action, data

    def transition_print_(self):
        return 'end'
Example #29
0
class PrintGeneralBalance(Wizard):
    'Print Consolidated General Balance'
    __name__ = 'print.consolidated_general_balance'

    start = StateView(
        'print.consolidated_general_balance.start',
        'account_consolidated.print_consolidated_general_balance_start_form', [
            Button('Cancel', 'end', 'tryton-cancel'),
            Button('Print', 'print_', 'tryton-print', default=True),
        ])
    print_ = StateReport('consolidated_general_balance.report')

    def do_print_(self, action):
        return action, {
            'company': self.start.company.id,
            'account': self.start.account.id,
            'companies': [{
                'id': x.id
            } for x in self.start.companies],
            'from_date': self.start.from_date,
            'to_date': self.start.to_date,
        }
Example #30
0
class PrintGeneralBalance(Wizard):
    'Print General Balance'
    __name__ = 'print.general_balance'

    start = StateView(
        'print.general_balance.start',
        'account_report.print_general_balance_start_form', [
            Button('Cancel', 'end', 'tryton-cancel'),
            Button('Print', 'print_', 'tryton-print', default=True),
        ])
    print_ = StateReport('general_balance.report')

    def do_print_(self, action):
        #start_date = self.start.date
        end_date = self.start.to_date
        #fiscalyear = self.start.fiscalyear.id
        #start_date = Date(start_date.year, start_date.month, start_date.day)
        end_date = Date(end_date.year, end_date.month, end_date.day)
        data = {
            'company': self.start.company.id,
            'account': self.start.account.id,
            #'fiscalyear': self.start.fiscalyear.name,
            #'fiscalyear_id': self.start.fiscalyear.id,
            #'start_date': self.start.fiscalyear.start_date,
            'end_date': self.start.to_date,
            'omit_zero': self.start.omit_zero,
        }
        action['pyson_context'] = PYSONEncoder().encode({
            'company':
            self.start.company.id,
            #'fiscalyear': self.start.fiscalyear.id,
            #'start_date': start_date,
            'end_date':
            end_date,
        })
        #if self.start.fiscalyear:
        #    action['name'] += ' - %s' % self.start.fiscalyear.rec_name
        return action, data