From b352ccc815709862a24ab4eb8aca97ded3ff9502 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Fri, 19 Nov 2010 10:53:05 +0530 Subject: [PATCH 01/30] [IMP] account_voucher: writeoff implementation bzr revid: psi@tinyerp.co.in-20101119052305-tmev02bzyyy2n3b0 --- addons/account/account_move_line.py | 2 + addons/account_voucher/account_voucher.py | 125 +++--------------- .../wizard/account_voucher_payment_option.py | 80 +++-------- .../wizard/account_voucher_payment_option.xml | 3 +- 4 files changed, 37 insertions(+), 173 deletions(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 93d5c37bd08..16ea52b65d4 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -716,6 +716,8 @@ class account_move_line(osv.osv): account_id = line['account_id']['id'] partner_id = (line['partner_id'] and line['partner_id']['id']) or False writeoff = debit - credit + if 'write_off' in context and context['write_off']['writeoff_amount']: + writeoff = context['write_off']['writeoff_amount'] # Ifdate_p in context => take this date if context.has_key('date_p') and context['date_p']: diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 14abad25413..bc5fef3ab44 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -543,7 +543,7 @@ class account_voucher(osv.osv): mod_obj = self.pool.get('ir.model.data') if context is None: context = {} - voucher = self.browse(cr, uid, [ids[0]], context=context)[0] + voucher = self.browse(cr, uid, ids, context=context)[0] debit= credit = 0.0 if voucher.line_dr_ids: for line in voucher.line_dr_ids: @@ -666,7 +666,6 @@ class account_voucher(osv.osv): 'date': inv.date, 'date_maturity': inv.date_due } - if (debit == 0.0 or credit == 0.0 or debit+credit > 0) and (debit > 0.0 or credit > 0.0): master_line = move_line_pool.create(cr, uid, move_line) @@ -719,9 +718,14 @@ class account_voucher(osv.osv): sign = (move_line['debit'] - move_line['credit']) < 0 and -1 or 1 move_line['amount_currency'] = company_currency <> current_currency and sign * line.amount or 0.0 master_line = move_line_pool.create(cr, uid, move_line) + test_ids.append('master_line') if line.move_line_id.id: rec_ids = [master_line, line.move_line_id.id] rec_list_ids.append(rec_ids) + writeoff_account_id = False + writeoff_journal_id = False + writeoff_period_id = inv.period_id.id, + comment = False if not currency_pool.is_zero(cr, uid, inv.currency_id, line_total): diff = line_total @@ -745,119 +749,22 @@ class account_voucher(osv.osv): move_line['account_id'] = account_id move_line_pool.create(cr, uid, move_line) + for rec_ids in rec_list_ids: + if len(rec_ids) >= 2: + if 'write_off' in context and context['write_off']['writeoff_acc_id']: + writeoff_account_id = context['write_off']['writeoff_acc_id'] + writeoff_journal_id = context['write_off']['writeoff_journal_id'] + comment = context['write_off']['comment'] + self.pool.get('account.move.line').reconcile(cr, uid, rec_ids, 'manual', writeoff_account_id, writeoff_period_id, writeoff_journal_id, context) + else: + self.pool.get('account.move.line').reconcile_partial(cr, uid, rec_ids, 'manual', context) + self.write(cr, uid, [inv.id], { 'move_id': move_id, 'state': 'posted', 'number': name, }) move_pool.post(cr, uid, [move_id], context={}) - for rec_ids in rec_list_ids: - if len(rec_ids) >= 2: - move_line_pool.reconcile_partial(cr, uid, rec_ids) - return True - - def pay_and_reconcile(self, cr, uid, ids, pay_amount, pay_account_id, period_id, pay_journal_id, writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context=None, name=''): - if context is None: - context = {} - seq_obj = self.pool.get('ir.sequence') - #TODO check if we can use different period for payment and the writeoff line - assert len(ids)==1, "Can only pay one voucher at a time" - voucher = self.browse(cr, uid, ids[0]) - if voucher.number: - name = voucher.number - elif voucher.journal_id.sequence_id: - name = seq_obj.get_id(cr, uid, voucher.journal_id.sequence_id.id) - else: - raise osv.except_osv(_('Error !'), _('Please define a sequence on the journal !')) - if not voucher.reference: - ref = name.replace('/','') - else: - ref = voucher.reference - - src_account_id = voucher.account_id.id - # Take the seq as name for move - types = {'sale': -1, 'purchase': 1, 'payment': 1, 'receipt': -1} - direction = types[voucher.type] - #take the choosen date - if 'date_p' in context and context['date_p']: - date = context['date_p'] - else: - date = time.strftime('%Y-%m-%d') - # Take the amount in currency and the currency of the payment - if 'amount_currency' in context and context['amount_currency'] and 'currency_id' in context and context['currency_id']: - amount_currency = context['amount_currency'] - currency_id = context['currency_id'] - else: - amount_currency = False - currency_id = False - pay_journal = self.pool.get('account.journal').read(cr, uid, pay_journal_id, ['type'], context=context) - if voucher.type in ('sale', 'receipt'): - if pay_journal['type'] == 'bank': - entry_type = 'bank_pay_voucher' # Bank payment - else: - entry_type = 'pay_voucher' # Cash payment - else: - entry_type = 'cont_voucher' - - # Pay attention to the sign for both debit/credit AND amount_currency - l1 = { - 'debit': direction * pay_amount>0 and direction * pay_amount, - 'credit': direction * pay_amount<0 and - direction * pay_amount, - 'account_id': src_account_id, - 'partner_id': voucher.partner_id.id, - 'ref':ref, - 'date': date, - 'currency_id':currency_id, - 'amount_currency':amount_currency and direction * amount_currency or 0.0, - 'company_id': voucher.company_id.id, - } - l2 = { - 'debit': direction * pay_amount<0 and - direction * pay_amount, - 'credit': direction * pay_amount>0 and direction * pay_amount, - 'account_id': pay_account_id, - 'partner_id': voucher.partner_id.id, - 'ref':ref, - 'date': date, - 'currency_id':currency_id, - 'amount_currency':amount_currency and - direction * amount_currency or 0.0, - 'company_id': voucher.company_id.id, - } - - if not name: - name = voucher.line_ids and voucher.line_ids[0].name or voucher.number - l1['name'] = name - l2['name'] = name - lines = [(0, 0, l1), (0, 0, l2)] - move = {'ref': ref, 'line_id': lines, 'journal_id': pay_journal_id, 'period_id': period_id, 'name': name, 'date': date} - move_id = self.pool.get('account.move').create(cr, uid, move, context=context) - - line_ids = [] - total = 0.0 - line = self.pool.get('account.move.line') - move_ids = [move_id,] - if voucher.move_id: - move_ids.append(voucher.move_id.id) - cr.execute('SELECT id FROM account_move_line '\ - 'WHERE move_id IN %s', - ((move_id,),)) - lines = line.browse(cr, uid, map(lambda x: x[0], cr.fetchall()) ) - for l in lines: - if l.account_id.id == src_account_id: - line_ids.append(l.id) - total += (l.debit or 0.0) - (l.credit or 0.0) - - voc_id, name = self.name_get(cr, uid, [voucher.id], context=context)[0] - if (not round(total,self.pool.get('decimal.precision').precision_get(cr, uid, 'Account'))) or writeoff_acc_id: - self.pool.get('account.move.line').reconcile(cr, uid, line_ids, 'manual', writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context) - else: - code = voucher.currency_id.code - # TODO: use currency's formatting function - msg = _("Invoice '%s' is paid partially: %s%s of %s%s (%s%s remaining)") % \ - (name, pay_amount, code, voucher.amount_total, code, total, code) - self.log(cr, uid, voc_id, msg) - self.pool.get('account.move.line').reconcile_partial(cr, uid, line_ids, 'manual', context) - # Update the stored value (fields.function), so we write to trigger recompute - self.write(cr, uid, ids, {'state':'posted'}, context=context) return True def copy(self, cr, uid, id, default={}, context=None): diff --git a/addons/account_voucher/wizard/account_voucher_payment_option.py b/addons/account_voucher/wizard/account_voucher_payment_option.py index cbc22364fed..408bf909fd2 100644 --- a/addons/account_voucher/wizard/account_voucher_payment_option.py +++ b/addons/account_voucher/wizard/account_voucher_payment_option.py @@ -21,6 +21,7 @@ from osv import fields, osv from tools.translate import _ +import decimal_precision as dp class account_voucher_pay_writeoff(osv.osv_memory): """ @@ -28,11 +29,22 @@ class account_voucher_pay_writeoff(osv.osv_memory): """ _name = "account.voucher.pay.writeoff" _description = "Pay Voucher" + + def _get_amount(self, cr, uid, context=None): + voucher_obj = self.pool.get('account.voucher') + voucher = voucher_obj.browse(cr, uid, context['voucher_id'], context=context) + amount = 0.0 + for line in voucher.line_ids: + amount += line.amount_unreconciled + diff = amount - voucher.amount + return diff + _columns = { 'payment_option':fields.selection([ ('not_reconcile', 'Do not reconcile balance'), ('close_balance', 'close the balance'), ], 'Payment Option', required=True), + 'writeoff_amount': fields.float('Writeoff Amount', required=True, digits_compute = dp.get_precision('Account')), 'writeoff_acc_id': fields.many2one('account.account', 'Write-Off account'), 'writeoff_journal_id': fields.many2one('account.journal', 'Write-Off journal'), 'comment': fields.char('Comment', size=64, required=True), @@ -41,76 +53,18 @@ class account_voucher_pay_writeoff(osv.osv_memory): _defaults = { 'payment_option': 'not_reconcile', 'comment': 'Write-Off', + 'writeoff_amount': _get_amount } def pay_and_reconcile_writeoff(self, cr, uid, ids, context=None): voucher_obj = self.pool.get('account.voucher') - data = self.read(cr, uid, ids,context=context)[0] + data = self.read(cr, uid, ids, context=context)[0] voucher_id = context.get('voucher_id', False) - if data['payment_option'] == 'not_reconcile': - voucher_obj.action_move_line_create(cr, uid, [voucher_id], context=context) - return {} - context.update({'write_off':data}) - self.pool.get('account.voucher.pay').pay_and_reconcile(cr, uid, [voucher_id], context=context) + if data['payment_option'] == 'close_balance': + context.update({'write_off':data}) + voucher_obj.action_move_line_create(cr, uid, [voucher_id], context=context) return {} account_voucher_pay_writeoff() -class account_voucher_pay(osv.osv_memory): - """ - Generate pay invoice wizard, user can make partial or full payment for invoice. - """ - _name = "account.voucher.pay" - _description = "Pay Voucher" - - def pay_and_reconcile(self, cr, uid, ids, context=None): - cur_obj = self.pool.get('res.currency') - voucher_obj = self.pool.get('account.voucher') - if context is None: - context = {} - voucher = voucher_obj.browse(cr, uid, [ids[0]], context=context)[0] - writeoff_account_id = False - writeoff_journal_id = False - comment = False - - if 'write_off' in context and context['write_off'] : - writeoff_account_id = context['write_off']['writeoff_acc_id'] - writeoff_journal_id = context['write_off']['writeoff_journal_id'] - comment = context['write_off']['comment'] - - amount = voucher.amount - journal = voucher.journal_id - # Compute the amount in company's currency, with the journal currency (which is equal to payment currency) - # when it is needed : If payment currency (according to selected journal.currency) is <> from company currency - if journal.currency and voucher.company_id.currency_id.id<>journal.currency.id: - ctx = {'date': voucher.date} - amount = cur_obj.compute(cr, uid, journal.currency.id, voucher.company_id.currency_id.id, amount, context=ctx) - currency_id = journal.currency.id - # Put the paid amount in currency, and the currency, in the context if currency is different from company's currency - context.update({'amount_currency': voucher.amount, 'currency_id': currency_id}) - - if voucher.company_id.currency_id.id<>voucher.currency_id.id: - ctx = {'date':voucher.date} - amount = cur_obj.compute(cr, uid, voucher.currency_id.id, voucher.company_id.currency_id.id, amount, context=ctx) - currency_id = voucher.currency_id.id - # Put the paid amount in currency, and the currency, in the context if currency is different from company's currency - context.update({'amount_currency':voucher.amount,'currency_id':currency_id}) - - # Take the choosen date - if comment: - context.update({'date_p':voucher.date, 'comment':comment}) - else: - context.update({'date_p':voucher.date, 'comment':False}) - - acc_id = journal.default_credit_account_id and journal.default_credit_account_id.id - if not acc_id: - raise osv.except_osv(_('Error !'), _('Your journal must have a default credit and debit account.')) - - voucher_obj.pay_and_reconcile(cr, uid, ids, - amount, acc_id, voucher.period_id.id, journal.id, writeoff_account_id, - voucher.period_id, writeoff_journal_id, context, voucher.name) - return {} - -account_voucher_pay() - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_voucher/wizard/account_voucher_payment_option.xml b/addons/account_voucher/wizard/account_voucher_payment_option.xml index 85980cd2b33..e762bcbc657 100644 --- a/addons/account_voucher/wizard/account_voucher_payment_option.xml +++ b/addons/account_voucher/wizard/account_voucher_payment_option.xml @@ -12,9 +12,10 @@ + + - From e86ddeff43666f1f36a0b11842c0389e17c6874d Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Fri, 19 Nov 2010 14:10:37 +0530 Subject: [PATCH 02/30] [IMP] account_voucher:Writeoff implementation for customer and supplier payments bzr revid: psi@tinyerp.co.in-20101119084037-jcqxpwz5349jwkm1 --- addons/account_voucher/account_voucher.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index bc5fef3ab44..d1e260dab66 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -718,7 +718,6 @@ class account_voucher(osv.osv): sign = (move_line['debit'] - move_line['credit']) < 0 and -1 or 1 move_line['amount_currency'] = company_currency <> current_currency and sign * line.amount or 0.0 master_line = move_line_pool.create(cr, uid, move_line) - test_ids.append('master_line') if line.move_line_id.id: rec_ids = [master_line, line.move_line_id.id] rec_list_ids.append(rec_ids) @@ -749,16 +748,18 @@ class account_voucher(osv.osv): move_line['account_id'] = account_id move_line_pool.create(cr, uid, move_line) + voucher = self.browse(cr, uid, ids)[0] + for rec_ids in rec_list_ids: if len(rec_ids) >= 2: - if 'write_off' in context and context['write_off']['writeoff_acc_id']: - writeoff_account_id = context['write_off']['writeoff_acc_id'] - writeoff_journal_id = context['write_off']['writeoff_journal_id'] - comment = context['write_off']['comment'] - self.pool.get('account.move.line').reconcile(cr, uid, rec_ids, 'manual', writeoff_account_id, writeoff_period_id, writeoff_journal_id, context) - else: - self.pool.get('account.move.line').reconcile_partial(cr, uid, rec_ids, 'manual', context) - + for line in voucher.line_ids: + if line.amount_unreconciled != line.amount: + if 'write_off' in context and context['write_off']['writeoff_acc_id']: + writeoff_account_id = context['write_off']['writeoff_acc_id'] + writeoff_journal_id = context['write_off']['writeoff_journal_id'] + comment = context['write_off']['comment'] + self.pool.get('account.move.line').reconcile(cr, uid, rec_ids, 'manual', writeoff_account_id, writeoff_period_id, writeoff_journal_id, context) + self.pool.get('account.move.line').reconcile_partial(cr, uid, rec_ids, 'manual', context) self.write(cr, uid, [inv.id], { 'move_id': move_id, 'state': 'posted', From 9373354e815a683f3d026d0fd6306ca4b0598f3c Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Fri, 19 Nov 2010 16:43:56 +0530 Subject: [PATCH 03/30] [IMP] account_voucher:Writeoff implementation for customer and supplier payments bzr revid: psi@tinyerp.co.in-20101119111356-1mxdvqj04xawm7b3 --- addons/account_voucher/account_voucher.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index d1e260dab66..0425dc41ee9 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -759,7 +759,8 @@ class account_voucher(osv.osv): writeoff_journal_id = context['write_off']['writeoff_journal_id'] comment = context['write_off']['comment'] self.pool.get('account.move.line').reconcile(cr, uid, rec_ids, 'manual', writeoff_account_id, writeoff_period_id, writeoff_journal_id, context) - self.pool.get('account.move.line').reconcile_partial(cr, uid, rec_ids, 'manual', context) + else: + self.pool.get('account.move.line').reconcile_partial(cr, uid, rec_ids, 'manual', context) self.write(cr, uid, [inv.id], { 'move_id': move_id, 'state': 'posted', From 6ff9caa04af0d0885bb1d24b90bf85c512377db6 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Mon, 22 Nov 2010 16:40:50 +0530 Subject: [PATCH 04/30] [IMP] account: cumulative balance for journal report bzr revid: psi@tinyerp.co.in-20101122111050-jjwk79g6m5lq7g0p --- addons/account/report/account_journal.py | 20 +++- addons/account/report/account_journal.rml | 112 +++++++++++----------- 2 files changed, 72 insertions(+), 60 deletions(-) diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py index 82af01cdb0b..336a32b2a7a 100644 --- a/addons/account/report/account_journal.py +++ b/addons/account/report/account_journal.py @@ -117,10 +117,22 @@ class journal_print(report_sxw.rml_parse, common_report_header): move_state = ['draft','posted'] 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 + '',(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) + self.cr.execute("SELECT l.id, l.date, l.ref, l.name, l.debit, l.credit, m.name as move_name, acc.code as account_code, rp.name as partner_name "\ + "FROM account_move_line l "\ + "LEFT JOIN account_move m ON (m.id=l.move_id) "\ + "LEFT JOIN account_account acc ON (l.account_id = acc.id) "\ + "LEFT JOIN res_partner rp ON (l.partner_id=rp.id) "\ + "WHERE m.state IN %s "\ + "AND l.period_id = %s "\ + "AND l.journal_id IN %s " + self.query_get_clause + " "\ + "ORDER BY l."+ self.sort_selection + " ", + (tuple(move_state), period_id, tuple(journal_id) )) + res = self.cr.dictfetchall() + account_sum = 0.0 + for l in res: + account_sum += l['debit'] - l['credit'] + l['progress'] = account_sum + return res def _set_get_account_currency_code(self, account_id): self.cr.execute("SELECT c.symbol AS code "\ diff --git a/addons/account/report/account_journal.rml b/addons/account/report/account_journal.rml index cb37b4e83f5..0a20da7fc9a 100644 --- a/addons/account/report/account_journal.rml +++ b/addons/account/report/account_journal.rml @@ -176,9 +176,9 @@ - - - + + + @@ -202,44 +202,44 @@ - [[ data['model']=='account.journal.period'and 'Company' or removeParentNode('para') ]] - [[ data['model']=='ir.ui.menu' and 'Chart of Account' or removeParentNode('para') ]] + [[ data['model']=='account.journal.period'and 'Company' or removeParentNode('para') ]] + [[ data['model']=='ir.ui.menu' and 'Chart of Account' or removeParentNode('para') ]] Fiscal Year - Journal + Journal Filters By - Entries Sorted By + Entries Sorted By Target Moves - - [[ get_account(data) or '' ]] + + [[ get_account(data) or '' ]] [[ get_fiscalyear(data) or '' ]] - [[o.journal_id.name ]] - [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] - [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] - - Start Date - End Date - - - [[ formatLang(get_start_date(data),date=True) ]] - [[ formatLang(get_end_date(data),date=True) ]] - - - [[ get_filter(data)=='Periods' 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) ]] - - + [[o.journal_id.name ]] + [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] + [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + + Start Date + End Date + + + [[ formatLang(get_start_date(data),date=True) ]] + [[ formatLang(get_end_date(data),date=True) ]] + + + [[ get_filter(data)=='Periods' 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) ]] + + @@ -269,14 +269,14 @@ [[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) ]] - [[ line.ref ]] - [[ line.account_id.code ]] - [[ line.partner_id and line.partner_id.name ]] - [[ line.move_id.name ]] - [[ line.name ]] - [[ formatLang(line.debit) ]] - [[ formatLang(line.credit) ]] - [[ formatLang(line.credit - line.debit) ]] [[ company.currency_id.symbol ]] + [[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]][[ formatLang(line['date'],date=True) ]] + [[ line['ref'] or '' ]] + [[ line['account_code'] or '' ]] + [[ line['partner_name'] or '' ]] + [[ line['move_name'] or '' ]] - [[ line['name'] or '' ]] + [[ formatLang(line['debit']) ]] + [[ formatLang(line['credit']) ]] + [[ formatLang(line['progress']) ]] [[ company.currency_id.symbol ]] @@ -290,8 +290,8 @@ Move/Entry label Debit Credit - Balance - Currency + Balance + Currency [[o.period_id.name ]] @@ -301,19 +301,19 @@ [[ formatLang(sum_debit(o.period_id.id, o.journal_id.id)) ]] [[ formatLang(sum_credit(o.period_id.id, o.journal_id.id)) ]] - [[ formatLang((sum_debit(o.period_id.id, o.journal_id.id) - sum_credit(o.period_id.id, o.journal_id.id))) ]] [[ company.currency_id.symbol ]] + [[ formatLang((sum_debit(o.period_id.id, o.journal_id.id) - sum_credit(o.period_id.id, o.journal_id.id))) ]] [[ company.currency_id.symbol ]] [[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) ]] - [[ line.ref ]] - [[ line.account_id.code ]] - [[ line.partner_id and line.partner_id.name ]] - [[ line.move_id.name ]] - [[ line.name ]] - [[ formatLang(line.debit) ]] - [[ formatLang(line.credit) ]] - [[ formatLang(line.credit - line.debit) ]] [[ company.currency_id.symbol ]] - [[ line.currency_id and formatLang(line.amount_currency) or '' ]] [[ line.currency_id.symbol or '']] + [[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]][[ formatLang(line['date'],date=True) ]] + [[ line['ref'] or '' ]] + [[ line['account_code'] or '' ]] + [[ line['partner_name'] or '' ]] + [[ line['move_name'] or '' ]] - [[ line['name'] or '' ]] + [[ formatLang(line['debit']) ]] + [[ formatLang(line['credit']) ]] + [[ formatLang(line['progress']) ]] [[ company.currency_id.symbol ]] + [[ line.currency_id and formatLang(line.amount_currency) or '' ]] [[ line.currency_id.symbol or '']] From 1785b797a4ca1357ca3c8a0aa9912dd6b6146cf1 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Mon, 22 Nov 2010 16:52:10 +0530 Subject: [PATCH 05/30] [FIX] account: small change in journal report bzr revid: psi@tinyerp.co.in-20101122112210-ohdvm7ivvgjz9ncx --- addons/account/report/account_journal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py index 336a32b2a7a..fcab2312c42 100644 --- a/addons/account/report/account_journal.py +++ b/addons/account/report/account_journal.py @@ -130,7 +130,7 @@ class journal_print(report_sxw.rml_parse, common_report_header): res = self.cr.dictfetchall() account_sum = 0.0 for l in res: - account_sum += l['debit'] - l['credit'] + account_sum += l['credit']-l['debit'] l['progress'] = account_sum return res From fad4dba6f41920737e989260f997f3a41ab31550 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Mon, 22 Nov 2010 17:43:58 +0530 Subject: [PATCH 06/30] [IMP] account_voucher: remove local branch changes bzr revid: psi@tinyerp.co.in-20101122121358-8p73warpovcpfs7y --- addons/account/account_move_line.py | 2 -- addons/account_voucher/account_voucher.py | 17 ----------------- 2 files changed, 19 deletions(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 16ea52b65d4..93d5c37bd08 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -716,8 +716,6 @@ class account_move_line(osv.osv): account_id = line['account_id']['id'] partner_id = (line['partner_id'] and line['partner_id']['id']) or False writeoff = debit - credit - if 'write_off' in context and context['write_off']['writeoff_amount']: - writeoff = context['write_off']['writeoff_amount'] # Ifdate_p in context => take this date if context.has_key('date_p') and context['date_p']: diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 509f6b00b92..f902810ac31 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -694,10 +694,6 @@ class account_voucher(osv.osv): if line.move_line_id.id: rec_ids = [master_line, line.move_line_id.id] rec_list_ids.append(rec_ids) - writeoff_account_id = False - writeoff_journal_id = False - writeoff_period_id = inv.period_id.id, - comment = False if not currency_pool.is_zero(cr, uid, inv.currency_id, line_total): diff = line_total @@ -722,19 +718,6 @@ class account_voucher(osv.osv): move_line_pool.create(cr, uid, move_line) - voucher = self.browse(cr, uid, ids)[0] - - for rec_ids in rec_list_ids: - if len(rec_ids) >= 2: - for line in voucher.line_ids: - if line.amount_unreconciled != line.amount: - if 'write_off' in context and context['write_off']['writeoff_acc_id']: - writeoff_account_id = context['write_off']['writeoff_acc_id'] - writeoff_journal_id = context['write_off']['writeoff_journal_id'] - comment = context['write_off']['comment'] - self.pool.get('account.move.line').reconcile(cr, uid, rec_ids, 'manual', writeoff_account_id, writeoff_period_id, writeoff_journal_id, context) - else: - self.pool.get('account.move.line').reconcile_partial(cr, uid, rec_ids, 'manual', context) self.write(cr, uid, [inv.id], { 'move_id': move_id, 'state': 'posted', From 562dcd893fb70e74d5bfd2f49f79f2220c9fce86 Mon Sep 17 00:00:00 2001 From: "rha(OpenERP)" <> Date: Mon, 22 Nov 2010 19:12:47 +0530 Subject: [PATCH 07/30] [Fix]:Bug 523428: iban account upper case bzr revid: rhaopenerp-20101122134247-p99gx9a8fwj67ks4 --- addons/base_iban/base_iban.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/base_iban/base_iban.py b/addons/base_iban/base_iban.py index 92783b8eb74..d1bc2daf61d 100644 --- a/addons/base_iban/base_iban.py +++ b/addons/base_iban/base_iban.py @@ -67,7 +67,7 @@ def _format_iban(string): res = "" for char in string: if char.isalnum(): - res += char.lower() + res += char.upper() return res class res_partner_bank(osv.osv): @@ -92,7 +92,7 @@ class res_partner_bank(osv.osv): for bank_acc in self.browse(cr, uid, ids): if not bank_acc.iban: continue - iban = _format_iban(bank_acc.iban) + iban = _format_iban(bank_acc.iban).lower() if iban[:2] in _iban_len and len(iban) != _iban_len[iban[:2]]: return False #the four first digits have to be shifted to the end From e95a1ab0a58739f3f7176aece99075b1adde4351 Mon Sep 17 00:00:00 2001 From: "rha(OpenERP)" <> Date: Tue, 23 Nov 2010 12:24:20 +0530 Subject: [PATCH 08/30] [Fix]: Bug 670837:only display accounts to be reconciled bzr revid: rhaopenerp-20101123065420-524rcz8waal4o5yp --- addons/account/account_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index a031aafd9e8..3669bfc8274 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1155,7 +1155,7 @@ From 396bbe73e1dfdbb65789038f2709ff528e5af03a Mon Sep 17 00:00:00 2001 From: mtr Date: Tue, 23 Nov 2010 16:16:33 +0530 Subject: [PATCH 09/30] [ADD] Account_sequence: added installer files bzr revid: mtr@mtr-20101123104633-cnvoe6f8rm7ufq9c --- addons/account_sequence/__init__.py | 1 + addons/account_sequence/__openerp__.py | 2 +- addons/account_sequence/account_sequence.py | 2 +- .../account_sequence_installer.py | 63 +++++++++++++++++++ .../account_sequence_installer_view.xml | 51 +++++++++++++++ 5 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 addons/account_sequence/account_sequence_installer.py create mode 100644 addons/account_sequence/account_sequence_installer_view.xml diff --git a/addons/account_sequence/__init__.py b/addons/account_sequence/__init__.py index 535fb766048..b6707106d4b 100644 --- a/addons/account_sequence/__init__.py +++ b/addons/account_sequence/__init__.py @@ -20,5 +20,6 @@ ############################################################################## import account_sequence +import account_sequence_installer # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account_sequence/__openerp__.py b/addons/account_sequence/__openerp__.py index 966cbcbc8ca..2cc6f50e138 100644 --- a/addons/account_sequence/__openerp__.py +++ b/addons/account_sequence/__openerp__.py @@ -30,7 +30,7 @@ 'website': 'http://www.openerp.com', 'depends': ['account'], 'init_xml': [], - 'update_xml': ['account_sequence_data.xml','account_sequence.xml'], + 'update_xml': ['account_sequence_data.xml','account_sequence_installer_view.xml','account_sequence.xml'], 'demo_xml': [], 'installable': True, 'active': False, diff --git a/addons/account_sequence/account_sequence.py b/addons/account_sequence/account_sequence.py index 309bf3bc803..ee3afa380c1 100644 --- a/addons/account_sequence/account_sequence.py +++ b/addons/account_sequence/account_sequence.py @@ -46,7 +46,7 @@ class account_journal(osv.osv): _inherit = "account.journal" _columns = { - 'internal_sequence': fields.many2one('ir.sequence', 'Internal Sequence'), + 'internal_sequence': fields.many2one('ir.sequence', 'Internal Sequence', help="This sequence will be used to maintain the internal number for the journal entries related to this journal."), } account_journal() diff --git a/addons/account_sequence/account_sequence_installer.py b/addons/account_sequence/account_sequence_installer.py new file mode 100644 index 00000000000..d07c0e481aa --- /dev/null +++ b/addons/account_sequence/account_sequence_installer.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from osv import fields, osv + +class account_sequence_installer(osv.osv_memory): + _name = 'account.sequence.installer' + _inherit = 'res.config.installer' + + _columns = { + 'internal_sequence': fields.many2one('ir.sequence', 'Internal Sequence', help="This sequence will be used on Journals to maintain internal number for accounting entries."), + } + + def _get_internal_sequence(self, cr, uid, context): + obj_sequence = self.pool.get('ir.sequence') + seq_id = obj_sequence.search(cr, uid, [('name','=', 'Internal Sequence Journal')]) + for seq in obj_sequence.browse(cr, uid, seq_id): + if seq.id: + return seq.id + return False + + def execute(self, cr, uid, ids, context): + if context is None: + context = {} + res = super(account_sequence_installer, self).execute(cr, uid, ids, context=context) + jou_obj = self.pool.get('account.journal') + obj_sequence = self.pool.get('ir.sequence') + journal_ids = jou_obj.search(cr, uid, [('type','in',['sale','sale_refund','purchase','purchase_refund','cash', 'bank', 'general','situation'])]) + + for line in self.browse(cr, uid, ids): + for journal in jou_obj.browse(cr, uid, journal_ids): + if not journal.internal_sequence: + seq_id = obj_sequence.search(cr, uid, [('name','=', line.internal_sequence.name)]) + for seq in obj_sequence.browse(cr, uid, seq_id): + if seq.id: + jou_obj.write(cr, uid, [journal.id], {'internal_sequence': seq.id}) + return res + + _defaults = { + 'internal_sequence': _get_internal_sequence + } + +account_sequence_installer() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_sequence/account_sequence_installer_view.xml b/addons/account_sequence/account_sequence_installer_view.xml new file mode 100644 index 00000000000..566dfaa6bc5 --- /dev/null +++ b/addons/account_sequence/account_sequence_installer_view.xml @@ -0,0 +1,51 @@ + + + + + + account.sequence.installer.view + account.sequence.installer + form + + + +
+ Account Sequence Application Configuration +
+ + Configure Your Account Sequence Application + + + + + + You can enhance the Account Sequence Application by installing . + + + + + + Configure + +
+
+
+ + + Account Sequence Application Configuration + ir.actions.act_window + account.sequence.installer + + form + form + new + + + + + 3 + always + + +
+
From 9d60075ac2aeceb52e20fe48eb5866c09eeaa65b Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Tue, 23 Nov 2010 16:25:42 +0530 Subject: [PATCH 10/30] [REF] Account: Remove the file Account_wizard.xml and put the menu available on it with account_menu.xml and related changes in po/pot files bzr revid: ara@tinyerp.com-20101123105542-gq1jbc3z633qon22 --- addons/account/__openerp__.py | 1 - addons/account/account_menuitem.xml | 2 +- addons/account/account_wizard.xml | 7 ------- addons/account/i18n/ar.po | 5 +++++ addons/account/i18n/bg.po | 5 +++++ addons/account/i18n/bs.po | 5 +++++ addons/account/i18n/ca.po | 5 +++++ addons/account/i18n/cs.po | 5 +++++ addons/account/i18n/es.po | 5 +++++ addons/account/i18n/es_AR.po | 5 +++++ addons/account/i18n/es_EC.po | 5 +++++ addons/account/i18n/et.po | 5 +++++ addons/account/i18n/eu.po | 5 +++++ addons/account/i18n/fa.po | 5 +++++ addons/account/i18n/fi.po | 5 +++++ addons/account/i18n/gl.po | 5 +++++ addons/account/i18n/gu.po | 5 +++++ addons/account/i18n/hr.po | 5 +++++ addons/account/i18n/hu.po | 5 +++++ addons/account/i18n/id.po | 5 +++++ addons/account/i18n/kab.po | 5 +++++ addons/account/i18n/ko.po | 5 +++++ addons/account/i18n/lt.po | 5 +++++ addons/account/i18n/lv.po | 5 +++++ addons/account/i18n/mn.po | 5 +++++ addons/account/i18n/nb.po | 5 +++++ addons/account/i18n/nl_BE.po | 5 +++++ addons/account/i18n/oc.po | 5 +++++ addons/account/i18n/pt.po | 5 +++++ addons/account/i18n/pt_BR.po | 5 +++++ addons/account/i18n/ro.po | 5 +++++ addons/account/i18n/si.po | 5 +++++ addons/account/i18n/sk.po | 5 +++++ addons/account/i18n/sl.po | 5 +++++ addons/account/i18n/sq.po | 5 +++++ addons/account/i18n/sr.po | 5 +++++ addons/account/i18n/sv.po | 5 +++++ addons/account/i18n/ta.po | 5 +++++ addons/account/i18n/te.po | 5 +++++ addons/account/i18n/th.po | 5 +++++ addons/account/i18n/tlh.po | 5 +++++ addons/account/i18n/tr.po | 5 +++++ addons/account/i18n/ug.po | 5 +++++ addons/account/i18n/uk.po | 5 +++++ addons/account/i18n/zh_CN.po | 5 +++++ addons/account/i18n/zh_HK.po | 5 +++++ addons/account/i18n/zh_TW.po | 5 +++++ 47 files changed, 221 insertions(+), 9 deletions(-) delete mode 100644 addons/account/account_wizard.xml diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index c170076cfc8..0131ca0437b 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -48,7 +48,6 @@ module named account_voucher. 'security/account_security.xml', 'security/ir.model.access.csv', 'account_menuitem.xml', - 'account_wizard.xml', 'report/account_invoice_report_view.xml', 'report/account_entries_report_view.xml', 'report/account_report_view.xml', diff --git a/addons/account/account_menuitem.xml b/addons/account/account_menuitem.xml index 213b80c3a44..4094b453ab7 100644 --- a/addons/account/account_menuitem.xml +++ b/addons/account/account_menuitem.xml @@ -34,7 +34,7 @@ - + - - - - - - diff --git a/addons/account/i18n/ar.po b/addons/account/i18n/ar.po index d3233f9272a..77aa5f000f0 100644 --- a/addons/account/i18n/ar.po +++ b/addons/account/i18n/ar.po @@ -406,6 +406,11 @@ msgstr "" msgid "Error! You can not create recursive analytic accounts." msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: field:account.bank.statement.reconcile,total_entry:0 msgid "Total entries" diff --git a/addons/account/i18n/bg.po b/addons/account/i18n/bg.po index 0a46ee887c5..232326c597d 100644 --- a/addons/account/i18n/bg.po +++ b/addons/account/i18n/bg.po @@ -26,6 +26,11 @@ msgstr "Вътрешно име" msgid "Account Tax Code" msgstr "Данъчен код" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: model:ir.actions.act_window,name:account.action_invoice_tree9 #: model:ir.ui.menu,name:account.menu_action_invoice_tree9 diff --git a/addons/account/i18n/bs.po b/addons/account/i18n/bs.po index c20e3d47322..2d7cdaab649 100644 --- a/addons/account/i18n/bs.po +++ b/addons/account/i18n/bs.po @@ -26,6 +26,11 @@ msgstr "Interni naziv" msgid "Account Tax Code" msgstr "Šifra poreza" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: model:ir.actions.act_window,name:account.action_invoice_tree9 #: model:ir.ui.menu,name:account.menu_action_invoice_tree9 diff --git a/addons/account/i18n/ca.po b/addons/account/i18n/ca.po index f10efb2397f..9976d545972 100644 --- a/addons/account/i18n/ca.po +++ b/addons/account/i18n/ca.po @@ -27,6 +27,11 @@ msgstr "Nom intern" msgid "Account Tax Code" msgstr "Codi impost comptable" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: model:ir.actions.act_window,name:account.action_invoice_tree9 #: model:ir.ui.menu,name:account.menu_action_invoice_tree9 diff --git a/addons/account/i18n/cs.po b/addons/account/i18n/cs.po index 3f878c3817c..53157da726f 100644 --- a/addons/account/i18n/cs.po +++ b/addons/account/i18n/cs.po @@ -28,6 +28,11 @@ msgstr "Interní jméno" msgid "Partner's" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: field:account.partner.balance,display_partner:0 msgid "Display Partners" diff --git a/addons/account/i18n/es.po b/addons/account/i18n/es.po index f9c9a4d9dd7..c9d19e39967 100644 --- a/addons/account/i18n/es.po +++ b/addons/account/i18n/es.po @@ -33,6 +33,11 @@ msgstr "Código impuesto contable" msgid "Unpaid Supplier Invoices" msgstr "Facturas de proveedor sin pagar" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: model:ir.ui.menu,name:account.menu_finance_entries msgid "Entries Encoding" diff --git a/addons/account/i18n/es_AR.po b/addons/account/i18n/es_AR.po index c763da1d8da..959296807a9 100644 --- a/addons/account/i18n/es_AR.po +++ b/addons/account/i18n/es_AR.po @@ -28,6 +28,11 @@ msgstr "Nombre interno" msgid "Partner's" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: field:account.partner.balance,display_partner:0 msgid "Display Partners" diff --git a/addons/account/i18n/es_EC.po b/addons/account/i18n/es_EC.po index f0c26add3c6..dad7f01de66 100644 --- a/addons/account/i18n/es_EC.po +++ b/addons/account/i18n/es_EC.po @@ -29,6 +29,11 @@ msgstr "Nombre interno" msgid "Partner's" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: field:account.partner.balance,display_partner:0 msgid "Display Partners" diff --git a/addons/account/i18n/et.po b/addons/account/i18n/et.po index 7358f33d3e9..325883783a6 100644 --- a/addons/account/i18n/et.po +++ b/addons/account/i18n/et.po @@ -21,6 +21,11 @@ msgstr "" msgid "Internal Name" msgstr "Sisemine nimi" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: view:account.tax.code:0 msgid "Account Tax Code" diff --git a/addons/account/i18n/eu.po b/addons/account/i18n/eu.po index 7a0910887f1..40c655607f9 100644 --- a/addons/account/i18n/eu.po +++ b/addons/account/i18n/eu.po @@ -29,6 +29,11 @@ msgstr "Barne Izena" msgid "Partner's" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: field:account.partner.balance,display_partner:0 msgid "Display Partners" diff --git a/addons/account/i18n/fa.po b/addons/account/i18n/fa.po index c9da4d5dcdf..e97963f90e2 100644 --- a/addons/account/i18n/fa.po +++ b/addons/account/i18n/fa.po @@ -22,6 +22,11 @@ msgstr "" msgid "Internal Name" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: field:account.partner.balance,result_selection:0 #: field:account.aged.trial.balance,result_selection:0 diff --git a/addons/account/i18n/fi.po b/addons/account/i18n/fi.po index 26d666eb8eb..d9bd9c5f568 100644 --- a/addons/account/i18n/fi.po +++ b/addons/account/i18n/fi.po @@ -27,6 +27,11 @@ msgstr "Sisäinen nimi" msgid "Account Tax Code" msgstr "Tilin verokoodi" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: model:ir.actions.act_window,name:account.action_invoice_tree9 #: model:ir.ui.menu,name:account.menu_action_invoice_tree9 diff --git a/addons/account/i18n/gl.po b/addons/account/i18n/gl.po index 3aeb3b99785..97606a03978 100644 --- a/addons/account/i18n/gl.po +++ b/addons/account/i18n/gl.po @@ -25,6 +25,11 @@ msgstr "" msgid "Partner's" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: field:account.partner.balance,display_partner:0 msgid "Display Partners" diff --git a/addons/account/i18n/gu.po b/addons/account/i18n/gu.po index 3578c4a999c..c259d2c9437 100644 --- a/addons/account/i18n/gu.po +++ b/addons/account/i18n/gu.po @@ -24,6 +24,11 @@ msgstr "" msgid "Partner's" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: field:account.partner.balance,display_partner:0 msgid "Display Partners" diff --git a/addons/account/i18n/hr.po b/addons/account/i18n/hr.po index 35c2e0b4c49..9463c49a43e 100644 --- a/addons/account/i18n/hr.po +++ b/addons/account/i18n/hr.po @@ -21,6 +21,11 @@ msgstr "" msgid "Internal Name" msgstr "Interni naziv" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: view:account.tax.code:0 msgid "Account Tax Code" diff --git a/addons/account/i18n/hu.po b/addons/account/i18n/hu.po index 5414080872e..9b63f93b7ff 100644 --- a/addons/account/i18n/hu.po +++ b/addons/account/i18n/hu.po @@ -28,6 +28,11 @@ msgstr "" msgid "Partner's" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: field:account.partner.balance,display_partner:0 msgid "Display Partners" diff --git a/addons/account/i18n/id.po b/addons/account/i18n/id.po index 6086832bf1e..d66c5e0748b 100644 --- a/addons/account/i18n/id.po +++ b/addons/account/i18n/id.po @@ -29,6 +29,11 @@ msgstr "Nama Internal" msgid "Partner's" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: field:account.partner.balance,display_partner:0 msgid "Display Partners" diff --git a/addons/account/i18n/kab.po b/addons/account/i18n/kab.po index e70fa3d4c1b..4349ce72478 100644 --- a/addons/account/i18n/kab.po +++ b/addons/account/i18n/kab.po @@ -22,6 +22,11 @@ msgstr "" msgid "Internal Name" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: field:account.partner.balance,result_selection:0 #: field:account.aged.trial.balance,result_selection:0 diff --git a/addons/account/i18n/ko.po b/addons/account/i18n/ko.po index c3f94cd30e4..8aa97b7bc5a 100644 --- a/addons/account/i18n/ko.po +++ b/addons/account/i18n/ko.po @@ -22,6 +22,11 @@ msgstr "" msgid "Internal Name" msgstr "내부 명칭" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: field:account.partner.balance,result_selection:0 #: field:account.aged.trial.balance,result_selection:0 diff --git a/addons/account/i18n/lt.po b/addons/account/i18n/lt.po index a2787590945..b8635bc133a 100644 --- a/addons/account/i18n/lt.po +++ b/addons/account/i18n/lt.po @@ -21,6 +21,11 @@ msgstr "" msgid "Internal Name" msgstr "Vidinis vardas" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: view:account.tax.code:0 msgid "Account Tax Code" diff --git a/addons/account/i18n/lv.po b/addons/account/i18n/lv.po index 1e2c4a4fa3d..4fc10de7fe9 100644 --- a/addons/account/i18n/lv.po +++ b/addons/account/i18n/lv.po @@ -22,6 +22,11 @@ msgstr "" msgid "Internal Name" msgstr "Iekšējais Nosaukums" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: field:account.partner.balance,result_selection:0 #: field:account.aged.trial.balance,result_selection:0 diff --git a/addons/account/i18n/mn.po b/addons/account/i18n/mn.po index 28b72309afe..7cc3887959d 100644 --- a/addons/account/i18n/mn.po +++ b/addons/account/i18n/mn.po @@ -22,6 +22,11 @@ msgstr "" msgid "Internal Name" msgstr "Дотоод нэр" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: view:account.tax.code:0 msgid "Account Tax Code" diff --git a/addons/account/i18n/nb.po b/addons/account/i18n/nb.po index bf935ebbcb8..8fcaf672431 100644 --- a/addons/account/i18n/nb.po +++ b/addons/account/i18n/nb.po @@ -22,6 +22,11 @@ msgstr "" msgid "Internal Name" msgstr "Internt Navn" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: view:account.tax.code:0 msgid "Account Tax Code" diff --git a/addons/account/i18n/nl_BE.po b/addons/account/i18n/nl_BE.po index fb7ac3d362e..0b2f06435b0 100644 --- a/addons/account/i18n/nl_BE.po +++ b/addons/account/i18n/nl_BE.po @@ -26,6 +26,11 @@ msgstr "Interne naam" msgid "Account Tax Code" msgstr "Belasting code" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: field:account.partner.balance,result_selection:0 #: field:account.aged.trial.balance,result_selection:0 diff --git a/addons/account/i18n/oc.po b/addons/account/i18n/oc.po index 5bea3f0baaf..cb6e5c943ca 100644 --- a/addons/account/i18n/oc.po +++ b/addons/account/i18n/oc.po @@ -22,6 +22,11 @@ msgstr "" msgid "Internal Name" msgstr "Nom intèrne" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: view:account.tax.code:0 msgid "Account Tax Code" diff --git a/addons/account/i18n/pt.po b/addons/account/i18n/pt.po index 2061468e068..4d4c1b33d67 100644 --- a/addons/account/i18n/pt.po +++ b/addons/account/i18n/pt.po @@ -26,6 +26,11 @@ msgstr "Nome Interno" msgid "Account Tax Code" msgstr "Código do Imposto da Conta" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: model:ir.actions.act_window,name:account.action_invoice_tree9 #: model:ir.ui.menu,name:account.menu_action_invoice_tree9 diff --git a/addons/account/i18n/pt_BR.po b/addons/account/i18n/pt_BR.po index 52104241da4..d0f262404c2 100644 --- a/addons/account/i18n/pt_BR.po +++ b/addons/account/i18n/pt_BR.po @@ -21,6 +21,11 @@ msgstr "" msgid "Internal Name" msgstr "Nome Interno" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: view:account.tax.code:0 msgid "Account Tax Code" diff --git a/addons/account/i18n/ro.po b/addons/account/i18n/ro.po index 1368ed0ea4e..9d7c4545891 100644 --- a/addons/account/i18n/ro.po +++ b/addons/account/i18n/ro.po @@ -26,6 +26,11 @@ msgstr "Nume intern" msgid "Account Tax Code" msgstr "Cod cont taxa" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: model:ir.actions.act_window,name:account.action_invoice_tree9 #: model:ir.ui.menu,name:account.menu_action_invoice_tree9 diff --git a/addons/account/i18n/si.po b/addons/account/i18n/si.po index 3724668ac57..090213d32ce 100644 --- a/addons/account/i18n/si.po +++ b/addons/account/i18n/si.po @@ -34,6 +34,11 @@ msgstr "" msgid "Partner's" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: field:account.partner.balance,display_partner:0 msgid "Display Partners" diff --git a/addons/account/i18n/sk.po b/addons/account/i18n/sk.po index b55bdc77af5..4abd57c998b 100644 --- a/addons/account/i18n/sk.po +++ b/addons/account/i18n/sk.po @@ -3860,6 +3860,11 @@ msgstr "" msgid "Select Chart" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: selection:account.chart,init,target_move:0 #: model:ir.actions.report.xml,name:account.account_move_line_list diff --git a/addons/account/i18n/sl.po b/addons/account/i18n/sl.po index d2291ea07a0..f368c9a3e23 100644 --- a/addons/account/i18n/sl.po +++ b/addons/account/i18n/sl.po @@ -28,6 +28,11 @@ msgstr "Interni naziv" msgid "Partner's" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: model:ir.ui.menu,name:account.menu_account_pl_report msgid "Profit And Loss" diff --git a/addons/account/i18n/sq.po b/addons/account/i18n/sq.po index 1d91580af96..2f2aff4dc8c 100644 --- a/addons/account/i18n/sq.po +++ b/addons/account/i18n/sq.po @@ -29,6 +29,11 @@ msgstr "Emri i Brendshëm" msgid "Partner's" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: field:account.partner.balance,display_partner:0 msgid "Display Partners" diff --git a/addons/account/i18n/sr.po b/addons/account/i18n/sr.po index 8be975a9d13..de2e78a4156 100644 --- a/addons/account/i18n/sr.po +++ b/addons/account/i18n/sr.po @@ -27,6 +27,11 @@ msgstr "Interno ime" msgid "Account Tax Code" msgstr "Poreska tarifa konta" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: model:ir.actions.act_window,name:account.action_invoice_tree9 #: model:ir.ui.menu,name:account.menu_action_invoice_tree9 diff --git a/addons/account/i18n/sv.po b/addons/account/i18n/sv.po index 255868db137..c7fc02af513 100644 --- a/addons/account/i18n/sv.po +++ b/addons/account/i18n/sv.po @@ -31,6 +31,11 @@ msgstr "For Tax Type percent enter % ratio between 0-1." msgid "Account Tax Code" msgstr "Konto, momskod" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: code:addons/account/wizard/wizard_fiscalyear_close.py:0 #, python-format diff --git a/addons/account/i18n/ta.po b/addons/account/i18n/ta.po index 3bcbb806af1..141f13322ae 100644 --- a/addons/account/i18n/ta.po +++ b/addons/account/i18n/ta.po @@ -29,6 +29,11 @@ msgstr "உட் பெயர்" msgid "Partner's" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: model:ir.ui.menu,name:account.menu_account_pl_report msgid "Profit And Loss" diff --git a/addons/account/i18n/te.po b/addons/account/i18n/te.po index 718011859cd..ed00b4b4e94 100644 --- a/addons/account/i18n/te.po +++ b/addons/account/i18n/te.po @@ -32,6 +32,11 @@ msgstr "" msgid "Profit And Loss" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: model:ir.ui.menu,name:account.menu_account_bs_report msgid "Balance Sheet" diff --git a/addons/account/i18n/th.po b/addons/account/i18n/th.po index 35feb251b63..e5aef73956d 100644 --- a/addons/account/i18n/th.po +++ b/addons/account/i18n/th.po @@ -34,6 +34,11 @@ msgstr "รหัสบัญชีภาษี" msgid "Partner's" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: field:account.partner.balance,display_partner:0 msgid "Display Partners" diff --git a/addons/account/i18n/tlh.po b/addons/account/i18n/tlh.po index 8691c6e0e10..c65e9ba80d4 100644 --- a/addons/account/i18n/tlh.po +++ b/addons/account/i18n/tlh.po @@ -33,6 +33,11 @@ msgstr "" msgid "Partner's" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: field:account.partner.balance,display_partner:0 msgid "Display Partners" diff --git a/addons/account/i18n/tr.po b/addons/account/i18n/tr.po index a3e5bf47c6a..2e6906058f0 100644 --- a/addons/account/i18n/tr.po +++ b/addons/account/i18n/tr.po @@ -26,6 +26,11 @@ msgstr "Dahili İsim" msgid "Account Tax Code" msgstr "Hesap Vergi Kodu" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: model:ir.actions.act_window,name:account.action_invoice_tree9 #: model:ir.ui.menu,name:account.menu_action_invoice_tree9 diff --git a/addons/account/i18n/ug.po b/addons/account/i18n/ug.po index c1a0ee44fdb..5eddb6d0be7 100644 --- a/addons/account/i18n/ug.po +++ b/addons/account/i18n/ug.po @@ -29,6 +29,11 @@ msgstr "ئىچكى ئىسمى" msgid "Partner's" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: field:account.partner.balance,display_partner:0 msgid "Display Partners" diff --git a/addons/account/i18n/uk.po b/addons/account/i18n/uk.po index 001ce91b0f2..8fa3e7652ac 100644 --- a/addons/account/i18n/uk.po +++ b/addons/account/i18n/uk.po @@ -28,6 +28,11 @@ msgstr "Внутрішня назва" msgid "Partner's" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: field:account.partner.balance,display_partner:0 msgid "Display Partners" diff --git a/addons/account/i18n/zh_CN.po b/addons/account/i18n/zh_CN.po index 52973936def..a3c29ee8820 100644 --- a/addons/account/i18n/zh_CN.po +++ b/addons/account/i18n/zh_CN.po @@ -26,6 +26,11 @@ msgstr "内部名称" msgid "Account Tax Code" msgstr "税事务科目" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: model:ir.actions.act_window,name:account.action_invoice_tree9 #: model:ir.ui.menu,name:account.menu_action_invoice_tree9 diff --git a/addons/account/i18n/zh_HK.po b/addons/account/i18n/zh_HK.po index 6c864a26e64..8adaea2332d 100644 --- a/addons/account/i18n/zh_HK.po +++ b/addons/account/i18n/zh_HK.po @@ -27,6 +27,11 @@ msgstr "內部名稱" msgid "Account Tax Code" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: model:ir.actions.act_window,name:account.action_invoice_tree9 #: model:ir.ui.menu,name:account.menu_action_invoice_tree9 diff --git a/addons/account/i18n/zh_TW.po b/addons/account/i18n/zh_TW.po index 694d041e926..e6157c7e5e6 100644 --- a/addons/account/i18n/zh_TW.po +++ b/addons/account/i18n/zh_TW.po @@ -27,6 +27,11 @@ msgstr "內部名稱" msgid "Partner's" msgstr "" +#. module: account +#: model:ir.ui.menu,name:account.next_id_22 +msgid "Partners" +msgstr "" + #. module: account #: field:account.partner.balance,display_partner:0 msgid "Display Partners" From de80030a876bea0a0347ce6d93e6c8054aa56776 Mon Sep 17 00:00:00 2001 From: mtr Date: Tue, 23 Nov 2010 16:31:01 +0530 Subject: [PATCH 11/30] [IMP] Account_sequence: code cleaning bzr revid: mtr@mtr-20101123110101-pkttkomd1ma8chbm --- addons/account_sequence/__openerp__.py | 6 +++++- .../account_sequence/account_sequence_installer.py | 12 ++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/addons/account_sequence/__openerp__.py b/addons/account_sequence/__openerp__.py index 2cc6f50e138..1e3f91a7876 100644 --- a/addons/account_sequence/__openerp__.py +++ b/addons/account_sequence/__openerp__.py @@ -30,7 +30,11 @@ 'website': 'http://www.openerp.com', 'depends': ['account'], 'init_xml': [], - 'update_xml': ['account_sequence_data.xml','account_sequence_installer_view.xml','account_sequence.xml'], + 'update_xml': [ + 'account_sequence_data.xml', + 'account_sequence_installer_view.xml', + 'account_sequence.xml' + ], 'demo_xml': [], 'installable': True, 'active': False, diff --git a/addons/account_sequence/account_sequence_installer.py b/addons/account_sequence/account_sequence_installer.py index d07c0e481aa..b7b6954bcc1 100644 --- a/addons/account_sequence/account_sequence_installer.py +++ b/addons/account_sequence/account_sequence_installer.py @@ -31,7 +31,7 @@ class account_sequence_installer(osv.osv_memory): def _get_internal_sequence(self, cr, uid, context): obj_sequence = self.pool.get('ir.sequence') - seq_id = obj_sequence.search(cr, uid, [('name','=', 'Internal Sequence Journal')]) + seq_id = obj_sequence.search(cr, uid, [('name', '=', 'Internal Sequence Journal')]) for seq in obj_sequence.browse(cr, uid, seq_id): if seq.id: return seq.id @@ -43,21 +43,21 @@ class account_sequence_installer(osv.osv_memory): res = super(account_sequence_installer, self).execute(cr, uid, ids, context=context) jou_obj = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') - journal_ids = jou_obj.search(cr, uid, [('type','in',['sale','sale_refund','purchase','purchase_refund','cash', 'bank', 'general','situation'])]) + journal_ids = jou_obj.search(cr, uid, [('type', 'in', ['sale', 'sale_refund', 'purchase', 'purchase_refund', 'cash', 'bank', 'general', 'situation'])]) for line in self.browse(cr, uid, ids): for journal in jou_obj.browse(cr, uid, journal_ids): if not journal.internal_sequence: - seq_id = obj_sequence.search(cr, uid, [('name','=', line.internal_sequence.name)]) + seq_id = obj_sequence.search(cr, uid, [('name', '=', line.internal_sequence.name)]) for seq in obj_sequence.browse(cr, uid, seq_id): if seq.id: jou_obj.write(cr, uid, [journal.id], {'internal_sequence': seq.id}) return res _defaults = { - 'internal_sequence': _get_internal_sequence - } + 'internal_sequence': _get_internal_sequence + } account_sequence_installer() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file From 6269b4aabed7e43f03b64f97c0656e0617bf01c6 Mon Sep 17 00:00:00 2001 From: mtr Date: Tue, 23 Nov 2010 19:12:18 +0530 Subject: [PATCH 12/30] [FIX] Sale: 'Recreate procurement' on shipping exception ignores partial deliveries lp bug: https://launchpad.net/bugs/674420 fixed bzr revid: mtr@mtr-20101123134218-qa6lf3us1c1k76zc --- addons/sale/sale.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 29826e1c293..27740cbd8ac 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -671,6 +671,8 @@ class sale_order(osv.osv): def action_ship_create(self, cr, uid, ids, *args): wf_service = netsvc.LocalService("workflow") picking_id = False + move_obj = self.pool.get('stock.move') + proc_obj = self.pool.get('procurement.order') company = self.pool.get('res.users').browse(cr, uid, uid).company_id for order in self.browse(cr, uid, ids, context={}): proc_ids = [] @@ -742,7 +744,13 @@ class sale_order(osv.osv): }) proc_ids.append(proc_id) self.pool.get('sale.order.line').write(cr, uid, [line.id], {'procurement_id': proc_id}) - + + if line.state == 'exception': + for pick in order.picking_ids: + for moves in pick.move_lines: + if moves.state == 'cancel': + move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) + proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) val = {} for proc_id in proc_ids: wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr) @@ -752,7 +760,8 @@ class sale_order(osv.osv): if order.state == 'shipping_except': val['state'] = 'progress' - + val['shipped'] = False + if (order.order_policy == 'manual'): for line in order.order_line: if (not line.invoiced) and (line.state not in ('cancel', 'draft')): From 9b50d07a9b91bde3b4463c7e8d92510f432c92f4 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Wed, 24 Nov 2010 12:26:40 +0530 Subject: [PATCH 13/30] [ADD] account_voucher: implement writeoff on customer and vendor payment bzr revid: psi@tinyerp.co.in-20101124065640-z04pv5m86nhrf9ar --- addons/account_voucher/account_voucher.py | 27 +++++++++-- .../voucher_payment_receipt_view.xml | 46 ++++++++++++++++--- 2 files changed, 64 insertions(+), 9 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index f902810ac31..37a418c0941 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -26,6 +26,7 @@ import netsvc from osv import fields from osv import osv from tools.translate import _ +import decimal_precision as dp class account_move_line(osv.osv): _inherit = 'account.move.line' @@ -190,6 +191,14 @@ class account_voucher(osv.osv): 'tax_id':fields.many2one('account.tax', 'Tax', readonly=True, states={'draft':[('readonly',False)]}), 'pre_line':fields.boolean('Previous Payments ?', required=False), 'date_due': fields.date('Due Date', readonly=True, states={'draft':[('readonly',False)]}), + 'payment_option':fields.selection([ + ('not_reconcile', 'Without Write-off'), + ('close_balance', 'With Write-off'), + ], 'Payment Option', required=True, readonly=True, states={'draft': [('readonly', False)]}), + 'writeoff_acc_id': fields.many2one('account.account', 'Write-Off account', readonly=True, states={'draft': [('readonly', False)]}), + 'writeoff_journal_id': fields.many2one('account.journal', 'Write-Off journal', readonly=True, states={'draft': [('readonly', False)]}), + 'comment': fields.char('Comment', size=64, readonly=True, states={'draft': [('readonly', False)]}), + 'analytic_id': fields.many2one('account.analytic.account','Analytic Account', readonly=True, states={'draft': [('readonly', False)]}), } _defaults = { 'period_id': _get_period, @@ -205,6 +214,8 @@ class account_voucher(osv.osv): 'date': lambda *a: time.strftime('%Y-%m-%d'), 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.voucher',context=c), 'tax_id': _get_tax, + 'payment_option': 'not_reconcile', + 'comment': 'Write-Off', } def compute_tax(self, cr, uid, ids, context={}): @@ -694,6 +705,10 @@ class account_voucher(osv.osv): if line.move_line_id.id: rec_ids = [master_line, line.move_line_id.id] rec_list_ids.append(rec_ids) + writeoff_account_id = False + writeoff_journal_id = False + writeoff_period_id = inv.period_id.id, + comment = False if not currency_pool.is_zero(cr, uid, inv.currency_id, line_total): diff = line_total @@ -717,6 +732,15 @@ class account_voucher(osv.osv): move_line['account_id'] = account_id move_line_pool.create(cr, uid, move_line) + for rec_ids in rec_list_ids: + if len(rec_ids) >= 2: + if inv.payment_option == 'close_balance': + writeoff_account_id = inv.writeoff_acc_id.id + writeoff_journal_id = inv.writeoff_journal_id.id + comment = inv.comment + self.pool.get('account.move.line').reconcile(cr, uid, rec_ids, 'manual', writeoff_account_id, writeoff_period_id, writeoff_journal_id, context) + else: + move_line_pool.reconcile_partial(cr, uid, rec_ids) self.write(cr, uid, [inv.id], { 'move_id': move_id, @@ -724,9 +748,6 @@ class account_voucher(osv.osv): 'number': name, }) move_pool.post(cr, uid, [move_id], context={}) - for rec_ids in rec_list_ids: - if len(rec_ids) >= 2: - move_line_pool.reconcile_partial(cr, uid, rec_ids) return True def copy(self, cr, uid, id, default={}, context=None): diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index 83b6243a627..487cf5aa38d 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -196,10 +196,27 @@
+ + + + + + + + + - - - + + + + + @@ -304,10 +321,27 @@
+ + + + + + + + + - - - + + + + + From 5189d31000c6a809e6cef495e1dc9466e0b368f4 Mon Sep 17 00:00:00 2001 From: mtr Date: Wed, 24 Nov 2010 12:59:23 +0530 Subject: [PATCH 14/30] [IMP] account_sequence:_get_internal_sequence search using xml_id and search all journals without any domain bzr revid: mtr@mtr-20101124072923-ofkrd55uz1g15ild --- .../account_sequence/account_sequence_installer.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/addons/account_sequence/account_sequence_installer.py b/addons/account_sequence/account_sequence_installer.py index b7b6954bcc1..16808565380 100644 --- a/addons/account_sequence/account_sequence_installer.py +++ b/addons/account_sequence/account_sequence_installer.py @@ -30,12 +30,11 @@ class account_sequence_installer(osv.osv_memory): } def _get_internal_sequence(self, cr, uid, context): - obj_sequence = self.pool.get('ir.sequence') - seq_id = obj_sequence.search(cr, uid, [('name', '=', 'Internal Sequence Journal')]) - for seq in obj_sequence.browse(cr, uid, seq_id): - if seq.id: - return seq.id - return False + mod_obj = self.pool.get('ir.model.data') + result = mod_obj.get_object_reference(cr, uid, 'account_sequence', 'internal_sequence_journal') + res = result[1] or False + return res + def execute(self, cr, uid, ids, context): if context is None: @@ -43,8 +42,7 @@ class account_sequence_installer(osv.osv_memory): res = super(account_sequence_installer, self).execute(cr, uid, ids, context=context) jou_obj = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') - journal_ids = jou_obj.search(cr, uid, [('type', 'in', ['sale', 'sale_refund', 'purchase', 'purchase_refund', 'cash', 'bank', 'general', 'situation'])]) - + journal_ids = jou_obj.search(cr, uid, []) for line in self.browse(cr, uid, ids): for journal in jou_obj.browse(cr, uid, journal_ids): if not journal.internal_sequence: From 849a4e9b5f7bcd93fd9fb370e4bad1bd1469bb7a Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Wed, 24 Nov 2010 14:45:14 +0530 Subject: [PATCH 15/30] [REF] Account: journal code size=5 and related demo data changes bzr revid: ara@tinyerp.com-20101124091514-4tyb6ozxi1cnhxfa --- addons/account/account.py | 2 +- addons/account/demo/account_minimal.xml | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 485b085fbbe..f557861700e 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -585,7 +585,7 @@ class account_journal(osv.osv): _description = "Journal" _columns = { 'name': fields.char('Journal Name', size=64, required=True, translate=True), - 'code': fields.char('Code', size=16, required=True, help="The code will be used to generate the numbers of the journal entries of this journal."), + 'code': fields.char('Code', size=5, required=True, help="The code will be used to generate the numbers of the journal entries of this journal."), 'type': fields.selection([('sale', 'Sale'),('sale_refund','Sale Refund'), ('purchase', 'Purchase'), ('purchase_refund','Purchase Refund'), ('cash', 'Cash'), ('bank', 'Bank and Cheques'), ('general', 'General'), ('situation', 'Opening/Closing Situation')], 'Type', size=32, required=True, help="Select 'Sale' for Sale journal to be used at the time of making invoice."\ " Select 'Purchase' for Purchase Journal to be used at the time of approving purchase order."\ diff --git a/addons/account/demo/account_minimal.xml b/addons/account/demo/account_minimal.xml index 10f2df28605..d670cb67d0f 100644 --- a/addons/account/demo/account_minimal.xml +++ b/addons/account/demo/account_minimal.xml @@ -342,7 +342,7 @@ Sales Journal - (test) - SAJ - (test) + SAJ_J sale @@ -353,7 +353,7 @@ Sales Credit Note Journal - (test) - SCNJ - (test) + SCN_J sale_refund @@ -366,7 +366,7 @@ Expenses Journal - (test) - EXJ - (test) + EXJ_J purchase @@ -377,7 +377,7 @@ Expenses Credit Notes Journal - (test) - ECNJ - (test) + ECN_J purchase_refund @@ -390,7 +390,7 @@ Bank Journal - (test) - BNK - (test) + BNK_J bank @@ -401,7 +401,7 @@ Checks Journal - (test) - CHK - (test) + CHK_J bank @@ -412,7 +412,7 @@ Cash Journal - (test) - CSH - (test) + CSH_J cash From 05a36620d1a40892a24e18941c6af0436dcb770f Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Wed, 24 Nov 2010 15:29:35 +0530 Subject: [PATCH 16/30] [REF] Account: replace code name saj_j to sajt bzr revid: ara@tinyerp.com-20101124095935-iex1cdvxdw4rx2dc --- addons/account/demo/account_minimal.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/addons/account/demo/account_minimal.xml b/addons/account/demo/account_minimal.xml index d670cb67d0f..90245f1db98 100644 --- a/addons/account/demo/account_minimal.xml +++ b/addons/account/demo/account_minimal.xml @@ -342,7 +342,7 @@ Sales Journal - (test) - SAJ_J + SAJT sale @@ -353,7 +353,7 @@ Sales Credit Note Journal - (test) - SCN_J + SCNT sale_refund @@ -366,7 +366,7 @@ Expenses Journal - (test) - EXJ_J + EXJT purchase @@ -377,7 +377,7 @@ Expenses Credit Notes Journal - (test) - ECN_J + ECNT purchase_refund @@ -390,7 +390,7 @@ Bank Journal - (test) - BNK_J + BNKT bank @@ -401,7 +401,7 @@ Checks Journal - (test) - CHK_J + CHKT bank @@ -412,7 +412,7 @@ Cash Journal - (test) - CSH_J + CSHT cash From f554fe7496f41f3aa1f101214551b6e46b70204d Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Wed, 24 Nov 2010 15:48:29 +0530 Subject: [PATCH 17/30] [IMP] account_voucher: add writeoff_amount filed which will show the writhoff amount in case of writeoff bzr revid: psi@tinyerp.co.in-20101124101829-qa1dktqg9r7drq71 --- addons/account_voucher/account_voucher.py | 24 +++++++++++++++---- .../voucher_payment_receipt_view.xml | 20 +++++++++------- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 37a418c0941..7ec87552984 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -26,7 +26,6 @@ import netsvc from osv import fields from osv import osv from tools.translate import _ -import decimal_precision as dp class account_move_line(osv.osv): _inherit = 'account.move.line' @@ -141,6 +140,20 @@ class account_voucher(osv.osv): res['arch'] = etree.tostring(doc) return res + def _get_writeoff_amount(self, cr, uid, ids, name, args, context=None): + if not ids: return {} + res = {} + for voucher in self.browse(cr, uid, ids, context=context): + debit= credit = 0.0 + if voucher.line_dr_ids: + for line in voucher.line_dr_ids: + debit += line.amount_unreconciled + if voucher.line_cr_ids: + for line in voucher.line_cr_ids: + credit += line.amount_unreconciled + res[voucher.id] = abs(voucher.amount - abs(credit - debit)) + return res + _name = 'account.voucher' _description = 'Accounting Voucher' _order = "date desc, id desc" @@ -192,13 +205,14 @@ class account_voucher(osv.osv): 'pre_line':fields.boolean('Previous Payments ?', required=False), 'date_due': fields.date('Due Date', readonly=True, states={'draft':[('readonly',False)]}), 'payment_option':fields.selection([ - ('not_reconcile', 'Without Write-off'), - ('close_balance', 'With Write-off'), + ('without_writeoff', 'Without Write-off'), + ('with_writeoff', 'With Write-off'), ], 'Payment Option', required=True, readonly=True, states={'draft': [('readonly', False)]}), 'writeoff_acc_id': fields.many2one('account.account', 'Write-Off account', readonly=True, states={'draft': [('readonly', False)]}), 'writeoff_journal_id': fields.many2one('account.journal', 'Write-Off journal', readonly=True, states={'draft': [('readonly', False)]}), 'comment': fields.char('Comment', size=64, readonly=True, states={'draft': [('readonly', False)]}), 'analytic_id': fields.many2one('account.analytic.account','Analytic Account', readonly=True, states={'draft': [('readonly', False)]}), + 'writeoff_amount': fields.function(_get_writeoff_amount, method=True, string='Writeoff Amount', type='float', readonly=True), } _defaults = { 'period_id': _get_period, @@ -214,7 +228,7 @@ class account_voucher(osv.osv): 'date': lambda *a: time.strftime('%Y-%m-%d'), 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.voucher',context=c), 'tax_id': _get_tax, - 'payment_option': 'not_reconcile', + 'payment_option': 'without_writeoff', 'comment': 'Write-Off', } @@ -734,7 +748,7 @@ class account_voucher(osv.osv): move_line_pool.create(cr, uid, move_line) for rec_ids in rec_list_ids: if len(rec_ids) >= 2: - if inv.payment_option == 'close_balance': + if inv.payment_option == 'with_writeoff': writeoff_account_id = inv.writeoff_acc_id.id writeoff_journal_id = inv.writeoff_journal_id.id comment = inv.comment diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index 487cf5aa38d..0d960e72f96 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -199,16 +199,18 @@ + + attrs="{'invisible':[('payment_option','!=','with_writeoff')], 'required':[('payment_option','=','with_writeoff')]}"/> + attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/> @@ -324,16 +326,18 @@ + + attrs="{'invisible':[('payment_option','!=','with_writeoff')], 'required':[('payment_option','=','with_writeoff')]}"/> + attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/> From ec217d2593fe1e7790e82b4a16bb9020f5894bbe Mon Sep 17 00:00:00 2001 From: mtr Date: Wed, 24 Nov 2010 17:11:51 +0530 Subject: [PATCH 18/30] [IMP] sale:'Recreate procurement' on shipping exception now works with more than one sale order line bzr revid: mtr@mtr-20101124114151-mn9u8b0oyicaj0jr --- addons/sale/sale.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 27740cbd8ac..793d779ff8a 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -676,6 +676,7 @@ class sale_order(osv.osv): company = self.pool.get('res.users').browse(cr, uid, uid).company_id for order in self.browse(cr, uid, ids, context={}): proc_ids = [] + new_moves = [] output_id = order.shop_id.warehouse_id.lot_output_id.id picking_id = False for line in order.order_line: @@ -724,6 +725,8 @@ class sale_order(osv.osv): 'note': line.notes, 'company_id': order.company_id.id, }) + new_moves.append(move_id) + if line.product_id: proc_id = self.pool.get('procurement.order').create(cr, uid, { 'name': line.name, @@ -749,8 +752,9 @@ class sale_order(osv.osv): for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': - move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) - proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) + for move_id in new_moves: + move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) + proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) val = {} for proc_id in proc_ids: wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr) From 0490b3b3fda1c3e956ca796e33de039df21cf887 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Wed, 24 Nov 2010 17:43:47 +0530 Subject: [PATCH 19/30] [REF] account_voucher bzr revid: psi@tinyerp.co.in-20101124121347-lneo86884oijlo2i --- addons/account_voucher/account_voucher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 7ec87552984..03ac3b87ba0 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -752,7 +752,7 @@ class account_voucher(osv.osv): writeoff_account_id = inv.writeoff_acc_id.id writeoff_journal_id = inv.writeoff_journal_id.id comment = inv.comment - self.pool.get('account.move.line').reconcile(cr, uid, rec_ids, 'manual', writeoff_account_id, writeoff_period_id, writeoff_journal_id, context) + move_line_pool.reconcile(cr, uid, rec_ids, 'manual', writeoff_account_id, writeoff_period_id, writeoff_journal_id, context) else: move_line_pool.reconcile_partial(cr, uid, rec_ids) From deead962eb1198eb479201878e5b4c858948af65 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Wed, 24 Nov 2010 17:44:19 +0530 Subject: [PATCH 20/30] [REF] Account: Bank statement reconcilation view with editable and selected field in list view bzr revid: ara@tinyerp.com-20101124121419-0f48w8567k3380di --- addons/account/account_view.xml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 3669bfc8274..510ce076c1d 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -618,7 +618,19 @@ - + + + + + + + + + + + + + From 308394a14b1628474427ebe2b21486550c460375 Mon Sep 17 00:00:00 2001 From: mtr Date: Wed, 24 Nov 2010 18:07:51 +0530 Subject: [PATCH 21/30] [IMP] account_sequence:changes in the execute method and return of _get_internal_sequence method bzr revid: mtr@mtr-20101124123751-tga2tn6oy3ipewrn --- addons/account_sequence/account_sequence_installer.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/account_sequence/account_sequence_installer.py b/addons/account_sequence/account_sequence_installer.py index 16808565380..482e193d8ef 100644 --- a/addons/account_sequence/account_sequence_installer.py +++ b/addons/account_sequence/account_sequence_installer.py @@ -32,7 +32,7 @@ class account_sequence_installer(osv.osv_memory): def _get_internal_sequence(self, cr, uid, context): mod_obj = self.pool.get('ir.model.data') result = mod_obj.get_object_reference(cr, uid, 'account_sequence', 'internal_sequence_journal') - res = result[1] or False + res = result and result[1] or False return res @@ -46,8 +46,7 @@ class account_sequence_installer(osv.osv_memory): for line in self.browse(cr, uid, ids): for journal in jou_obj.browse(cr, uid, journal_ids): if not journal.internal_sequence: - seq_id = obj_sequence.search(cr, uid, [('name', '=', line.internal_sequence.name)]) - for seq in obj_sequence.browse(cr, uid, seq_id): + for seq in obj_sequence.browse(cr, uid, [line.internal_sequence.id]): if seq.id: jou_obj.write(cr, uid, [journal.id], {'internal_sequence': seq.id}) return res From 981e7bd31789bd417daf7287e87ebf55e20de105 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Wed, 24 Nov 2010 18:13:58 +0530 Subject: [PATCH 22/30] [REF] Account: add domain on move line on bank reconciliation bzr revid: ara@tinyerp.com-20101124124358-79r5ef7751kbahc2 --- addons/account/account_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 510ce076c1d..82e3e1e9432 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -618,7 +618,7 @@ - + From 8b58799b9be93b6244cb3c202e682d994df994b3 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Wed, 24 Nov 2010 19:02:06 +0530 Subject: [PATCH 23/30] [REF] Account: change sequence of move line on bank reconciliation bzr revid: ara@tinyerp.com-20101124133206-ca2x4pp238koi0i4 --- addons/account/account_view.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 82e3e1e9432..c4a1d447ad9 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -620,15 +620,15 @@ - - - + - + + + + - From e95aad1ed60f2de4bdf8cf19125ad31a201aa369 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Thu, 25 Nov 2010 13:45:08 +0530 Subject: [PATCH 24/30] [FIX] hr_expense: invoiced filter button hr expense report not with invoiced and paid state of exepense bzr revid: mra@mra-laptop-20101125081508-54ivx177g94gxlmr --- addons/hr_expense/report/hr_expense_report_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_expense/report/hr_expense_report_view.xml b/addons/hr_expense/report/hr_expense_report_view.xml index ba05ee476a7..0018a7e2ce2 100644 --- a/addons/hr_expense/report/hr_expense_report_view.xml +++ b/addons/hr_expense/report/hr_expense_report_view.xml @@ -69,7 +69,7 @@ - From 55ef479cf0b40fbf6bb0aec9660af00df2104a24 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Thu, 25 Nov 2010 16:45:58 +0530 Subject: [PATCH 25/30] [FIX] Account: intiala balance with periods filter bzr revid: mra@mra-laptop-20101125111558-a3lj88wh6157e6yg --- addons/account/account_move_line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 93d5c37bd08..5b23330c226 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -82,7 +82,7 @@ class account_move_line(osv.osv): periods = fiscalperiod_obj.search(cr, uid, [('date_start', '<', first_period.date_start)]) periods = ','.join([str(x) for x in periods]) if periods: - query = obj+".state <> 'draft' AND "+obj+".period_id IN (SELECT id FROM account_period WHERE fiscalyear_id IN (%s) OR id IN (%s)) %s %s" % (fiscalyear_clause, periods, where_move_state, where_move_lines_by_date) + query = obj+".state <> 'draft' AND "+obj+".period_id IN (SELECT id FROM account_period WHERE fiscalyear_id IN (%s) AND id IN (%s)) %s %s" % (fiscalyear_clause, periods, where_move_state, where_move_lines_by_date) else: ids = ','.join([str(x) for x in context['periods']]) query = obj+".state <> 'draft' AND "+obj+".period_id IN (SELECT id FROM account_period WHERE fiscalyear_id IN (%s) AND id IN (%s)) %s %s" % (fiscalyear_clause, ids, where_move_state, where_move_lines_by_date) From df57bcc6b6b911b65516e5e1716a6b18f4c1b334 Mon Sep 17 00:00:00 2001 From: "RVO(OpenERP)" <> Date: Thu, 25 Nov 2010 17:28:38 +0530 Subject: [PATCH 26/30] [FIX] Account: historical currency rate support lp bug: https://launchpad.net/bugs/591961 fixed bzr revid: mra@mra-laptop-20101125115838-nsx04bclby615iaw --- addons/account/account_move_line.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 5b23330c226..307ab1f58da 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -541,7 +541,9 @@ class account_move_line(osv.osv): ] #TODO: ONCHANGE_ACCOUNT_ID: set account_tax_id - def onchange_currency(self, cr, uid, ids, account_id, amount, currency_id, date=False, journal=False): + def onchange_currency(self, cr, uid, ids, account_id, amount, currency_id, date=False, journal=False, context=None): + if context is None: + context = {} account_obj = self.pool.get('account.account') journal_obj = self.pool.get('account.journal') currency_obj = self.pool.get('res.currency') @@ -552,7 +554,8 @@ class account_move_line(osv.osv): if (amount>0) and journal: x = journal_obj.browse(cr, uid, journal).default_credit_account_id if x: acc = x - v = currency_obj.compute(cr, uid, currency_id, acc.company_id.currency_id.id, amount, account=acc) + context.update({'date': date}) + v = currency_obj.compute(cr, uid, currency_id, acc.company_id.currency_id.id, amount, account=acc, context=context) result['value'] = { 'debit': v > 0 and v or 0.0, 'credit': v < 0 and -v or 0.0 From 93c0f3f02fa3545b209288f5b6acd220064602d2 Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Fri, 26 Nov 2010 11:28:30 +0100 Subject: [PATCH 27/30] [IMP] account_sequence: *rename the field internal_sequence in internal_sequence_id *improved the installation wizard to display the fields of the sequence to create (more user friendly) *set the config wizard as "on_skip" bzr revid: qdp-launchpad@tinyerp.com-20101126102830-9ppwdb3m205634jp --- addons/account_sequence/account_sequence.py | 4 +- addons/account_sequence/account_sequence.xml | 2 +- .../account_sequence_installer.py | 54 +++++++++++++------ .../account_sequence_installer_view.xml | 10 +++- 4 files changed, 50 insertions(+), 20 deletions(-) diff --git a/addons/account_sequence/account_sequence.py b/addons/account_sequence/account_sequence.py index 82d416e84ca..642521f4688 100644 --- a/addons/account_sequence/account_sequence.py +++ b/addons/account_sequence/account_sequence.py @@ -46,7 +46,7 @@ class account_journal(osv.osv): _inherit = "account.journal" _columns = { - 'internal_sequence': fields.many2one('ir.sequence', 'Internal Sequence', help="This sequence will be used to maintain the internal number for the journal entries related to this journal."), + 'internal_sequence_id': fields.many2one('ir.sequence', 'Internal Sequence', help="This sequence will be used to maintain the internal number for the journal entries related to this journal."), } account_journal() @@ -60,4 +60,4 @@ class account_move_line(osv.osv): account_move_line() -# 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_sequence/account_sequence.xml b/addons/account_sequence/account_sequence.xml index dd9c1a36cd4..6b9e2c94402 100644 --- a/addons/account_sequence/account_sequence.xml +++ b/addons/account_sequence/account_sequence.xml @@ -21,7 +21,7 @@ - + diff --git a/addons/account_sequence/account_sequence_installer.py b/addons/account_sequence/account_sequence_installer.py index 5375ee6fae3..fb0f5840566 100644 --- a/addons/account_sequence/account_sequence_installer.py +++ b/addons/account_sequence/account_sequence_installer.py @@ -26,33 +26,57 @@ class account_sequence_installer(osv.osv_memory): _inherit = 'res.config.installer' _columns = { - 'internal_sequence': fields.many2one('ir.sequence', 'Internal Sequence', help="This sequence will be used on Journals to maintain internal number for accounting entries."), + 'name': fields.char('Name',size=64, required=True), + 'prefix': fields.char('Prefix',size=64, help="Prefix value of the record for the sequence"), + 'suffix': fields.char('Suffix',size=64, help="Suffix value of the record for the sequence"), + 'number_next': fields.integer('Next Number', required=True, help="Next number of this sequence"), + 'number_increment': fields.integer('Increment Number', required=True, help="The next number of the sequence will be incremented by this number"), + 'padding' : fields.integer('Number padding', required=True, help="OpenERP will automatically adds some '0' on the left of the 'Next Number' to get the required padding size."), + 'company_id': fields.many2one('res.company', 'Company'), + } + _defaults = { + 'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'ir.sequence', context=c), + 'number_increment': 1, + 'number_next': 1, + 'padding' : 0, + 'name': 'Internal Sequence Journal', } - - def _get_internal_sequence(self, cr, uid, context=None): - result = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_sequence', 'internal_sequence_journal') - return result and result[1] or False def execute(self, cr, uid, ids, context=None): if context is None: context = {} jou_obj = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') - record = self.browse(cr, uid, ids)[0] + record = self.browse(cr, uid, ids, context)[0] j_ids = [] + if record.company_id: + company_id = record.company_id.id, + search_criteria = [('company_id', '=', company_id)] + else: + company_id = False + search_criteria = [] + vals = { + 'id': 'internal_sequence_journal', + 'code': 'account.journal', + 'name': record.name, + 'prefix': record.prefix, + 'suffix': record.suffix, + 'number_next': record.number_next, + 'number_increment': record.number_increment, + 'padding' : record.padding, + 'company_id': company_id, + } + + ir_seq = obj_sequence.create(cr, uid, vals, context) res = super(account_sequence_installer, self).execute(cr, uid, ids, context=context) - journal_ids = jou_obj.search(cr, uid, [], context=context) - for journal in jou_obj.browse(cr, uid, journal_ids): - if not journal.internal_sequence: + journal_ids = jou_obj.search(cr, uid, search_criteria, context=context) + for journal in jou_obj.browse(cr, uid, journal_ids, context): + if not journal.internal_sequence_id: j_ids.append(journal.id) if j_ids: - jou_obj.write(cr, uid, j_ids, {'internal_sequence': record.internal_sequence.id}) + jou_obj.write(cr, uid, j_ids, {'internal_sequence_id': ir_seq}) return res - _defaults = { - 'internal_sequence': _get_internal_sequence - } - account_sequence_installer() -# 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_sequence/account_sequence_installer_view.xml b/addons/account_sequence/account_sequence_installer_view.xml index a4808a2c858..1051b133045 100644 --- a/addons/account_sequence/account_sequence_installer_view.xml +++ b/addons/account_sequence/account_sequence_installer_view.xml @@ -22,7 +22,13 @@ You can enhance the Account Sequence Application by installing . - + + + + + + + Configure @@ -44,7 +50,7 @@ 3 - always + onskip From 18a03628af95800807077569e07780a7509f76d9 Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Fri, 26 Nov 2010 11:38:44 +0100 Subject: [PATCH 28/30] [FIX] account_sequence: fixed the previous change of field name internal_sequence_id bzr revid: qdp-launchpad@tinyerp.com-20101126103844-1wnwbu00nk0pji1d --- addons/account_sequence/account_sequence.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/account_sequence/account_sequence.py b/addons/account_sequence/account_sequence.py index 642521f4688..56accc5f6eb 100644 --- a/addons/account_sequence/account_sequence.py +++ b/addons/account_sequence/account_sequence.py @@ -33,11 +33,11 @@ class account_move(osv.osv): obj_sequence = self.pool.get('ir.sequence') res = super(account_move, self).post(cr, uid, ids, context=context) seq_no = False - for line in self.browse(cr, uid, ids): - if line.journal_id.internal_sequence: - seq_no = obj_sequence.get_id(cr, uid, line.journal_id.internal_sequence.id, context=context) + for move in self.browse(cr, uid, ids, context): + if move.journal_id.internal_sequence_id: + seq_no = obj_sequence.get_id(cr, uid, move.journal_id.internal_sequence_id.id, context=context) if seq_no: - self.write(cr, uid, [line.id], {'internal_sequence_number': seq_no}) + self.write(cr, uid, [move.id], {'internal_sequence_number': seq_no}) return res account_move() From 56bbbfcd62e0037bd86c5de77768b281d25da450 Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Fri, 26 Nov 2010 15:35:24 +0100 Subject: [PATCH 29/30] [FIX] account_sequence: ir.values for default internal sequence on new journals bzr revid: qdp-launchpad@tinyerp.com-20101126143524-gl3g2xkmr3eiy453 --- addons/account_sequence/account_sequence_data.xml | 8 -------- addons/account_sequence/account_sequence_installer.py | 1 + 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/addons/account_sequence/account_sequence_data.xml b/addons/account_sequence/account_sequence_data.xml index 0059f7d41a9..1ad362b3979 100644 --- a/addons/account_sequence/account_sequence_data.xml +++ b/addons/account_sequence/account_sequence_data.xml @@ -1,14 +1,6 @@ - - - Internal Sequence Journal - account.journal - 1 - - - diff --git a/addons/account_sequence/account_sequence_installer.py b/addons/account_sequence/account_sequence_installer.py index fb0f5840566..f7bcb113388 100644 --- a/addons/account_sequence/account_sequence_installer.py +++ b/addons/account_sequence/account_sequence_installer.py @@ -75,6 +75,7 @@ class account_sequence_installer(osv.osv_memory): j_ids.append(journal.id) if j_ids: jou_obj.write(cr, uid, j_ids, {'internal_sequence_id': ir_seq}) + self.pool.get('ir.values').set(cr, uid, key='default', key2=False, name='internal_sequence_id', models =[('account.journal', False)], value=ir_seq) return res account_sequence_installer() From 382f6fc8c55cb866c4bc8d54c7a4b13694648d46 Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Fri, 26 Nov 2010 16:14:46 +0100 Subject: [PATCH 30/30] [FIX] account: statement reconciliaiton improved bzr revid: qdp-launchpad@tinyerp.com-20101126151446-72q1m6qc9efqqga0 --- addons/account/account_bank_statement.py | 12 +++++++----- addons/account/account_view.xml | 5 +++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 173f0651a90..93d2a6fb00d 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -149,6 +149,7 @@ class account_bank_statement(osv.osv): \n* And after getting confirmation from the bank it will be in \'Confirmed\' state.'), 'currency': fields.function(_currency, method=True, string='Currency', type='many2one', relation='res.currency'), + 'account_id': fields.related('journal_id', 'default_debit_account_id', type='many2one', relation='account.account', string='Account used in this journal', readonly=True, help='used in statement reconciliation domain, but shouldn\'t be used elswhere.'), } _defaults = { @@ -369,14 +370,15 @@ class account_bank_statement(osv.osv): done.append(st.id) return self.write(cr, uid, done, {'state':'draft'}, context=context) - def onchange_journal_id(self, cursor, user, statement_id, journal_id, context=None): - cursor.execute('SELECT balance_end_real \ + def onchange_journal_id(self, cr, uid, statement_id, journal_id, context=None): + cr.execute('SELECT balance_end_real \ FROM account_bank_statement \ WHERE journal_id = %s AND NOT state = %s \ ORDER BY date DESC,id DESC LIMIT 1', (journal_id, 'draft')) - res = cursor.fetchone() + res = cr.fetchone() balance_start = res and res[0] or 0.0 - return {'value': {'balance_start': balance_start}} + account_id = self.pool.get('account.journal').read(cr, uid, journal_id, ['default_debit_account_id'], context=context)['default_debit_account_id'] + return {'value': {'balance_start': balance_start, 'account_id': account_id}} def unlink(self, cr, uid, ids, context=None): stat = self.read(cr, uid, ids, ['state']) @@ -454,4 +456,4 @@ class account_bank_statement_line(osv.osv): account_bank_statement_line() -# 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/account_view.xml b/addons/account/account_view.xml index c4a1d447ad9..f2b4da6ea23 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -609,16 +609,17 @@ - + + - +