diff --git a/addons/account/account.py b/addons/account/account.py index b97fd870749..92e698448a9 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -274,11 +274,11 @@ class account_account(osv.osv): tuple """ mapping = { - 'balance': "COALESCE(SUM(l.debit),0) " \ - "- COALESCE(SUM(l.credit), 0) as balance", + 'balance': "COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) as balance", 'debit': "COALESCE(SUM(l.debit), 0) as debit", 'credit': "COALESCE(SUM(l.credit), 0) as credit", - 'foreign_balance': "COALESCE(SUM(l.amount_currency), 0) as foreign_balance", + # by convention, foreign_balance is 0 when the account has no secondary currency, because the amounts may be in different currencies + 'foreign_balance': "(SELECT CASE WHEN currency_id IS NULL THEN 0 ELSE COALESCE(SUM(l.amount_currency), 0) END FROM account_account WHERE id IN (l.account_id)) as foreign_balance", } #get all the necessary accounts children_and_consolidated = self._get_children_and_consol(cr, uid, ids, context=context) @@ -305,7 +305,7 @@ class account_account(osv.osv): # ON l.account_id = tmp.id # or make _get_children_and_consol return a query and join on that request = ("SELECT l.account_id as id, " +\ - ', '.join(map(mapping.__getitem__, mapping.keys())) + + ', '.join(mapping.values()) + " FROM account_move_line l" \ " WHERE l.account_id IN %s " \ + filters + @@ -1773,6 +1773,7 @@ class account_tax_code(osv.osv): 'company_id': fields.many2one('res.company', 'Company', required=True), 'sign': fields.float('Coefficent for parent', required=True, help='You can specify here the coefficient that will be used when consolidating the amount of this case into its parent. For example, set 1/-1 if you want to add/substract it.'), 'notprintable':fields.boolean("Not Printable in Invoice", help="Check this box if you don't want any VAT related to this Tax Code to appear on invoices"), + 'sequence': fields.integer('Sequence', help="Determine the display order in the report 'Accounting \ Reporting \ Generic Reporting \ Taxes \ Taxes Report'"), } def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80): @@ -3356,13 +3357,14 @@ class wizard_multi_charts_accounts(osv.osv_memory): # because we can't rely on the value current_num as, # its possible that we already have bank journals created (e.g. by the creation of res.partner.bank) # and the next number for account code might have been already used before for journal - journal_count = 0 - while True: - journal_code = _('BNK') + str(current_num + journal_count) + for num in xrange(current_num, 100): + # journal_code has a maximal size of 5, hence we can enforce the boundary num < 100 + journal_code = _('BNK')[:3] + str(num) ids = obj_journal.search(cr, uid, [('code', '=', journal_code), ('company_id', '=', company_id)], context=context) if not ids: break - journal_count += 1 + else: + raise osv.except_osv(_('Error'), _('Cannot generate an unused journal code.')) vals = { 'name': line['acc_name'], diff --git a/addons/account/account_bank.py b/addons/account/account_bank.py index 54cba015f8e..5a84dee53de 100644 --- a/addons/account/account_bank.py +++ b/addons/account/account_bank.py @@ -26,6 +26,8 @@ class bank(osv.osv): _inherit = "res.partner.bank" _columns = { 'journal_id': fields.many2one('account.journal', 'Account Journal', help="This journal will be created automatically for this bank account when you save the record"), + 'currency_id': fields.related('journal_id', 'currency', type="many2one", relation='res.currency', readonly=True, + string="Currency", help="Currency of the related account journal."), } def create(self, cr, uid, data, context={}): result = super(bank, self).create(cr, uid, data, context=context) diff --git a/addons/account/account_bank_view.xml b/addons/account/account_bank_view.xml index 1a0e26e7c1f..8d0b1aa5db3 100644 --- a/addons/account/account_bank_view.xml +++ b/addons/account/account_bank_view.xml @@ -16,12 +16,26 @@ + + + Partner Bank Accounts - Add currency on tree + res.partner.bank + tree + + + + + + + + + Setup your Bank Accounts res.partner.bank diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index edab8f90b3f..f2e3e35e047 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -58,10 +58,12 @@ class account_invoice(osv.osv): return res and res[0] or False def _get_currency(self, cr, uid, context=None): - user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, [uid], context=context)[0] - if user.company_id: - return user.company_id.currency_id.id - return pooler.get_pool(cr.dbname).get('res.currency').search(cr, uid, [('rate','=', 1.0)])[0] + res = False + journal_id = self._get_journal(cr, uid, context=context) + if journal_id: + journal = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context) + res = journal.currency and journal.currency.id or journal.company_id.currency_id.id + return res def _get_journal_analytic(self, cr, uid, type_inv, context=None): type2journal = {'out_invoice': 'sale', 'in_invoice': 'purchase', 'out_refund': 'sale', 'in_refund': 'purchase'} @@ -464,10 +466,10 @@ class account_invoice(osv.osv): result['value'].update(to_update['value']) return result - def onchange_journal_id(self, cr, uid, ids, journal_id=False): + def onchange_journal_id(self, cr, uid, ids, journal_id=False, context=None): result = {} if journal_id: - journal = self.pool.get('account.journal').browse(cr, uid, journal_id) + journal = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context) currency_id = journal.currency and journal.currency.id or journal.company_id.currency_id.id result = {'value': { 'currency_id': currency_id, @@ -572,18 +574,6 @@ class account_invoice(osv.osv): else: journal_ids = obj_journal.search(cr, uid, []) - if currency_id and company_id: - currency = self.pool.get('res.currency').browse(cr, uid, currency_id) - if currency.company_id and currency.company_id.id != company_id: - val['currency_id'] = False - else: - val['currency_id'] = currency.id - if company_id: - company = self.pool.get('res.company').browse(cr, uid, company_id) - if company.currency_id.company_id and company.currency_id.company_id.id != company_id: - val['currency_id'] = False - else: - val['currency_id'] = company.currency_id.id return {'value': val, 'domain': dom} # go from canceled state to draft state diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 986f21c27fa..12a34975dd6 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -256,7 +256,7 @@
- + diff --git a/addons/account/account_report.xml b/addons/account/account_report.xml index 0288bbd61dd..78caf1c95b6 100644 --- a/addons/account/account_report.xml +++ b/addons/account/account_report.xml @@ -10,6 +10,7 @@ + \n" +"PO-Revision-Date: 2012-02-03 15:15+0000\n" +"Last-Translator: Ana Juaristi Olalde \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-01-14 05:11+0000\n" -"X-Generator: Launchpad (build 14664)\n" +"X-Launchpad-Export-Date: 2012-02-04 05:28+0000\n" +"X-Generator: Launchpad (build 14738)\n" #. module: account #: view:account.invoice.report:0 @@ -980,7 +980,7 @@ msgstr "" #: code:addons/account/account.py:2578 #, python-format msgid "I can not locate a parent code for the template account!" -msgstr "" +msgstr "No se puede localizar un padre para la cuenta de la plantilla" #. module: account #: view:account.analytic.line:0 @@ -1083,7 +1083,7 @@ msgstr "" #, python-format msgid "" "You have to provide an account for the write off/exchange difference entry !" -msgstr "" +msgstr "Debe proveer una cuenta de desajuste!" #. module: account #: view:account.tax:0 @@ -1265,7 +1265,7 @@ msgstr "Otros" #. module: account #: view:account.subscription:0 msgid "Draft Subscription" -msgstr "" +msgstr "Inscripcion borrador" #. module: account #: view:account.account:0 @@ -1723,7 +1723,7 @@ msgstr "" #. module: account #: view:account.analytic.account:0 msgid "Pending Accounts" -msgstr "" +msgstr "Cuentas pendientes" #. module: account #: code:addons/account/account_move_line.py:835 @@ -1942,7 +1942,7 @@ msgstr "Definición de impuestos" #: code:addons/account/account.py:3076 #, python-format msgid "Deposit" -msgstr "" +msgstr "Ingreso" #. module: account #: help:wizard.multi.charts.accounts,seq_journal:0 @@ -1982,6 +1982,7 @@ msgstr "Imagen" #: model:ir.actions.act_window,help:account.action_account_financial_report_tree msgid "Makes a generic system to draw financial reports easily." msgstr "" +"Realiza un sistema genérico para dibujar informes contables de forma sencilla" #. module: account #: view:account.invoice:0 @@ -2303,7 +2304,7 @@ msgstr "Dejarlo vacío para todos los ejercicios fiscales abiertos." #. module: account #: field:account.invoice.report,account_line_id:0 msgid "Account Line" -msgstr "" +msgstr "Linea de asiento" #. module: account #: code:addons/account/account.py:1465 @@ -2322,6 +2323,9 @@ msgid "" "'Setup Your Bank Accounts' tool that will automatically create the accounts " "and journals for you." msgstr "" +"Configure sus diarios contables. Para cuentas de bancos, es mejor usar la " +"herramienta 'Configurar sus cuentas de banco' que creará automáticamente las " +"cuentas y los diarios por usted." #. module: account #: model:ir.model,name:account.model_account_move @@ -2426,7 +2430,7 @@ msgstr "" #: model:account.payment.term,name:account.account_payment_term_advance #: model:account.payment.term,note:account.account_payment_term_advance msgid "30% Advance End 30 Days" -msgstr "" +msgstr "30% adelando después de 30 días" #. module: account #: view:account.entries.report:0 @@ -2568,7 +2572,7 @@ msgstr "" #. module: account #: model:ir.model,name:account.model_account_move_line_reconcile_writeoff msgid "Account move line reconcile (writeoff)" -msgstr "" +msgstr "Reconcilia linea de asiento (desajuste)" #. module: account #: report:account.invoice:0 @@ -2819,7 +2823,7 @@ msgstr "Códigos de impuestos" #. module: account #: view:account.account:0 msgid "Unrealized Gains and losses" -msgstr "" +msgstr "Perdidas y ganancias no realizadas" #. module: account #: model:ir.ui.menu,name:account.menu_account_customer @@ -3342,7 +3346,7 @@ msgstr "Cerrar un periodo" #. module: account #: field:account.financial.report,display_detail:0 msgid "Display details" -msgstr "" +msgstr "Muestra detalles" #. module: account #: report:account.overdue:0 @@ -3753,7 +3757,7 @@ msgstr "Nº asientos" #. module: account #: selection:account.invoice.refund,filter_refund:0 msgid "Create a draft Refund" -msgstr "" +msgstr "Crear una devolución en borrador" #. module: account #: view:account.account:0 @@ -3794,6 +3798,9 @@ msgid "" "centralised counterpart box in the related journal from the configuration " "menu." msgstr "" +"No puede crear una factura en un diario centralizado. Desclicke la casilla " +"\"Homólogo centralizado\" en el diario relacionado, desde el menú de " +"configuración" #. module: account #: field:account.account,name:0 @@ -3822,7 +3829,7 @@ msgstr "Fecha vigencia" #: model:ir.actions.act_window,name:account.action_bank_tree #: model:ir.ui.menu,name:account.menu_action_bank_tree msgid "Setup your Bank Accounts" -msgstr "" +msgstr "Configurar sus cuentas bancarias" #. module: account #: code:addons/account/wizard/account_move_bank_reconcile.py:53 @@ -3869,6 +3876,8 @@ msgid "" "Value of Loss or Gain due to changes in exchange rate when doing multi-" "currency transactions." msgstr "" +"Valor de pérdida o ganancia debido a cambios de divisa al realizar " +"transacciones multi-moneda" #. module: account #: view:account.analytic.line:0 @@ -3941,7 +3950,7 @@ msgstr "Tasa promedio" #: field:account.common.account.report,display_account:0 #: field:account.report.general.ledger,display_account:0 msgid "Display Accounts" -msgstr "" +msgstr "Mostrar cuentas" #. module: account #: view:account.state.open:0 @@ -3971,7 +3980,7 @@ msgstr "30 días fin de mes" #: code:addons/account/account_cash_statement.py:314 #, python-format msgid "The closing balance should be the same than the computed balance !" -msgstr "" +msgstr "El balance de cierre debería ser el mismo que el balance calculado" #. module: account #: model:ir.actions.act_window,name:account.action_account_analytic_balance @@ -3990,7 +3999,7 @@ msgstr "" #. module: account #: view:account.move.line:0 msgid "Posted Journal Items" -msgstr "" +msgstr "Asientos validados/asentados" #. module: account #: view:account.tax.template:0 @@ -4005,12 +4014,12 @@ msgstr "Asientos borrador" #. module: account #: view:account.payment.term.line:0 msgid " Day of the Month= -1" -msgstr "" +msgstr " Dia del mes = -1" #. module: account #: view:account.payment.term.line:0 msgid " Number of Days: 30" -msgstr "" +msgstr " Número de días: 30" #. module: account #: field:account.account,shortcut:0 @@ -4022,6 +4031,8 @@ msgstr "Abreviación" #: constraint:account.fiscalyear:0 msgid "Error! The start date of the fiscal year must be before his end date." msgstr "" +"Error! La fecha de inicio del año fiscal debe ser anterior a la fecha final " +"de este." #. module: account #: code:addons/account/account_invoice.py:484 @@ -4036,7 +4047,7 @@ msgstr "" #. module: account #: view:res.partner:0 msgid "Bank Account Owner" -msgstr "" +msgstr "Propietario cuenta bancaria" #. module: account #: report:account.account.balance:0 @@ -4114,7 +4125,7 @@ msgstr "Mes" #. module: account #: field:res.company,paypal_account:0 msgid "Paypal Account" -msgstr "" +msgstr "Cuenta Paypal" #. module: account #: field:account.invoice.report,uom_name:0 @@ -4130,7 +4141,7 @@ msgstr "Nota" #. module: account #: selection:account.financial.report,sign:0 msgid "Reverse balance sign" -msgstr "" +msgstr "Invertir signo del balance" #. module: account #: view:account.analytic.account:0 @@ -4144,7 +4155,7 @@ msgid "" "Can not create the invoice !\n" "The related payment term is probably misconfigured as it gives a computed " "amount greater than the total invoiced amount." -msgstr "" +msgstr "¡No puede crear la factura!" #. module: account #: selection:account.account.type,report_type:0 @@ -4183,7 +4194,7 @@ msgstr "Propiedades de contabilidad del cliente" #. module: account #: help:res.company,paypal_account:0 msgid "Paypal username (usually email) for receiving online payments." -msgstr "" +msgstr "Usuario Paypal (habitualmente un email) para recibir pagos online" #. module: account #: selection:account.aged.trial.balance,target_move:0 @@ -4249,7 +4260,7 @@ msgstr "Procesamiento periódico" #. module: account #: constraint:account.analytic.line:0 msgid "You can not create analytic line on view account." -msgstr "" +msgstr "No puede crear una línea analítica en una cuenta vista" #. module: account #: help:account.move.line,state:0 @@ -4294,7 +4305,7 @@ msgstr "Estadísticas de facturas" #. module: account #: field:account.account,exchange_rate:0 msgid "Exchange Rate" -msgstr "" +msgstr "Cambio de divisa" #. module: account #: model:process.transition,note:account.process_transition_paymentorderreconcilation0 @@ -4332,7 +4343,7 @@ msgstr "No implementado" #. module: account #: field:account.chart.template,visible:0 msgid "Can be Visible?" -msgstr "" +msgstr "¿Puede ser visible?" #. module: account #: model:ir.model,name:account.model_account_journal_select @@ -4347,7 +4358,7 @@ msgstr "Abonos" #. module: account #: sql_constraint:account.period:0 msgid "The name of the period must be unique per company!" -msgstr "" +msgstr "El nombre del periodo debe ser único por compañia!" #. module: account #: view:wizard.multi.charts.accounts:0 @@ -4367,6 +4378,10 @@ msgid "" "you want to generate accounts of this template only when loading its child " "template." msgstr "" +"Establezca esto a falso si no desea que esta plantilla sea utilizada de " +"forma activa en el asistente que genera el árbol de cuentas desde " +"plantillas. Esto es útil cuando desea generar cuentas de esta plantilla solo " +"al cargar su plantilla hija." #. module: account #: view:account.use.model:0 @@ -4385,6 +4400,8 @@ msgstr "Permitir conciliación" msgid "" "You can not modify company of this period as some journal items exists." msgstr "" +"No puede modificar la compañía de este periodo porque existen asientos " +"asociados" #. module: account #: view:account.analytic.account:0 @@ -4417,7 +4434,7 @@ msgstr "Modelos recurrentes" #: code:addons/account/account_move_line.py:1250 #, python-format msgid "Encoding error" -msgstr "" +msgstr "Error de codificación" #. module: account #: selection:account.automatic.reconcile,power:0 @@ -4467,7 +4484,7 @@ msgstr "Saldo de cierre basado en la caja." #. module: account #: view:account.payment.term.line:0 msgid "Example" -msgstr "" +msgstr "Ejemplo" #. module: account #: constraint:account.account:0 @@ -4540,7 +4557,7 @@ msgstr "" #. module: account #: selection:account.bank.statement,state:0 msgid "New" -msgstr "" +msgstr "Nuevo" #. module: account #: field:account.invoice.refund,date:0 @@ -4621,7 +4638,7 @@ msgstr "Facturas" #. module: account #: view:account.invoice:0 msgid "My invoices" -msgstr "" +msgstr "Mis facturas" #. module: account #: selection:account.bank.accounts.wizard,account_type:0 @@ -4644,7 +4661,7 @@ msgstr "Facturado" #. module: account #: view:account.move:0 msgid "Posted Journal Entries" -msgstr "" +msgstr "Asientos validados" #. module: account #: view:account.use.model:0 @@ -4694,6 +4711,9 @@ msgid "" "You can not define children to an account with internal type different of " "\"View\"! " msgstr "" +"Error de configuración!\n" +"¡No puede definir hijos para una cuenta con el tipo interno distinto de " +"\"vista\"! " #. module: account #: code:addons/account/account.py:922 diff --git a/addons/account/i18n/nl.po b/addons/account/i18n/nl.po index bbab01df936..5c26400a826 100644 --- a/addons/account/i18n/nl.po +++ b/addons/account/i18n/nl.po @@ -7,14 +7,14 @@ msgstr "" "Project-Id-Version: OpenERP Server 6.0dev\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2011-12-23 09:55+0000\n" -"PO-Revision-Date: 2012-01-17 18:16+0000\n" -"Last-Translator: Erwin (Endian Solutions) \n" +"PO-Revision-Date: 2012-02-01 08:48+0000\n" +"Last-Translator: Erwin \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-01-18 04:44+0000\n" -"X-Generator: Launchpad (build 14681)\n" +"X-Launchpad-Export-Date: 2012-02-02 05:58+0000\n" +"X-Generator: Launchpad (build 14738)\n" #. module: account #: code:addons/account/account.py:1306 @@ -448,7 +448,7 @@ msgstr "Het bedrag uitgedrukt in een optionele andere valuta." #. module: account #: field:accounting.report,enable_filter:0 msgid "Enable Comparison" -msgstr "" +msgstr "Vergelijking inschakelen" #. module: account #: help:account.journal.period,state:0 @@ -732,7 +732,7 @@ msgstr "Verkoop journaal in dit jaar" #. module: account #: selection:account.financial.report,display_detail:0 msgid "Display children with hierarchy" -msgstr "" +msgstr "Weergave kinderen met hiërarchie" #. module: account #: selection:account.payment.term.line,value:0 @@ -754,7 +754,7 @@ msgstr "Kostenplaatsboekingen per regel" #. module: account #: field:account.invoice.refund,filter_refund:0 msgid "Refund Method" -msgstr "" +msgstr "Teruggave Methode" #. module: account #: code:addons/account/wizard/account_change_currency.py:38 @@ -795,7 +795,7 @@ msgstr "Het relatiekenmerk of deze factuur" #. module: account #: view:account.invoice.report:0 msgid "Supplier Invoices And Refunds" -msgstr "" +msgstr "Leveranciers facturen en teruggaves" #. module: account #: view:account.move.line.unreconcile.select:0 @@ -809,6 +809,7 @@ msgstr "Maak afletteren ongedaan" #: view:account.payment.term.line:0 msgid "At 14 net days 2 percent, remaining amount at 30 days end of month." msgstr "" +"Op 14 dagen netto 2 procent, het resterende bedrag 30 dagen einde maand." #. module: account #: model:ir.model,name:account.model_account_analytic_journal_report @@ -824,7 +825,7 @@ msgstr "Automatisch afletteren" #: code:addons/account/account_move_line.py:1250 #, python-format msgid "No period found or period given is ambigous." -msgstr "" +msgstr "Geen periode gevonden of gegeven periode is dubbelzinnig." #. module: account #: model:ir.actions.act_window,help:account.action_account_gain_loss @@ -978,7 +979,7 @@ msgstr "" #: code:addons/account/account.py:2578 #, python-format msgid "I can not locate a parent code for the template account!" -msgstr "" +msgstr "Ik kan een ouder code voor de sjabloon account niet vinden!" #. module: account #: view:account.analytic.line:0 @@ -1157,7 +1158,7 @@ msgstr "Credit centralisatie" #. module: account #: view:report.account_type.sales:0 msgid "All Months Sales by type" -msgstr "" +msgstr "Alle maandverkopen op type" #. module: account #: model:ir.actions.act_window,help:account.action_invoice_tree2 @@ -1191,7 +1192,7 @@ msgstr "" #. module: account #: view:account.tax.template:0 msgid "Taxes used in Purchases" -msgstr "" +msgstr "Belastingen gebruikt in aankopen" #. module: account #: field:account.invoice.tax,tax_code_id:0 @@ -1332,7 +1333,7 @@ msgstr "Begin- en eindperiode selecteren" #. module: account #: model:account.financial.report,name:account.account_financial_report_profitandloss0 msgid "Profit and Loss" -msgstr "" +msgstr "Winst en Verlies" #. module: account #: model:ir.model,name:account.model_account_account_template @@ -1679,7 +1680,7 @@ msgstr "Facturatie" #: code:addons/account/report/account_partner_balance.py:115 #, python-format msgid "Unknown Partner" -msgstr "" +msgstr "Onbekende relatie" #. module: account #: field:account.tax.code,sum:0 @@ -1808,7 +1809,7 @@ msgstr "U kunt geen boekingsregel creëren op een gesloten rekening" #: code:addons/account/account.py:428 #, python-format msgid "Error!" -msgstr "" +msgstr "Fout!" #. module: account #: sql_constraint:account.move.line:0 @@ -1840,7 +1841,7 @@ msgstr "Boekingen per regel" #. module: account #: field:account.vat.declaration,based_on:0 msgid "Based on" -msgstr "" +msgstr "Gebaseerd op" #. module: account #: field:account.invoice,move_id:0 @@ -1929,7 +1930,7 @@ msgstr "Belasting instellingen" #: code:addons/account/account.py:3076 #, python-format msgid "Deposit" -msgstr "" +msgstr "Storting" #. module: account #: help:wizard.multi.charts.accounts,seq_journal:0 @@ -2139,7 +2140,7 @@ msgstr "" #. module: account #: report:account.invoice:0 msgid "Customer Code" -msgstr "" +msgstr "Klant Code" #. module: account #: view:account.installer:0 @@ -2176,7 +2177,7 @@ msgstr "Omschrijving" #: code:addons/account/account.py:3375 #, python-format msgid "Tax Paid at %s" -msgstr "" +msgstr "BTW betaald op %s" #. module: account #: code:addons/account/account.py:3189 @@ -2314,6 +2315,7 @@ msgstr "Boeking" #: constraint:res.partner:0 msgid "Error ! You cannot create recursive associated members." msgstr "" +"Fout! Het is niet mogelijk om recursieve geassocieerde leden te maken" #. module: account #: field:account.sequence.fiscalyear,sequence_main_id:0 @@ -2713,7 +2715,7 @@ msgstr "Financiële boekingen" #. module: account #: field:account.invoice,reference_type:0 msgid "Communication Type" -msgstr "" +msgstr "Communicatietype" #. module: account #: field:account.invoice.line,discount:0 @@ -3005,7 +3007,7 @@ msgstr "Kastransactie" #. module: account #: constraint:account.move.line:0 msgid "You can not create move line on view account." -msgstr "" +msgstr "U kunt geen boekingsregel creëren op een zichtrekening" #. module: account #: view:res.partner:0 @@ -3063,7 +3065,7 @@ msgstr "Altijd" #: view:account.invoice.report:0 #: view:analytic.entries.report:0 msgid "Month-1" -msgstr "" +msgstr "Maand-1" #. module: account #: view:account.analytic.line:0 @@ -3111,7 +3113,7 @@ msgstr "Kostenplaatsregels" #. module: account #: view:account.invoice:0 msgid "Proforma Invoices" -msgstr "" +msgstr "Proforma facturen" #. module: account #: model:process.node,name:account.process_node_electronicfile0 @@ -3126,7 +3128,7 @@ msgstr "Openstaand saldo verkopen" #. module: account #: view:account.payment.term.line:0 msgid " Day of the Month: 0" -msgstr "" +msgstr " Dag van de maand: 0" #. module: account #: view:account.subscription:0 @@ -3308,7 +3310,7 @@ msgstr "Sluit een periode af" #. module: account #: field:account.financial.report,display_detail:0 msgid "Display details" -msgstr "" +msgstr "Details weergeven" #. module: account #: report:account.overdue:0 @@ -3424,12 +3426,12 @@ msgstr "" #. module: account #: view:account.invoice.line:0 msgid "Quantity :" -msgstr "" +msgstr "Hoeveelheid:" #. module: account #: field:account.aged.trial.balance,period_length:0 msgid "Period Length (days)" -msgstr "" +msgstr "Periode lengte (dagen)" #. module: account #: field:account.invoice.report,state:0 @@ -3556,7 +3558,7 @@ msgstr "Datum" #. module: account #: view:account.move:0 msgid "Post" -msgstr "" +msgstr "Bericht" #. module: account #: view:account.unreconcile:0 @@ -3629,7 +3631,7 @@ msgstr "Geen filters" #. module: account #: view:account.invoice.report:0 msgid "Pro-forma Invoices" -msgstr "" +msgstr "Proforma facturen" #. module: account #: view:res.partner:0 @@ -3968,12 +3970,12 @@ msgstr "Conceptboekingen" #. module: account #: view:account.payment.term.line:0 msgid " Day of the Month= -1" -msgstr "" +msgstr " Dag van de maand= -1" #. module: account #: view:account.payment.term.line:0 msgid " Number of Days: 30" -msgstr "" +msgstr " Aantal dagen: 30" #. module: account #: field:account.account,shortcut:0 @@ -3999,7 +4001,7 @@ msgstr "" #. module: account #: view:res.partner:0 msgid "Bank Account Owner" -msgstr "" +msgstr "Rekeninghouder" #. module: account #: report:account.account.balance:0 @@ -4076,7 +4078,7 @@ msgstr "Maand" #. module: account #: field:res.company,paypal_account:0 msgid "Paypal Account" -msgstr "" +msgstr "Paypal rekening" #. module: account #: field:account.invoice.report,uom_name:0 @@ -4253,7 +4255,7 @@ msgstr "Factuur statistieken" #. module: account #: field:account.account,exchange_rate:0 msgid "Exchange Rate" -msgstr "" +msgstr "Wisselkoers" #. module: account #: model:process.transition,note:account.process_transition_paymentorderreconcilation0 @@ -4353,7 +4355,7 @@ msgstr "Analytische rekening statistieken" #. module: account #: report:account.vat.declaration:0 msgid "Based On" -msgstr "" +msgstr "Gebaseerd op" #. module: account #: field:account.tax,price_include:0 @@ -4376,7 +4378,7 @@ msgstr "Terugkerende modellen" #: code:addons/account/account_move_line.py:1250 #, python-format msgid "Encoding error" -msgstr "" +msgstr "Coderingsfout" #. module: account #: selection:account.automatic.reconcile,power:0 @@ -4426,7 +4428,7 @@ msgstr "Eindbalans gebaseerd op cashregister" #. module: account #: view:account.payment.term.line:0 msgid "Example" -msgstr "" +msgstr "Voorbeeld" #. module: account #: constraint:account.account:0 @@ -4496,7 +4498,7 @@ msgstr "" #. module: account #: selection:account.bank.statement,state:0 msgid "New" -msgstr "" +msgstr "Nieuw" #. module: account #: field:account.invoice.refund,date:0 @@ -4542,7 +4544,7 @@ msgstr "Inkomstenrekening op product sjabloon" #: code:addons/account/account.py:3190 #, python-format msgid "MISC" -msgstr "" +msgstr "DIV" #. module: account #: model:email.template,subject:account.email_template_edi_invoice @@ -4575,7 +4577,7 @@ msgstr "Facturen" #. module: account #: view:account.invoice:0 msgid "My invoices" -msgstr "" +msgstr "Mijn rekeningen" #. module: account #: selection:account.bank.accounts.wizard,account_type:0 @@ -4653,7 +4655,7 @@ msgstr "" #: code:addons/account/account.py:922 #, python-format msgid "Opening Period" -msgstr "" +msgstr "Openingspriode" #. module: account #: view:account.move:0 @@ -4751,7 +4753,7 @@ msgstr "" #. module: account #: sql_constraint:account.invoice:0 msgid "Invoice Number must be unique per Company!" -msgstr "" +msgstr "Factuurnummer moet uniek zijn per bedrijf!" #. module: account #: model:ir.actions.act_window,name:account.action_account_receivable_graph @@ -4766,7 +4768,7 @@ msgstr "Genereer boekjaar openingsbalans" #. module: account #: model:res.groups,name:account.group_account_user msgid "Accountant" -msgstr "" +msgstr "Accountant" #. module: account #: model:ir.actions.act_window,help:account.action_account_treasury_report_all @@ -4905,7 +4907,7 @@ msgstr "Doelrekening" #: model:account.payment.term,name:account.account_payment_term_net #: model:account.payment.term,note:account.account_payment_term_net msgid "30 Net Days" -msgstr "" +msgstr "30 dagen netto" #. module: account #: field:account.subscription,period_type:0 @@ -4960,7 +4962,7 @@ msgstr "" #: field:account.financial.report,children_ids:0 #: model:ir.model,name:account.model_account_financial_report msgid "Account Report" -msgstr "" +msgstr "Rapport van rekening" #. module: account #: field:account.journal.column,name:0 @@ -5046,7 +5048,7 @@ msgstr "" #. module: account #: field:account.invoice,residual:0 msgid "To Pay" -msgstr "" +msgstr "Te betalen" #. module: account #: model:ir.ui.menu,name:account.final_accounting_reports @@ -5097,7 +5099,7 @@ msgstr "Verkoop" #. module: account #: view:account.financial.report:0 msgid "Report" -msgstr "" +msgstr "Rapport" #. module: account #: view:account.analytic.line:0 @@ -5175,7 +5177,7 @@ msgstr "Gebruik deze code voor de BTW-aangifte" #. module: account #: field:account.partner.reconcile.process,progress:0 msgid "Progress" -msgstr "" +msgstr "Voortgang" #. module: account #: view:report.hr.timesheet.invoice.journal:0 @@ -5288,7 +5290,7 @@ msgstr "Overzicht van facturen gemaakt binnen de laatste 15 dagen" #. module: account #: view:account.payment.term.line:0 msgid " Number of Days: 14" -msgstr "" +msgstr " Aantal dagen: 14" #. module: account #: field:account.fiscalyear,end_journal_period_id:0 @@ -5311,7 +5313,7 @@ msgstr "Configuratiefout !" #. module: account #: field:account.payment.term.line,value_amount:0 msgid "Amount To Pay" -msgstr "" +msgstr "Te betalen bedrag" #. module: account #: help:account.partner.reconcile.process,to_reconcile:0 @@ -8541,6 +8543,8 @@ msgid "" "The amount of the voucher must be the same amount as the one on the " "statement line" msgstr "" +"Het bedrag op het bon moet hetzelfde bedrag zijn zoals vermeld op de " +"afschriftregel." #. module: account #: model:account.account.type,name:account.data_account_type_expense diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py index d43adeef2be..2e0a031cb1d 100644 --- a/addons/account/report/account_journal.py +++ b/addons/account/report/account_journal.py @@ -30,8 +30,9 @@ class journal_print(report_sxw.rml_parse, common_report_header): context = {} super(journal_print, self).__init__(cr, uid, name, context=context) self.period_ids = [] + self.last_move_id = False self.journal_ids = [] - self.sort_selection = 'date' + self.sort_selection = 'am.name' self.localcontext.update({ 'time': time, 'lines': self.lines, @@ -47,6 +48,10 @@ class journal_print(report_sxw.rml_parse, common_report_header): 'display_currency':self._display_currency, 'get_sortby': self._get_sortby, 'get_target_move': self._get_target_move, + 'check_last_move_id': self.check_last_move_id, + 'set_last_move_id': self.set_last_move_id, + 'tax_codes': self.tax_codes, + 'sum_vat': self._sum_vat, }) def set_context(self, objects, data, ids, report_type=None): @@ -66,6 +71,39 @@ class journal_print(report_sxw.rml_parse, common_report_header): self.period_ids, self.journal_ids = zip(*res) return super(journal_print, self).set_context(objects, data, ids, report_type=report_type) + def set_last_move_id(self, move_id): + self.last_move_id = move_id + + def check_last_move_id(self, move_id): + ''' + return True if we need to draw a gray line above this line, used to separate moves + ''' + if self.last_move_id: + return not(self.last_move_id == move_id) + return False + + def tax_codes(self, period_id, journal_id): + ids_journal_period = self.pool.get('account.journal.period').search(self.cr, self.uid, + [('journal_id', '=', journal_id), ('period_id', '=', period_id)]) + self.cr.execute( + 'select distinct tax_code_id from account_move_line ' \ + 'where period_id=%s and journal_id=%s and tax_code_id is not null and state<>\'draft\'', + (period_id, journal_id) + ) + ids = map(lambda x: x[0], self.cr.fetchall()) + tax_code_ids = [] + if ids: + self.cr.execute('select id from account_tax_code where id in %s order by code', (tuple(ids),)) + tax_code_ids = map(lambda x: x[0], self.cr.fetchall()) + tax_codes = self.pool.get('account.tax.code').browse(self.cr, self.uid, tax_code_ids) + return tax_codes + + def _sum_vat(self, period_id, journal_id, tax_code_id): + self.cr.execute('select sum(tax_amount) from account_move_line where ' \ + 'period_id=%s and journal_id=%s and tax_code_id=%s and state<>\'draft\'', + (period_id, journal_id, tax_code_id)) + return self.cr.fetchone()[0] or 0.0 + def _sum_debit(self, period_id=False, journal_id=False): if journal_id and isinstance(journal_id, int): journal_id = [journal_id] @@ -118,7 +156,7 @@ class journal_print(report_sxw.rml_parse, common_report_header): if self.target_move == 'posted': move_state = ['posted'] - self.cr.execute('SELECT l.id FROM account_move_line l, account_move am WHERE l.move_id=am.id AND am.state IN %s AND l.period_id=%s AND l.journal_id IN %s ' + self.query_get_clause + ' ORDER BY l.'+ self.sort_selection + ', l.move_id',(tuple(move_state), period_id, tuple(journal_id) )) + self.cr.execute('SELECT l.id FROM account_move_line l, account_move am WHERE l.move_id=am.id AND am.state IN %s AND l.period_id=%s AND l.journal_id IN %s ' + self.query_get_clause + ' ORDER BY '+ self.sort_selection + ', l.move_id',(tuple(move_state), period_id, tuple(journal_id) )) ids = map(lambda x: x[0], self.cr.fetchall()) return obj_mline.browse(self.cr, self.uid, ids) @@ -155,5 +193,6 @@ class journal_print(report_sxw.rml_parse, common_report_header): return 'Date' report_sxw.report_sxw('report.account.journal.period.print', 'account.journal.period', 'addons/account/report/account_journal.rml', parser=journal_print, header='internal') +report_sxw.report_sxw('report.account.journal.period.print.sale.purchase', 'account.journal.period', 'addons/account/report/account_journal_sale_purchase.rml', parser=journal_print, header='internal') # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/report/account_journal.rml b/addons/account/report/account_journal.rml index 122b195c1ef..acc11acaa98 100644 --- a/addons/account/report/account_journal.rml +++ b/addons/account/report/account_journal.rml @@ -18,10 +18,7 @@ - - - - + @@ -119,11 +116,17 @@ - - - + - + + + + + + + + + @@ -173,101 +176,92 @@ [[ repeatIn(objects, 'o') ]] - + - - Journal - + Journal - - - - - - - [[ data['model']=='account.journal.period'and 'Company' or removeParentNode('para') ]] - [[ data['model']=='ir.ui.menu' and 'Chart of Accounts' or removeParentNode('para') ]] - Fiscal Year - Journal - Filters By - Entries Sorted By - Target Moves - - - [[ get_account(data) or '' ]] - [[ get_fiscalyear(data) or '' ]] - [[o.journal_id.name ]] - [[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] - [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] - - Start Date - End Date - - - [[ formatLang(get_start_date(data),date=True) ]] - [[ formatLang(get_end_date(data),date=True) ]] - - - [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] - - Start Period - End Period - - - [[ get_start_period(data) or removeParentNode('para') ]] - [[ get_end_period(data) or removeParentNode('para') ]] - - - - [[ get_sortby(data) ]] - [[ get_target_move(data) ]] - - - - - [[ display_currency(data) == False or removeParentNode('blockTable') ]] + - Date - Ref - Move - Account - Partner - Label - Debit - Credit + [[ data['model']=='account.journal.period'and 'Company' or removeParentNode('para') ]] + [[ data['model']=='ir.ui.menu' and 'Chart of Accounts' or removeParentNode('para') ]] + Fiscal Year + Journal + Period + Entries Sorted By + Target Moves - - [[o.period_id.name ]] - [[ o.journal_id.code ]] - - - - - [[ formatLang(sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]] - [[ formatLang(sum_credit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]] - - [[lines(o.period_id.id, o.journal_id.id) or removeParentNode('story') ]] - [[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]][[ formatLang(line.date,date=True) ]] - [[ strip_name(line.ref,20) ]] - [[ line.move_id.name <> '/' and line.move_id.name or ('*'+str(line.move_id.id)) ]] - [[ line.account_id.code ]] - [[ line.partner_id and strip_name(line.partner_id.name,17) ]] - [[ strip_name(line.name,27) ]] - [[ formatLang(line.debit, currency_obj=company.currency_id) ]] - [[ formatLang(line.credit, currency_obj=company.currency_id) ]] + [[ get_account(data) or '' ]] + [[ get_fiscalyear(data) or '' ]] + [[ o.journal_id.name ]] + [[ o.period_id.name ]] + [[ get_sortby(data) ]] + [[ get_target_move(data) ]] + + + + + + + [[lines(o.period_id.id, o.journal_id.id) or removeParentNode('story') ]][[ set_last_move_id(False)]] +
+ [[ display_currency(data) == False or removeParentNode('section') ]] + + + Move + Date + Account + Partner + Label + Debit + Credit + + +
+ [[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]] + + + [[ not check_last_move_id(line.move_id.id) and removeParentNode('blockTable') ]] + + + + + [[ line.move_id.name <> '/' and line.move_id.name or ('*'+str(line.move_id.id)) ]] + [[ formatLang(line.date,date=True) ]] + [[ line.account_id.code ]] + [[ line.partner_id and strip_name(line.partner_id.name,23) ]] + [[ strip_name(line.name,35) ]] + [[ formatLang(line.debit, currency_obj=company.currency_id) ]] + [[ formatLang(line.credit, currency_obj=company.currency_id) ]] + + + [[ set_last_move_id(line.move_id.id) ]] +
+ + + + + + + Total: + [[ formatLang(sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]] + [[ formatLang(sum_credit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]] + + +
- [[ display_currency(data) or removeParentNode('blockTable') ]] +
+ [[ display_currency(data) or removeParentNode('section') ]] + - Date - Ref Move + Date Account Partner Label @@ -275,30 +269,41 @@ Credit Currency - - [[o.period_id.name ]] - [[ o.journal_id.code ]] - - - - - [[ formatLang(sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]] - [[ formatLang(sum_credit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]] - - - - [[lines(o.period_id.id, o.journal_id.id) or removeParentNode('story') ]] - - [[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]][[ formatLang(line.date,date=True) ]] - [[ strip_name(line.ref,20) ]] - [[ line.move_id.name <> '/' and line.move_id.name or ('*'+str(line.move_id.id)) ]] - [[ line.account_id.code ]] - [[ line.partner_id and strip_name(line.partner_id.name,15) ]] - [[ strip_name(line.name,17) ]] - [[ formatLang(line.debit, currency_obj=company.currency_id) ]] - [[ formatLang(line.credit, currency_obj=company.currency_id) ]] - [[ line.currency_id and formatLang(line.amount_currency, currency_obj=line.currency_id) or '' ]] - - + +
+ [[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]] + + + [[ not check_last_move_id(line.move_id.id) and removeParentNode('blockTable') ]] + + + + + [[ line.move_id.name <> '/' and line.move_id.name or ('*'+str(line.move_id.id)) ]] + [[ formatLang(line.date,date=True) ]] + [[ line.account_id.code ]] + [[ line.partner_id and strip_name(line.partner_id.name,17) ]] + [[ strip_name(line.name,28) ]] + [[ formatLang(line.debit, currency_obj=company.currency_id) ]] + [[ formatLang(line.credit, currency_obj=company.currency_id) ]] + [[ line.currency_id and formatLang(line.amount_currency, currency_obj=line.currency_id) or '' ]] + + + [[ set_last_move_id(line.move_id.id) ]] +
+ + + + + + + Total: + [[ formatLang(sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]] + [[ formatLang(sum_credit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]] + + + + +
diff --git a/addons/account/report/account_journal_sale_purchase.rml b/addons/account/report/account_journal_sale_purchase.rml new file mode 100644 index 00000000000..fc42bb0a08d --- /dev/null +++ b/addons/account/report/account_journal_sale_purchase.rml @@ -0,0 +1,346 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [[ repeatIn(objects, 'o') ]] + + + + Journal + + + + + + + + [[ data['model']=='account.journal.period'and 'Company' or removeParentNode('para') ]] + [[ data['model']=='ir.ui.menu' and 'Chart of Accounts' or removeParentNode('para') ]] + Fiscal Year + Journal + Period + Entries Sorted By + Target Moves + + + [[ get_account(data) or '' ]] + [[ get_fiscalyear(data) or '' ]] + [[ o.journal_id.name ]] + [[ o.period_id.name ]] + [[ get_sortby(data) ]] + [[ get_target_move(data) ]] + + + + + + + + + [[lines(o.period_id.id, o.journal_id.id) or removeParentNode('story') ]][[ set_last_move_id(False)]] +
+ [[ display_currency(data) == False or removeParentNode('section') ]] + + + Move + Date + Account + Partner + Label + VAT + + Debit + Credit + + +
+ [[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]] + + + [[ not check_last_move_id(line.move_id.id) and removeParentNode('blockTable') ]] + + + + + [[ line.move_id.name <> '/' and line.move_id.name or ('*'+str(line.move_id.id)) ]] + [[ formatLang(line.date,date=True) ]] + [[ line.account_id.code ]] + [[ line.partner_id and strip_name(line.partner_id.name,17) ]] + [[ strip_name(line.name,25) ]] + [[ line.tax_code_id and (line.tax_code_id.code + ':') ]] + [[ line.tax_amount and formatLang(line.tax_amount, currency_obj=company.currency_id) ]] + [[ formatLang(line.debit, currency_obj=company.currency_id) ]] + [[ formatLang(line.credit, currency_obj=company.currency_id) ]] + + + [[ set_last_move_id(line.move_id.id) ]] +
+ + + + + + + + + Total: + [[ formatLang(sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]] + [[ formatLang(sum_credit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]] + + +
+ +
+ [[ display_currency(data) or removeParentNode('section') ]] + + + Move + Date + Account + Partner + Label + VAT + + Debit + Credit + Currency + + +
+ [[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]] + + + [[ not check_last_move_id(line.move_id.id) and removeParentNode('blockTable') ]] + + + + + [[ line.move_id.name <> '/' and line.move_id.name or ('*'+str(line.move_id.id)) ]] + [[ formatLang(line.date,date=True) ]] + [[ line.account_id.code ]] + [[ line.partner_id and strip_name(line.partner_id.name,17) ]] + [[ strip_name(line.name,17) ]] + [[ line.tax_code_id and (line.tax_code_id.code + ':') ]] + [[ line.tax_amount and formatLang(line.tax_amount, currency_obj=company.currency_id) ]] + [[ formatLang(line.debit, currency_obj=company.currency_id) ]] + [[ formatLang(line.credit, currency_obj=company.currency_id) ]] + [[ line.currency_id and formatLang(line.amount_currency, currency_obj=line.currency_id) or '' ]] + + + [[ set_last_move_id(line.move_id.id) ]] +
+ + + + + + + + + Total: + [[ formatLang(sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]] + [[ formatLang(sum_credit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]] + + + + +
+ + + + + + + +
+ + + + + + VAT Declaration + + + + + [[ repeatIn(tax_codes(o.period_id.id,o.journal_id.id), 't') ]][[ t.code + ': ' ]] + [[ formatLang(sum_vat( o.period_id.id, o.journal_id.id, t.id)) ]] + + [[ t.name ]] + + +
+
+
diff --git a/addons/account/report/account_tax_report.py b/addons/account/report/account_tax_report.py index a3bdc1a75f6..2a0c5987b47 100644 --- a/addons/account/report/account_tax_report.py +++ b/addons/account/report/account_tax_report.py @@ -32,6 +32,7 @@ class tax_report(report_sxw.rml_parse, common_report_header): res = {} self.period_ids = [] period_obj = self.pool.get('account.period') + self.display_detail = data['form']['display_detail'] res['periods'] = '' res['fiscalyear'] = data['form'].get('fiscalyear_id', False) @@ -104,6 +105,8 @@ class tax_report(report_sxw.rml_parse, common_report_header): return top_result def _get_general(self, tax_code_id, period_list, company_id, based_on, context=None): + if not self.display_detail: + return [] res = [] obj_account = self.pool.get('account.account') periods_ids = tuple(period_list) @@ -159,7 +162,7 @@ class tax_report(report_sxw.rml_parse, common_report_header): def _get_codes(self, based_on, company_id, parent=False, level=0, period_list=[], context=None): obj_tc = self.pool.get('account.tax.code') - ids = obj_tc.search(self.cr, self.uid, [('parent_id','=',parent),('company_id','=',company_id)], context=context) + ids = obj_tc.search(self.cr, self.uid, [('parent_id','=',parent),('company_id','=',company_id)], order='sequence', context=context) res = [] for code in obj_tc.browse(self.cr, self.uid, ids, {'based_on': based_on}): @@ -229,4 +232,4 @@ class tax_report(report_sxw.rml_parse, common_report_header): report_sxw.report_sxw('report.account.vat.declaration', 'account.tax.code', 'addons/account/report/account_tax_report.rml', parser=tax_report, header="internal") -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/test/account_report.yml b/addons/account/test/account_report.yml index 45b5605ce31..6a4d04daa70 100644 --- a/addons/account/test/account_report.yml +++ b/addons/account/test/account_report.yml @@ -102,7 +102,7 @@ journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')] ctx={} ctx.update({'model': 'account.journal.period','active_ids':journal_ids}) - data_dict = {'chart_account_id':ref('account.chart0')} + data_dict = {'chart_account_id':ref('account.chart0'), 'period_from':ref('period_1'), 'period_to':ref('period_12')} from tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_print_journal',wiz_data=data_dict, context=ctx, our_module='account') - diff --git a/addons/account/wizard/account_report_print_journal.py b/addons/account/wizard/account_report_print_journal.py index 1fe350349b6..0ffbde3fa9e 100644 --- a/addons/account/wizard/account_report_print_journal.py +++ b/addons/account/wizard/account_report_print_journal.py @@ -20,6 +20,7 @@ ############################################################################## from osv import osv, fields +from lxml import etree class account_print_journal(osv.osv_memory): _inherit = "account.common.journal.report" @@ -27,21 +28,49 @@ class account_print_journal(osv.osv_memory): _description = 'Account Print Journal' _columns = { - 'sort_selection': fields.selection([('date', 'Date'), - ('ref', 'Reference Number'),], + 'sort_selection': fields.selection([('l.date', 'Date'), + ('am.name', 'Journal Entry Number'),], 'Entries Sorted by', required=True), 'journal_ids': fields.many2many('account.journal', 'account_print_journal_journal_rel', 'account_id', 'journal_id', 'Journals', required=True), } + _defaults = { - 'sort_selection': 'date', + 'sort_selection': 'am.name', + 'filter': 'filter_period', + 'journal_ids': False, } + def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): + ''' + used to set the domain on 'journal_ids' field: we exclude or only propose the journals of type + sale/purchase (+refund) accordingly to the presence of the key 'sale_purchase_only' in the context. + ''' + if context is None: + context = {} + res = super(account_print_journal, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) + doc = etree.XML(res['arch']) + + if context.get('sale_purchase_only'): + domain ="[('type', 'in', ('sale','purchase','sale_refund','purchase_refund'))]" + else: + domain ="[('type', 'not in', ('sale','purchase','sale_refund','purchase_refund'))]" + nodes = doc.xpath("//field[@name='journal_ids']") + for node in nodes: + node.set('domain', domain) + res['arch'] = etree.tostring(doc) + return res + + def _print_report(self, cr, uid, ids, data, context=None): if context is None: context = {} data = self.pre_print_report(cr, uid, ids, data, context=context) data['form'].update(self.read(cr, uid, ids, ['sort_selection'], context=context)[0]) - return {'type': 'ir.actions.report.xml', 'report_name': 'account.journal.period.print', 'datas': data} + if context.get('sale_purchase_only'): + report_name = 'account.journal.period.print.sale.purchase' + else: + report_name = 'account.journal.period.print' + return {'type': 'ir.actions.report.xml', 'report_name': report_name, 'datas': data} account_print_journal() diff --git a/addons/account/wizard/account_report_print_journal_view.xml b/addons/account/wizard/account_report_print_journal_view.xml index 4d2359c5a80..a462be91d9c 100644 --- a/addons/account/wizard/account_report_print_journal_view.xml +++ b/addons/account/wizard/account_report_print_journal_view.xml @@ -17,6 +17,16 @@ + + + + + + + + + + @@ -31,7 +41,6 @@ new - + + Print Sale/Purchase Journal + ir.actions.act_window + account.print.journal + form + form + new + {'sale_purchase_only':True} + + + + + diff --git a/addons/account/wizard/account_vat.py b/addons/account/wizard/account_vat.py index cbdf18d314a..0770cbe246c 100644 --- a/addons/account/wizard/account_vat.py +++ b/addons/account/wizard/account_vat.py @@ -30,6 +30,7 @@ class account_vat_declaration(osv.osv_memory): ('payments', 'Payments'),], 'Based on', required=True), 'chart_tax_id': fields.many2one('account.tax.code', 'Chart of Tax', help='Select Charts of Taxes', required=True, domain = [('parent_id','=', False)]), + 'display_detail': fields.boolean('Display Detail'), } def _get_tax(self, cr, uid, context=None): diff --git a/addons/account/wizard/account_vat_view.xml b/addons/account/wizard/account_vat_view.xml index 5cb68563352..d8e7560e029 100644 --- a/addons/account/wizard/account_vat_view.xml +++ b/addons/account/wizard/account_vat_view.xml @@ -13,10 +13,11 @@ + - - + +