diff --git a/addons/account/account.py b/addons/account/account.py index 208bf1d6f68..3dc5c36c889 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1162,32 +1162,36 @@ class account_move(osv.osv): ] def post(self, cr, uid, ids, context=None): + if context is None: + context = {} invoice = context.get('invoice', False) valid_moves = self.validate(cr, uid, ids, context) - if valid_moves: - for move in self.browse(cr, uid, valid_moves): - if move.name =='/': - new_name = False - journal = move.journal_id + + if not valid_moves: + raise osv.except_osv(_('Integrity Error !'), _('You cannot validate a non-balanced entry !\nMake sure you have configured Payment Term properly !\nIt should contain atleast one Payment Term Line with type "Balance" !')) + + for move in self.browse(cr, uid, valid_moves): + if move.name =='/': + new_name = False + journal = move.journal_id - if invoice and invoice.internal_number: - new_name = invoice.internal_number + if invoice and invoice.internal_number: + new_name = invoice.internal_number + else: + if journal.sequence_id: + c = {'fiscalyear_id': move.period_id.fiscalyear_id.id} + new_name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id, context=c) else: - if journal.sequence_id: - c = {'fiscalyear_id': move.period_id.fiscalyear_id.id} - new_name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id, context=c) - else: - raise osv.except_osv(_('Error'), _('No sequence defined in the journal !')) + raise osv.except_osv(_('Error'), _('No sequence defined on the journal !')) - if new_name: - self.write(cr, uid, [move.id], {'name':new_name}) + if new_name: + self.write(cr, uid, [move.id], {'name':new_name}) - cr.execute('UPDATE account_move '\ - 'SET state=%s '\ - 'WHERE id IN %s', - ('posted', tuple(valid_moves),)) - else: - raise osv.except_osv(_('Integrity Error !'), _('You can not validate a non-balanced entry !\nMake sure you have configured Payment Term properly !\nIt should contain atleast one Payment Term Line with type "Balance" !')) + cr.execute('UPDATE account_move '\ + 'SET state=%s '\ + 'WHERE id IN %s', + ('posted', tuple(valid_moves),)) + return True def button_validate(self, cursor, user, ids, context=None): diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 1aa4e30d95d..2e81c7b054f 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -650,18 +650,19 @@ class account_invoice(osv.osv): return ok def button_reset_taxes(self, cr, uid, ids, context=None): - if not context: + if context is None: context = {} + ctx = context.copy() ait_obj = self.pool.get('account.invoice.tax') for id in ids: cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,)) - partner = self.browse(cr, uid, id, context=context).partner_id + partner = self.browse(cr, uid, id, context=ctx).partner_id if partner.lang: - context.update({'lang': partner.lang}) - for taxe in ait_obj.compute(cr, uid, id, context=context).values(): + ctx.update({'lang': partner.lang}) + for taxe in ait_obj.compute(cr, uid, id, context=ctx).values(): ait_obj.create(cr, uid, taxe) # Update the stored value (fields.function), so we write to trigger recompute - self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=context) + self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=ctx) return True def button_compute(self, cr, uid, ids, context=None, set_total=False): @@ -1621,6 +1622,7 @@ class account_invoice_tax(osv.osv): tax_grouped[key]['tax_amount'] += val['tax_amount'] for t in tax_grouped.values(): + t['base'] = cur_obj.round(cr, uid, cur, t['base']) t['amount'] = cur_obj.round(cr, uid, cur, t['amount']) t['base_amount'] = cur_obj.round(cr, uid, cur, t['base_amount']) t['tax_amount'] = cur_obj.round(cr, uid, cur, t['tax_amount']) diff --git a/addons/account/report/account_central_journal.rml b/addons/account/report/account_central_journal.rml index 4bf23b3d4b6..d6e53c4f3c7 100644 --- a/addons/account/report/account_central_journal.rml +++ b/addons/account/report/account_central_journal.rml @@ -295,7 +295,7 @@ [[ display_currency(data) == False or removeParentNode('blockTable') ]] - Total([[ company.currency_id.code]]): + Total: [[ formatLang( sum_debit(o.period_id.id, o.journal_id.id)) ]] [[ formatLang( sum_credit(o.period_id.id, o.journal_id.id)) ]] diff --git a/addons/account/report/account_general_journal.rml b/addons/account/report/account_general_journal.rml index 84a9ee6a780..61113212c2d 100644 --- a/addons/account/report/account_general_journal.rml +++ b/addons/account/report/account_general_journal.rml @@ -270,7 +270,7 @@ Balance - Total:([[ company.currency_id.code]]) + Total: [[ formatLang(sum_debit()) ]] [[ formatLang( sum_credit()) ]] diff --git a/addons/account/report/account_general_ledger_landscape.rml b/addons/account/report/account_general_ledger_landscape.rml index 1321bdea750..9d23454fcbb 100644 --- a/addons/account/report/account_general_ledger_landscape.rml +++ b/addons/account/report/account_general_ledger_landscape.rml @@ -263,13 +263,13 @@ - + [[ '..'*(o.level-1) ]][[ o.code ]] [[ o.name ]] - [[ formatLang(sum_debit_account(o), digits=get_digits(dp='Account')) ]] - [[ formatLang(sum_credit_account(o), digits=get_digits(dp='Account')) ]] - [[ formatLang(sum_balance_account(o), digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] - [[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.code or '' ]] + [[ formatLang(sum_debit_account(o), dp='Account') ]] + [[ formatLang(sum_credit_account(o), dp='Account') ]] + [[ formatLang(sum_balance_account(o), dp='Account') ]] [[ company.currency_id.symbol ]] + [[ o.currency_id and formatLang(sum_currency_amount_account(o), dp='Account') + o.currency_id.code or '' ]] @@ -292,9 +292,9 @@ [[ line['move'] ]] [[ line['lname'] ]] [[ strip_name(line['line_corresp'].replace(', ',','),40) ]] - [[ formatLang(line['debit'], digits=get_digits(dp='Account')) ]] - [[ formatLang(line['credit'], digits=get_digits(dp='Account')) ]] - [[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(line['debit'], dp='Account') ]] + [[ formatLang(line['credit'], dp='Account') ]] + [[ formatLang(line['progress'], dp='Account') ]] [[ company.currency_id.symbol ]] [[ formatLang(line['amount_currency'] or '')]] [[ line['currency_code'] or '' ]] @@ -327,9 +327,9 @@ [[ '..'*(o.level-1) ]][[ o.code ]] [[ o.name ]] - [[ formatLang(sum_debit_account(o), digits=get_digits(dp='Account')) ]] - [[ formatLang(sum_credit_account(o), digits=get_digits(dp=Account)) ]] - [[ formatLang(sum_balance_account(o), digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(sum_debit_account(o), dp='Account') ]] + [[ formatLang(sum_credit_account(o), dp='Account') ]] + [[ formatLang(sum_balance_account(o), dp='Account') ]] [[ company.currency_id.symbol ]] diff --git a/addons/account/report/overdue.rml b/addons/account/report/overdue.rml index a0748e281ac..d3d2c77e47a 100644 --- a/addons/account/report/overdue.rml +++ b/addons/account/report/overdue.rml @@ -46,11 +46,13 @@ - - - - - + + + + + + + @@ -116,7 +118,7 @@ Document: Customer account statement Date: [[ formatLang(time.strftime('%Y-%m-%d'),date=True) ]] - Customer Ref: [[ o.ref or '' ]] + Customer Ref: [[ o.ref or ' ']] @@ -181,10 +183,10 @@ [[ line['date_maturity'] and formatLang(line['date_maturity'],date=True) or '' ]] - [[ (line['account_id']['type'] == 'receivable' and formatLang(line['debit']) or 0) or (line['account_id']['type'] == 'payable' and formatLang(line['credit'] * -1) or ' ') ]] + [[ (line['account_id']['type'] == 'receivable' and formatLang(line['debit']) or 0) or (line['account_id']['type'] == 'payable' and formatLang(line['credit'] * -1) or ' ') ]] - [[ (line['account_id']['type'] == 'receivable' and formatLang(line['credit']) or 0) or (line['account_id']['type'] == 'payable' and formatLang(line['debit'] * -1) or 0) ]] + [[ (line['account_id']['type'] == 'receivable' and formatLang(line['credit']) or 0) or (line['account_id']['type'] == 'payable' and formatLang(line['debit'] * -1) or 0) ]] [[ formatLang((line['date_maturity'] < time.strftime('%Y-%m-%d'))) and formatLang(line['debit'] - line['credit']) ]] [[ company.currency_id.symbol ]] @@ -195,7 +197,7 @@ - + @@ -206,7 +208,7 @@ Sub-Total : - [[ formatLang((reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['debit'] or 0) or (y['account_id']['type'] == 'payable' and y['credit'] * -1 or 0)), getLines(o), 0))) ]] + [[ formatLang((reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['debit'] or 0) or (y['account_id']['type'] == 'payable' and y['credit'] * -1 or 0)), getLines(o), 0))) ]] [[ formatLang((reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['credit'] or 0) or (y['account_id']['type'] == 'payable' and y['debit'] * -1 or 0)), getLines(o), 0))) ]] @@ -220,6 +222,8 @@ + + @@ -230,25 +234,21 @@ Balance : - [[ formatLang((reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0))) ]] [[ company.currency_id.symbol ]] + [[ formatLang((reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0))) ]] [[ company.currency_id.symbol ]] - - - - - - - - - - - + + + + + + + Total amount due: [[ formatLang((reduce(lambda x, y: x + (y['debit'] - y['credit']), getLines(o), 0))) ]] [[ company.currency_id.symbol ]]. diff --git a/addons/account/wizard/account_automatic_reconcile.py b/addons/account/wizard/account_automatic_reconcile.py index efce4bc4da4..f94082445da 100644 --- a/addons/account/wizard/account_automatic_reconcile.py +++ b/addons/account/wizard/account_automatic_reconcile.py @@ -200,7 +200,8 @@ class account_automatic_reconcile(osv.osv_memory): "AND partner_id=%s " \ "AND reconcile_id IS NULL " \ "AND state <> 'draft' " \ - "AND debit > 0", + "AND debit > 0 " \ + "ORDER BY date_maturity", (account_id, partner_id)) debits = cr.fetchall() @@ -212,7 +213,8 @@ class account_automatic_reconcile(osv.osv_memory): "AND partner_id=%s " \ "AND reconcile_id IS NULL " \ "AND state <> 'draft' " \ - "AND credit > 0", + "AND credit > 0 " \ + "ORDER BY date_maturity", (account_id, partner_id)) credits = cr.fetchall() diff --git a/addons/account_analytic_default/account_analytic_default.py b/addons/account_analytic_default/account_analytic_default.py index d0405e1ff52..dce86597a4c 100644 --- a/addons/account_analytic_default/account_analytic_default.py +++ b/addons/account_analytic_default/account_analytic_default.py @@ -111,8 +111,9 @@ class sale_order_line(osv.osv): sale_line = self.browse(cr, uid, ids[0], context) inv_line_obj = self.pool.get('account.invoice.line') anal_def_obj = self.pool.get('account.analytic.default') + for line in inv_line_obj.browse(cr, uid, create_ids, context): - rec = anal_def_obj.account_get(cr, uid, line.product_id.id, sale_line.order_id.partner_id.id, uid, time.strftime('%Y-%m-%d'), context) + rec = anal_def_obj.account_get(cr, uid, line.product_id.id, sale_line.order_id.partner_id.id, sale_line.order_id.user_id.id, time.strftime('%Y-%m-%d'), context) if rec: inv_line_obj.write(cr, uid, [line.id], {'account_analytic_id':rec.analytic_id.id}, context=context) diff --git a/addons/account_analytic_default/account_analytic_default_view.xml b/addons/account_analytic_default/account_analytic_default_view.xml index 95a39eb11e6..939d8474250 100644 --- a/addons/account_analytic_default/account_analytic_default_view.xml +++ b/addons/account_analytic_default/account_analytic_default_view.xml @@ -53,14 +53,14 @@ - + Analytic Defaults account.analytic.default form tree,form - + - + + + - - 3 + + 3 + always diff --git a/addons/base_report_designer/base_report_designer_installer.xml b/addons/base_report_designer/base_report_designer_installer.xml index 4ea4970d19a..2c0cf191e4e 100644 --- a/addons/base_report_designer/base_report_designer_installer.xml +++ b/addons/base_report_designer/base_report_designer_installer.xml @@ -19,7 +19,7 @@ This plug-in allows you to create/modify OpenERP Reports into OpenOffice Writer. - +