From f43ab717cc8ca5a9dc50d611cd0d713a51544b4d Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Thu, 26 Aug 2010 14:23:58 +0530 Subject: [PATCH 01/28] [IMP] Account: Bank statements will not consider boolean on journal entry_posted bzr revid: mra@mra-laptop-20100826085358-d4jgljoknte4q9yd --- addons/account/account_bank_statement.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 270384a1d9f..6874f80bcf3 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -368,16 +368,15 @@ class account_bank_statement(osv.osv): else: account_move_line_obj.reconcile_partial(cr, uid, torec, 'statement', context) - if st.journal_id.entry_posted: - account_move_obj.write(cr, uid, [move_id], {'state': 'posted'}) - self.log(cr, uid, st.id, 'Statement %s is confirmed and entries are created.' % st.name) done.append(st.id) next_number = obj_seq.get(cr, uid, 'account.bank.statement') if not st.name == '/': next_number = st.name + '/' + next_number[-1:] - account_move_obj.write(cr, uid, [move_id], {'state': 'posted', 'name': next_number}) + account_move_obj.write(cr, uid, [move_id], {'name': next_number}) + + account_move_obj.write(cr, uid, [move_id], {'state': 'posted'}) # Bank statements will not consider boolean on journal entry_posted self.write(cr, uid, [st.id], {'name': next_number}, context=context) self.write(cr, uid, done, {'state':'confirm'}, context=context) From 17d6bbf3c9a2520fe058676d82f64dc13d015c58 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Thu, 26 Aug 2010 14:42:23 +0530 Subject: [PATCH 02/28] [FIX] account bank statements: onchange on journal make wrong amount bzr revid: mra@mra-laptop-20100826091223-1u5aee3lkzjiix8k --- addons/account/account_bank_statement.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 6874f80bcf3..50d13d24a5c 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -405,8 +405,8 @@ class account_bank_statement(osv.osv): cursor.execute('SELECT balance_end_real \ FROM account_bank_statement \ - WHERE journal_id = %s \ - ORDER BY date DESC,id DESC LIMIT 1', (journal_id,)) + WHERE journal_id = %s AND NOT state = %s \ + ORDER BY date DESC,id DESC LIMIT 1', (journal_id, 'draft')) res = cursor.fetchone() balance_start = res and res[0] or 0.0 From f96ee5cded18e23b805880a89dd07a36c45e0579 Mon Sep 17 00:00:00 2001 From: vra Date: Thu, 26 Aug 2010 15:15:13 +0530 Subject: [PATCH 03/28] [IMP][FIX] account: Added context instead of domain in different act windows of partner object, Fixed 'active_id' error in code. bzr revid: vra@tinyerp.com-20100826094513-2x22qhx6727g6f5t --- addons/account/account_invoice_view.xml | 2 +- addons/account/account_view.xml | 4 ++-- addons/account/partner_view.xml | 4 ++-- addons/account/report/account_invoice_report_view.xml | 3 +-- addons/account/wizard/account_change_currency.py | 9 +++++---- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 41d0344de92..db70d5e0e5a 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -500,7 +500,7 @@ - + diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index bab05321f4d..a95b96aae9b 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1818,9 +1818,9 @@ - + - + Create Account diff --git a/addons/account/partner_view.xml b/addons/account/partner_view.xml index f3a8cca8ada..7f3c344ebff 100644 --- a/addons/account/partner_view.xml +++ b/addons/account/partner_view.xml @@ -130,8 +130,8 @@ diff --git a/addons/account/report/account_invoice_report_view.xml b/addons/account/report/account_invoice_report_view.xml index b241b725673..d017a6cbc11 100644 --- a/addons/account/report/account_invoice_report_view.xml +++ b/addons/account/report/account_invoice_report_view.xml @@ -156,10 +156,9 @@ diff --git a/addons/account/wizard/account_change_currency.py b/addons/account/wizard/account_change_currency.py index aa6b477d30d..9355691369e 100644 --- a/addons/account/wizard/account_change_currency.py +++ b/addons/account/wizard/account_change_currency.py @@ -33,10 +33,11 @@ class account_change_currency(osv.osv_memory): obj_inv = self.pool.get('account.invoice') if context is None: context = {} - state = obj_inv.browse(cr, uid, context['active_id']).state - if obj_inv.browse(cr, uid, context['active_id']).state != 'draft': - raise osv.except_osv(_('Error'), _('You can only change currency for Draft Invoice !')) - pass + if context.get('active_id',False): + state = obj_inv.browse(cr, uid, context['active_id']).state + if obj_inv.browse(cr, uid, context['active_id']).state != 'draft': + raise osv.except_osv(_('Error'), _('You can only change currency for Draft Invoice !')) + pass def change_currency(self, cr, uid, ids, context=None): obj_inv = self.pool.get('account.invoice') From 8262872c719e6c342650c8069392bad7d6ffe5a3 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Thu, 26 Aug 2010 15:20:19 +0530 Subject: [PATCH 04/28] [IMP] bank statements: on change on journal = >Why it returns the currency it is automatically calculated with function field .. no need to return currency with onchange journal bzr revid: mra@mra-laptop-20100826095019-1mohlmz154fylcnh --- addons/account/account_bank_statement.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 50d13d24a5c..c3809b44c04 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -396,28 +396,15 @@ class account_bank_statement(osv.osv): return True def onchange_journal_id(self, cursor, user, statement_id, journal_id, context=None): - if not journal_id: - return {'value': {'currency': False}} - account_journal_obj = self.pool.get('account.journal') res_users_obj = self.pool.get('res.users') - res_currency_obj = self.pool.get('res.currency') - cursor.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() balance_start = res and res[0] or 0.0 - - currency_id = account_journal_obj.browse(cursor, user, journal_id, - context=context).currency.id - if not currency_id: - currency_id = res_users_obj.browse(cursor, user, user, - context=context).company_id.currency_id.id - currency = res_currency_obj.name_get(cursor, user, [currency_id], - context=context)[0] - return {'value': {'balance_start': balance_start, 'currency': currency}} + return {'value': {'balance_start': balance_start}} def unlink(self, cr, uid, ids, context=None): stat = self.read(cr, uid, ids, ['state']) From ad26470a0b68bb0dbfcfe06dca0d18abb8d54e0c Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Thu, 26 Aug 2010 15:32:48 +0530 Subject: [PATCH 05/28] [FIX]: change the name of menu bzr revid: mga@tinyerp.com-20100826100248-e3dfe946epb23yry --- addons/account/account_menuitem.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/account_menuitem.xml b/addons/account/account_menuitem.xml index 3cb21315350..24f4bb795a2 100644 --- a/addons/account/account_menuitem.xml +++ b/addons/account/account_menuitem.xml @@ -3,8 +3,8 @@ - - + + From 31960711d68702a49e2c3a511678e1e3e1e8eb00 Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Thu, 26 Aug 2010 15:33:16 +0530 Subject: [PATCH 06/28] [REM]: remove unused report [FIX]: fix the type in menu domain bzr revid: mga@tinyerp.com-20100826100316-ox9bbz4g3vx6bzfq --- .../account_voucher/voucher_payment_receipt_view.xml | 4 ++-- addons/account_voucher/voucher_report.xml | 11 +---------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index f0bebc49d2c..d11fea7f2f6 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -62,7 +62,7 @@ Vendor Payment account.voucher.open form - [('journal_id.type', 'in', ['bank', 'cash']), ('type','=','payment')] + [('journal_id.type', 'in', ['bank', 'cash'])] {'journal_type':'bank', 'type':'payment'} new @@ -154,7 +154,7 @@ Sales Payment account.voucher.open form - [('journal_id.type', 'in', ['bank', 'cash']), ('type','=','receipt')] + [('journal_id.type', 'in', ['bank', 'cash'])] {'journal_type':'bank', 'type':'receipt'} new diff --git a/addons/account_voucher/voucher_report.xml b/addons/account_voucher/voucher_report.xml index 57134d3cdec..273fc53de5f 100644 --- a/addons/account_voucher/voucher_report.xml +++ b/addons/account_voucher/voucher_report.xml @@ -2,21 +2,12 @@ - - - - - - - - - From c8e1404027d27b803cdc5519dabb512efd394be8 Mon Sep 17 00:00:00 2001 From: mtr Date: Thu, 26 Aug 2010 18:08:25 +0530 Subject: [PATCH 07/28] [FIX] account:-manual recurring wizard corrected bzr revid: mtr@mtr-20100826123825-j60o4pqlouwj6vr2 --- addons/account/account_view.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index a95b96aae9b..cc740220524 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -668,7 +668,6 @@ - From 1e8a9a983f604076b1528dfdb484d1ba63fa25bb Mon Sep 17 00:00:00 2001 From: vra Date: Thu, 26 Aug 2010 19:15:15 +0530 Subject: [PATCH 08/28] [IMP] account: assigned collection and paid account to remaining configuration charts taxes, assigned common sequence for sale and purchase, assigned invoice seq for minimum chart demo journals. bzr revid: vra@tinyerp.com-20100826134515-vzqm2ergu3bzkm0v --- addons/account/configurable_account_chart.xml | 8 ++++++++ addons/account/data/account_data2.xml | 6 ++++-- addons/account/demo/account_minimal.xml | 6 ++++-- addons/account/installer.py | 8 ++++---- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/addons/account/configurable_account_chart.xml b/addons/account/configurable_account_chart.xml index de8c1ba0cd0..f9512cd4e83 100644 --- a/addons/account/configurable_account_chart.xml +++ b/addons/account/configurable_account_chart.xml @@ -470,6 +470,8 @@ OTAX X percent + + @@ -482,6 +484,8 @@ OTAX O percent + + @@ -524,6 +528,8 @@ ITAX X percent + + @@ -536,6 +542,8 @@ ITAX O percent + + diff --git a/addons/account/data/account_data2.xml b/addons/account/data/account_data2.xml index af55e477b42..b0f5f82e156 100644 --- a/addons/account/data/account_data2.xml +++ b/addons/account/data/account_data2.xml @@ -461,12 +461,14 @@ Sale Journal account.journal - + + %(year)s/ Purchase Journal account.journal - + + %(year)s/ + + + + diff --git a/addons/account_voucher/wizard/account_voucher_unreconcile.py b/addons/account_voucher/wizard/account_voucher_unreconcile.py index d12bee51894..257d6c96beb 100644 --- a/addons/account_voucher/wizard/account_voucher_unreconcile.py +++ b/addons/account_voucher/wizard/account_voucher_unreconcile.py @@ -47,9 +47,11 @@ class account_voucher_unreconcile(osv.osv_memory): for line in voucher.move_ids: if line.reconcile_id: recs = [line.reconcile_id.id] - - for rec in recs: - reconcile_pool.unlink(cr, uid, rec) + if line.reconcile_partial_id: + recs = [line.reconcile_partial_id.id] + + #for rec in recs: + reconcile_pool.unlink(cr, uid, recs) if res.remove: voucher_pool.cancel_voucher(cr, uid, [context.get('active_id')], context) From ec9f8f6cd2a37911b036b00bc50131200b1a1322 Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Fri, 27 Aug 2010 00:39:33 +0530 Subject: [PATCH 10/28] [FIX]: review all vouchers and fix some usablity problems [IMP]: make working, vendor payment and vendor bills bzr revid: mga@tinyerp.com-20100826190933-23ibu3s07lix6tpr --- addons/account_voucher/voucher.py | 84 ++++++++++++++----- .../voucher_payment_receipt_view.xml | 49 ++++++++--- .../voucher_sales_purchase_view.xml | 2 +- .../wizard/account_voucher_unreconcile.py | 4 +- 4 files changed, 103 insertions(+), 36 deletions(-) diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/voucher.py index 8e1d3491d26..ff8fcc664c1 100644 --- a/addons/account_voucher/voucher.py +++ b/addons/account_voucher/voucher.py @@ -222,8 +222,8 @@ class account_voucher(osv.osv): 'date_due':due_date }) return {'value':default} - - def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id=False, price=0.0, context={}): + + def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id=False, price=0.0, ttype=False, context={}): """price Returns a dict that contains new values and context @@ -273,8 +273,14 @@ class account_voucher(osv.osv): }) if journal.type not in ('cash', 'bank'): return default - - ids = move_line_pool.search(cr, uid, [('account_id.type','in', ('receivable','payable')), ('reconcile_id','=', False), ('partner_id','=',partner_id)], context=context) + + account_type = 'receivable' + if ttype == 'payment': + account_type = 'payable' + else: + account_type = 'receivable' + + ids = move_line_pool.search(cr, uid, [('account_id.type','=', account_type), ('reconcile_id','=', False), ('partner_id','=',partner_id)], context=context) moves = move_line_pool.browse(cr, uid, ids) total_credit = price or 0.0 total_debit = 0.0 @@ -308,7 +314,11 @@ class account_voucher(osv.osv): default['value']['line_cr_ids'].append(rs) else: default['value']['line_dr_ids'].append(rs) + + if ttype == 'payment' and len(default['value']['line_cr_ids']) > 0: default['value']['pre_line'] = 1 + elif ttype == 'receipt' and len(default['value']['line_dr_ids']) > 0: + default['value']['pre_line'] = 1 return default @@ -384,6 +394,14 @@ class account_voucher(osv.osv): } def action_move_line_create(self, cr, uid, ids, *args): + + def _get_payment_term_lines(term_id, amount): + term_pool = self.pool.get('account.payment.term') + if term_id and amount: + terms = term_pool.compute(cr, uid, term_id, amount) + return terms + return False + move_pool = self.pool.get('account.move') move_line_pool = self.pool.get('account.move.line') analytic_pool = self.pool.get('account.analytic.line') @@ -412,7 +430,7 @@ class account_voucher(osv.osv): } move_id = move_pool.create(cr, uid, move) company_currency = inv.account_id.company_id.currency_id.id - + #create the first line manually debit = 0.0 credit = 0.0 @@ -421,20 +439,40 @@ class account_voucher(osv.osv): credit = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.amount) elif inv.type in ('sale', 'receipt'): debit = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.amount) - move_line = { - 'name':inv.name or '/', - 'debit':debit, - 'credit':credit, - 'account_id':inv.account_id.id, - 'move_id':move_id , - 'journal_id':inv.journal_id.id, - 'period_id':inv.period_id.id, - 'partner_id':inv.partner_id.id, - 'currency_id':inv.currency_id.id, - 'date':inv.date - } - - master_line = move_line_pool.create(cr, uid, move_line) + + if inv.type == 'purchase' and inv.term_id and _get_payment_term_lines(inv.term_id.id, credit or debit): + terms = _get_payment_term_lines(inv.term_id.id, credit or debit) + for term in terms: + due_date = term[0] + amount = term[1] + move_line = { + 'name':inv.name or '/', + 'debit':0.0, + 'credit':amount, + 'date_maturity':due_date, + 'account_id':inv.account_id.id, + 'move_id':move_id , + 'journal_id':inv.journal_id.id, + 'period_id':inv.period_id.id, + 'partner_id':inv.partner_id.id, + 'currency_id':inv.currency_id.id, + 'date':inv.date + } + master_line = move_line_pool.create(cr, uid, move_line) + else: + move_line = { + 'name':inv.name or '/', + 'debit':debit, + 'credit':credit, + 'account_id':inv.account_id.id, + 'move_id':move_id , + 'journal_id':inv.journal_id.id, + 'period_id':inv.period_id.id, + 'partner_id':inv.partner_id.id, + 'currency_id':inv.currency_id.id, + 'date':inv.date + } + master_line = move_line_pool.create(cr, uid, move_line) rec_list_ids = [] line_total = debit - credit @@ -581,7 +619,7 @@ class account_voucher_line(osv.osv): return res _columns = { - 'voucher_id':fields.many2one('account.voucher', 'Voucher', required=1), + 'voucher_id':fields.many2one('account.voucher', 'Voucher', required=1, ondelete='cascade'), 'name':fields.char('Description', size=256), 'account_id':fields.many2one('account.account','Account', required=True), 'partner_id':fields.related('voucher_id', 'partner_id', type='many2one', relation='res.partner', string='Partner'), @@ -650,7 +688,11 @@ class account_voucher_line(osv.osv): elif journal.type in ('purchase', 'expense', 'sale_refund'): account_id = journal.default_debit_account_id and journal.default_debit_account_id.id or False elif partner_id: - account_id = partner_pool.browse(cr, user, partner_id, context=context).property_account_receivable.id + partner = partner_pool.browse(cr, user, partner_id, context=context) + if context.get('type') == 'payment': + account_id = partner.property_account_payable.id + elif context.get('type') == 'receipt': + account_id = partner.property_account_receivable.id if (not account_id) and 'account_id' in fields_list: raise osv.except_osv(_('Invalid Error !'), _('Please change partner and try again !')) diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index ecca6f04cf1..ce7f352d251 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -8,24 +8,50 @@
- + + + + - - - + + - + - - - + + + + + + + + + + + + + + + + - + @@ -33,7 +59,6 @@ - @@ -76,7 +101,7 @@ - + - + - + diff --git a/addons/account_voucher/wizard/account_voucher_unreconcile.py b/addons/account_voucher/wizard/account_voucher_unreconcile.py index 257d6c96beb..fdb51bb6b91 100644 --- a/addons/account_voucher/wizard/account_voucher_unreconcile.py +++ b/addons/account_voucher/wizard/account_voucher_unreconcile.py @@ -46,9 +46,9 @@ class account_voucher_unreconcile(osv.osv_memory): recs = [] for line in voucher.move_ids: if line.reconcile_id: - recs = [line.reconcile_id.id] + recs += [line.reconcile_id.id] if line.reconcile_partial_id: - recs = [line.reconcile_partial_id.id] + recs += [line.reconcile_partial_id.id] #for rec in recs: reconcile_pool.unlink(cr, uid, recs) From 1cc6fe6a4678d4c0f229d4bc0579c6459e78d275 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Fri, 27 Aug 2010 09:08:41 +0530 Subject: [PATCH 11/28] [IMP] Account: if statement.name =='/': the first statement created is St. 08/25/ instead of St. 08/25/1? check the sequence if statement name !='/': do not append a sequence (if user typed 'QDP1', do not replace it by 'QDP1/x' where x is a sequence number autoincremented) bzr revid: mra@mra-laptop-20100827033841-owws11we2s62e17m --- addons/account/account_bank_statement.py | 6 +++--- addons/account/data/account_data2.xml | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index c3809b44c04..4d5a322a5e2 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -371,11 +371,11 @@ class account_bank_statement(osv.osv): self.log(cr, uid, st.id, 'Statement %s is confirmed and entries are created.' % st.name) done.append(st.id) - next_number = obj_seq.get(cr, uid, 'account.bank.statement') if not st.name == '/': - next_number = st.name + '/' + next_number[-1:] + next_number = st.name account_move_obj.write(cr, uid, [move_id], {'name': next_number}) - + else: + next_number = obj_seq.get(cr, uid, 'account.bank.statement') account_move_obj.write(cr, uid, [move_id], {'state': 'posted'}) # Bank statements will not consider boolean on journal entry_posted self.write(cr, uid, [st.id], {'name': next_number}, context=context) diff --git a/addons/account/data/account_data2.xml b/addons/account/data/account_data2.xml index b0f5f82e156..980834c0dee 100644 --- a/addons/account/data/account_data2.xml +++ b/addons/account/data/account_data2.xml @@ -247,8 +247,8 @@ state - - + + Sale/Purchase Journal View @@ -346,7 +346,7 @@ reconcile_id - + Sale/Purchase Refund Journal View @@ -444,7 +444,7 @@ reconcile_id - + @@ -495,10 +495,10 @@ Account Bank Statement account.bank.statement St. %(month)s/%(day)s/ - + - + Cash Statement account.cash.statement From 29c473188b87dcbd0dfac3d9061950ba1407776a Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Fri, 27 Aug 2010 10:20:49 +0530 Subject: [PATCH 12/28] [IMP] Account: bank statement name and numbering=> in all cases, the account move objects created (reminder: there is one account move by statement line) must have a name wich is the same as the bank_statement name + ' / ' + the sequence of the statement line bzr revid: mra@mra-laptop-20100827045049-zuge81k8z8awrg0i --- addons/account/account_bank_statement.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 4d5a322a5e2..fb58d382649 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -222,6 +222,11 @@ class account_bank_statement(osv.osv): raise osv.except_osv(_('Configuration Error !'), _('Please verify that an account is defined in the journal.')) + if not st.name == '/': + next_number = st.name + else: + next_number = obj_seq.get(cr, uid, 'account.bank.statement') + for line in st.move_line_ids: if line.state <> 'valid': raise osv.except_osv(_('Error !'), @@ -230,14 +235,14 @@ class account_bank_statement(osv.osv): # In line we get reconcile_id on bank.ste.rec. # in bank stat.rec we get line_new_ids on bank.stat.rec.line for move in st.line_ids: - context.update({'date':move.date}) + context.update({'date': move.date}) move_id = account_move_obj.create(cr, uid, { 'journal_id': st.journal_id.id, 'period_id': st.period_id.id, 'date': move.date, }, context=context) account_bank_statement_line_obj.write(cr, uid, [move.id], { - 'move_ids': [(4,move_id, False)] + 'move_ids': [(4, move_id, False)] }) if not move.amount: continue @@ -367,16 +372,11 @@ class account_bank_statement(osv.osv): account_move_line_obj.reconcile(cr, uid, torec, 'statement', writeoff_acc_id=writeoff_acc_id, writeoff_period_id=st.period_id.id, writeoff_journal_id=st.journal_id.id, context=context) else: account_move_line_obj.reconcile_partial(cr, uid, torec, 'statement', context) + move_name = next_number + '/' + str(move.sequence) + account_move_obj.write(cr, uid, [move_id], {'name': move_name, 'state': 'posted'}) # Bank statements will not consider boolean on journal entry_posted self.log(cr, uid, st.id, 'Statement %s is confirmed and entries are created.' % st.name) done.append(st.id) - - if not st.name == '/': - next_number = st.name - account_move_obj.write(cr, uid, [move_id], {'name': next_number}) - else: - next_number = obj_seq.get(cr, uid, 'account.bank.statement') - account_move_obj.write(cr, uid, [move_id], {'state': 'posted'}) # Bank statements will not consider boolean on journal entry_posted self.write(cr, uid, [st.id], {'name': next_number}, context=context) self.write(cr, uid, done, {'state':'confirm'}, context=context) From 3690da3b9b69145b1f1d4e3fa5506027675c14ee Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Fri, 27 Aug 2010 11:08:46 +0530 Subject: [PATCH 13/28] [FIX] hr_holidays: Fix the problem related to report Leaves by Department bzr revid: psi@tinyerp.co.in-20100827053846-tlffr7s2zrze5rbq --- .../report/holidays_summary_report.py | 28 ++++++++----------- .../wizard/hr_holidays_summary_department.py | 2 +- .../wizard/hr_holidays_summary_employees.py | 2 +- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/addons/hr_holidays/report/holidays_summary_report.py b/addons/hr_holidays/report/holidays_summary_report.py index f3a17be3015..851defe7e73 100644 --- a/addons/hr_holidays/report/holidays_summary_report.py +++ b/addons/hr_holidays/report/holidays_summary_report.py @@ -94,13 +94,13 @@ class report_custom(report_rml): emp_id={} # done={} - cr.execute("select name from res_company") + cr.execute("SELECT name FROM res_company") res=cr.fetchone()[0] date_xml=[] date_today=time.strftime('%Y-%m-%d %H:%M:%S') date_xml +=['' % (res,date_today)] - cr.execute("select id,name,color_name from hr_holidays_status order by id") + cr.execute("SELECT id, name, color_name FROM hr_holidays_status ORDER BY id") legend=cr.fetchall() today=datetime.datetime.today() @@ -221,23 +221,19 @@ class report_custom(report_rml): elif data['model']=='ir.ui.menu': for id in data['form']['depts']: dept = obj_dept.browse(cr, uid, id, context=context) - - cr.execute("""select dept.manager_id from hr_department dept\ - where dept.id = %s""", (id,)) - result=cr.fetchall() - if result==[]: + cr.execute("""SELECT id FROM hr_employee \ + WHERE department_id = %s""", (id,)) + emp_ids = [x[0] for x in cr.fetchall()] + if emp_ids==[]: continue dept_done=0 - for d in range(0,len(result)): - emp_id[d] = obj_emp.search(cr, uid, [('user_id', '=', result[d][0])]) - items = obj_emp.read(cr, uid, emp_id[d], ['id', 'name']) - for item in items: - if dept_done==0: - emp_xml += emp_create_xml(self, cr, uid, 1, holiday_type, row_id, dept.id, dept.name, som, eom) - row_id = row_id +1 - dept_done=1 - emp_xml += emp_create_xml(self, cr, uid, 0, holiday_type, row_id, item['id'], item['name'], som, eom) + for item in obj_emp.read(cr, uid, emp_ids, ['id', 'name']): + if dept_done==0: + emp_xml += emp_create_xml(self, cr, uid, 1, holiday_type, row_id, dept.id, dept.name, som, eom) row_id = row_id +1 + dept_done=1 + emp_xml += emp_create_xml(self, cr, uid, 0, holiday_type, row_id, item['id'], item['name'], som, eom) + row_id = row_id +1 # Computing the xml xml=''' diff --git a/addons/hr_holidays/wizard/hr_holidays_summary_department.py b/addons/hr_holidays/wizard/hr_holidays_summary_department.py index 06651e11d33..9a99d9eff63 100644 --- a/addons/hr_holidays/wizard/hr_holidays_summary_department.py +++ b/addons/hr_holidays/wizard/hr_holidays_summary_department.py @@ -34,7 +34,7 @@ class hr_holidays_summary_dept(osv.osv_memory): } _defaults = { - 'date_from': time.strftime('%Y-%m-%d'), + 'date_from': time.strftime('%Y-%m-01'), 'holiday_type': 'Validated' } diff --git a/addons/hr_holidays/wizard/hr_holidays_summary_employees.py b/addons/hr_holidays/wizard/hr_holidays_summary_employees.py index 379ff7d76c7..0fa58b01581 100644 --- a/addons/hr_holidays/wizard/hr_holidays_summary_employees.py +++ b/addons/hr_holidays/wizard/hr_holidays_summary_employees.py @@ -33,7 +33,7 @@ class hr_holidays_summary_employee(osv.osv_memory): } _defaults = { - 'date_from': time.strftime('%Y-%m-%d'), + 'date_from': time.strftime('%Y-%m-01'), 'holiday_type': 'Validated', } From 0975cb41eceeb13983a032044ea6eb9562e79544 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Fri, 27 Aug 2010 11:47:56 +0530 Subject: [PATCH 14/28] [IMP] Account invoice: the order of invoices (all) is not correct: it should display them by number desc (not asc as currently) bzr revid: mra@mra-laptop-20100827061756-s1ujub9a3ye5nfjc --- addons/account/invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index e7b95cea8dc..4e1a5a052ec 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -219,7 +219,7 @@ class account_invoice(osv.osv): _name = "account.invoice" _description = 'Invoice' - _order = "id" + _order = "id desc" _columns = { 'name': fields.char('Description', size=64, select=True, readonly=True, states={'draft':[('readonly',False)]}), From 018a7b1c802d1308c556704312a3e9ddef7b4d65 Mon Sep 17 00:00:00 2001 From: mtr Date: Fri, 27 Aug 2010 12:06:46 +0530 Subject: [PATCH 15/28] [IMP] account:-In chart of accounts,moved the company_id field after the company currency field bzr revid: mtr@mtr-20100827063646-6le7xhr65l4zmwsd --- 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 cc740220524..32989538ebe 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -242,8 +242,8 @@ - + From 073831ec2abd8329790b3e31044b0faf8832b26e Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Fri, 27 Aug 2010 12:19:02 +0530 Subject: [PATCH 16/28] [REF] Account bzr revid: mra@mra-laptop-20100827064902-3rh7c96hdz3x9231 --- addons/account/wizard/account_chart.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/addons/account/wizard/account_chart.py b/addons/account/wizard/account_chart.py index bace3d0ca29..f7de4b593f3 100644 --- a/addons/account/wizard/account_chart.py +++ b/addons/account/wizard/account_chart.py @@ -18,6 +18,7 @@ # along with this program. If not, see . # ############################################################################## + from osv import fields, osv from tools.translate import _ @@ -26,7 +27,7 @@ class account_chart(osv.osv_memory): For Chart of Accounrs """ _name = "account.chart" - _description = "chart" + _description = "Account chart" _columns = { 'fiscalyear': fields.many2one('account.fiscalyear', \ 'Fiscal year', \ @@ -37,11 +38,9 @@ class account_chart(osv.osv_memory): def _get_fiscalyear(self, cr, uid, context=None): """Return default Fiscalyear value""" - fiscalyear_obj = self.pool.get('account.fiscalyear') - fiscalyear = fiscalyear_obj.find(cr, uid) - return fiscalyear + return self.pool.get('account.fiscalyear').find(cr, uid) - def account_chart_open_window(self, cr, uid, ids, context={}): + def account_chart_open_window(self, cr, uid, ids, context=None): """ Opens chart of Accounts @param cr: the current row, from the database cursor, @@ -51,6 +50,8 @@ class account_chart(osv.osv_memory): """ mod_obj = self.pool.get('ir.model.data') act_obj = self.pool.get('ir.actions.act_window') + if context is None: + context = {} data = self.read(cr, uid, ids, [], context=context)[0] result = mod_obj._get_id(cr, uid, 'account', 'action_account_tree') id = mod_obj.read(cr, uid, [result], ['res_id'], context=context)[0]['res_id'] @@ -65,6 +66,7 @@ class account_chart(osv.osv_memory): 'fiscalyear': _get_fiscalyear, 'target_move': 'all' } + account_chart() -# 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 2831ed76a4c20fc77b57f16b7149aeb585aa6bec Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Fri, 27 Aug 2010 12:54:46 +0530 Subject: [PATCH 17/28] [IMP] account: Add tooltip for currency_id and change the label of account_type on account.bank.accounts.wizard object bzr revid: psi@tinyerp.co.in-20100827072446-k2g61css8civ82ad --- addons/account/installer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/installer.py b/addons/account/installer.py index d82db6de96d..a9872925321 100644 --- a/addons/account/installer.py +++ b/addons/account/installer.py @@ -583,8 +583,8 @@ class account_bank_accounts_wizard(osv.osv_memory): _columns = { 'acc_name': fields.char('Account Name.', size=64, required=True), 'bank_account_id': fields.many2one('wizard.multi.charts.accounts', 'Bank Account', required=True), - 'currency_id': fields.many2one('res.currency', 'Currency'), - 'account_type': fields.selection([('cash','Cash'),('check','Check'),('bank','Bank')], 'Type', size=32), + 'currency_id': fields.many2one('res.currency', 'Secondary Currency', help="Forces all moves for this account to have this secondary currency."), + 'account_type': fields.selection([('cash','Cash'),('check','Check'),('bank','Bank')], 'Account Type', size=32), } _defaults = { 'currency_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.currency_id.id, From 19380a87a08ba829708b150845e8db947ca61347 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Fri, 27 Aug 2010 16:00:13 +0530 Subject: [PATCH 18/28] [IMP] Tax chart by wizard: * the menuitem Accounting \ Chart \ Chart of taxes, have to ask for a period, by default filled with the current period. Then opening the chart of tax using that period in context to have the sum period and sum years completed. It should also ask if we want to include the draft account moves or not * the company_id field should be hidden in that chart, if the user doesn't have the useabilty / multi company group * the chart should display the period sum before the year sum bzr revid: mra@mra-laptop-20100827103013-ppj8y6loadpw8oz4 --- addons/account/__openerp__.py | 1 + addons/account/account.py | 2 +- addons/account/account_view.xml | 8 +- addons/account/wizard/__init__.py | 1 + addons/account/wizard/account_tax_chart.py | 78 +++++++++++++++++++ .../account/wizard/account_tax_chart_view.xml | 45 +++++++++++ 6 files changed, 131 insertions(+), 4 deletions(-) create mode 100644 addons/account/wizard/account_tax_chart.py create mode 100644 addons/account/wizard/account_tax_chart_view.xml diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index 96412077840..6f3675392e0 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -60,6 +60,7 @@ module named account_voucher. 'wizard/account_period_close_view.xml', 'wizard/account_fiscalyear_close_state.xml', 'wizard/account_chart_view.xml', + 'wizard/account_tax_chart_view.xml', 'wizard/account_move_journal_view.xml', 'wizard/account_move_line_reconcile_select_view.xml', 'wizard/account_open_closed_fiscalyear_view.xml', diff --git a/addons/account/account.py b/addons/account/account.py index f0884044fcf..682e9583e33 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -835,7 +835,7 @@ class account_period(osv.osv): 'company_id': fields.related('fiscalyear_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True) } _defaults = { - 'state': lambda *a: 'draft', + 'state': 'draft', } _order = "date_start" diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 32989538ebe..49a251175cd 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -710,9 +710,9 @@ - - + + @@ -857,11 +857,13 @@ Chart of Taxes is a tree view reflecting the structure of the Tax Cases (or tax codes) and shows the current tax situation. The tax chart represents the amount of each area of the tax declaration for your country. It’s presented in a hierarchical structure, which can be modified to fit your needs. + + - + Journal Items account.move.journal form @@ -67,10 +67,10 @@ From 446655fae0c30fa4474b9cff9f0406032f623028 Mon Sep 17 00:00:00 2001 From: "MRA(OpenERP), MTR(OpenERP)" <> Date: Sat, 28 Aug 2010 12:22:50 +0530 Subject: [PATCH 25/28] [IMP] Account: don't display the analytic account in red if there is no date end defined on it but in black => red should only be when there is a date end which is overpassed bzr revid: mra@mra-laptop-20100828065250-00006o4cx4hceiq4 --- addons/account/project/project_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml index fb7e41101f7..bf0b186e1ea 100644 --- a/addons/account/project/project_view.xml +++ b/addons/account/project/project_view.xml @@ -51,7 +51,7 @@ tree child_ids - + From a408fd8234d1e27254be9b5bfdd2483b7ff7f77e Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Sun, 29 Aug 2010 20:31:56 +0530 Subject: [PATCH 26/28] [FIX]: fix small problem of the voucher module bzr revid: mga@tinyerp.com-20100829150156-8lqcmx0nu5hmxyok --- addons/account_voucher/voucher.py | 4 ++-- addons/account_voucher/voucher_sales_purchase_view.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/voucher.py index ff8fcc664c1..4cc44433ff8 100644 --- a/addons/account_voucher/voucher.py +++ b/addons/account_voucher/voucher.py @@ -97,9 +97,9 @@ class account_voucher(osv.osv): 'line_ids':fields.one2many('account.voucher.line','voucher_id','Voucher Lines', readonly=True, states={'draft':[('readonly',False)]}), 'line_cr_ids':fields.one2many('account.voucher.line','voucher_id','Credits', - domain=[('type','=','cr')], context={'default_type':'cr'}), + domain=[('type','=','cr')], context={'default_type':'cr'}, readonly=True, states={'draft':[('readonly',False)]}), 'line_dr_ids':fields.one2many('account.voucher.line','voucher_id','Debits', - domain=[('type','=','dr')], context={'default_type':'dr'}), + domain=[('type','=','dr')], context={'default_type':'dr'}, readonly=True, states={'draft':[('readonly',False)]}), 'period_id': fields.many2one('account.period', 'Period', required=True, readonly=True, states={'draft':[('readonly',False)]}), 'narration':fields.text('Narration', readonly=True, states={'draft':[('readonly',False)]}), 'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}), diff --git a/addons/account_voucher/voucher_sales_purchase_view.xml b/addons/account_voucher/voucher_sales_purchase_view.xml index 387dd28f77a..f84566255d0 100644 --- a/addons/account_voucher/voucher_sales_purchase_view.xml +++ b/addons/account_voucher/voucher_sales_purchase_view.xml @@ -17,7 +17,7 @@ - + From 7bf48185c84d61d6812f68d79ec57ed3b333611f Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Sun, 29 Aug 2010 20:37:18 +0530 Subject: [PATCH 27/28] [FIX]: fix a voucher problem bzr revid: mga@tinyerp.com-20100829150718-c25aomij4mxlxc08 --- addons/account_voucher/voucher_sales_purchase_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_voucher/voucher_sales_purchase_view.xml b/addons/account_voucher/voucher_sales_purchase_view.xml index f84566255d0..523f72e9f30 100644 --- a/addons/account_voucher/voucher_sales_purchase_view.xml +++ b/addons/account_voucher/voucher_sales_purchase_view.xml @@ -43,7 +43,7 @@ - + From 23ed9c4b4ee2e11a26b9476d553534f14473908b Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Sun, 29 Aug 2010 20:56:24 +0530 Subject: [PATCH 28/28] [FIX]: fix small problem during testing bzr revid: mga@tinyerp.com-20100829152624-oh0jt2v14b2hhgfm --- addons/account_voucher/voucher_payment_receipt_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index ce7f352d251..85e39b4134e 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -56,9 +56,9 @@ - +