From abe9469e889c2698234ecbb4aeecc1058b9cf66b Mon Sep 17 00:00:00 2001 From: pso Date: Fri, 19 Nov 2010 15:17:58 +0530 Subject: [PATCH 01/94] [IMP] account: Improved partner and general ledger reports for account currency bzr revid: pso@tinyerp.com-20101119094758-n54crq4lq41he265 --- .../account/report/account_general_ledger.py | 8 +++-- .../account_general_ledger_landscape.rml | 2 +- .../account/report/account_partner_ledger.py | 33 +++++++++++++------ .../report/account_partner_ledger_other.rml | 7 ++-- 4 files changed, 33 insertions(+), 17 deletions(-) diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py index 6ccfb9343a2..a1e6aca6433 100644 --- a/addons/account/report/account_general_ledger.py +++ b/addons/account/report/account_general_ledger.py @@ -191,17 +191,19 @@ class general_ledger(report_sxw.rml_parse, common_report_header): sql = """ SELECT 0 AS lid, '' AS ldate, '' AS lcode, COALESCE(SUM(l.amount_currency),0.0) AS amount_currency, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, '' AS lperiod_id, '' AS lpartner_id, '' AS move_name, '' AS mmove_id, - '' AS currency_code, - NULL AS currency_id, + c.symbol AS currency_code, + '' AS currency_id, '' AS invoice_id, '' AS invoice_type, '' AS invoice_number, '' AS partner_name FROM account_move_line l LEFT JOIN account_move m on (l.move_id=m.id) + LEFT JOIN account_account ac on (l.account_id=ac.id) LEFT JOIN res_currency c on (l.currency_id=c.id) LEFT JOIN res_partner p on (l.partner_id=p.id) LEFT JOIN account_invoice i on (m.id =i.move_id) JOIN account_journal j on (l.journal_id=j.id) - WHERE %s AND m.state IN %s AND l.account_id = %%s + WHERE %s AND m.state IN %s AND l.account_id = %%s + group by c.symbol """ %(self.init_query, tuple(move_state)) self.cr.execute(sql, (account.id,)) res_init = self.cr.dictfetchall() diff --git a/addons/account/report/account_general_ledger_landscape.rml b/addons/account/report/account_general_ledger_landscape.rml index 430bde219e1..02e720f016e 100644 --- a/addons/account/report/account_general_ledger_landscape.rml +++ b/addons/account/report/account_general_ledger_landscape.rml @@ -327,7 +327,7 @@ [[ formatLang(line['debit'], digits=get_digits(dp='Account')) ]] [[ formatLang(line['credit'], digits=get_digits(dp='Account')) ]] [[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] - [[ (line.has_key('currency_id') and line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'])]] [[ line['currency_code'] or '']] + [[ (o.currency_id and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[ line['currency_code'] or '']] diff --git a/addons/account/report/account_partner_ledger.py b/addons/account/report/account_partner_ledger.py index e66c3a9d523..8db8189ac9c 100644 --- a/addons/account/report/account_partner_ledger.py +++ b/addons/account/report/account_partner_ledger.py @@ -50,6 +50,7 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header): 'display_initial_balance':self._display_initial_balance, 'display_currency':self._display_currency, 'get_target_move': self._get_target_move, + 'sum_currency_amount_account': self._sum_currency_amount_account }) def set_context(self, objects, data, ids, report_type=None): @@ -178,7 +179,8 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header): " " + RECONCILE_TAG + " "\ "AND " + self.init_query + " ", (partner.id, tuple(move_state), tuple(self.account_ids))) - return self.cr.fetchall() + res = self.cr.fetchall() + return res def _sum_debit_partner(self, partner): move_state = ['draft','posted'] @@ -385,16 +387,27 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header): return 'Receivable and Payable Accounts' return '' - def _sum_currency_amount_account(self, account, form): - self._set_get_account_currency_code(account.id) - self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %s ", (account.id,)) +# def _set_get_account_currency_code(self, account_id): +# self.cr.execute("SELECT c.symbol AS code "\ +# "FROM res_currency c, account_account AS ac "\ +# "WHERE ac.id = %s AND ac.currency_id = c.id" % (account_id)) +# result = self.cr.fetchone() +# if result: +# self.account_currency = result[0] +# else: +# self.account_currency = False + + def _sum_currency_amount_account(self, account): +# self._set_get_account_currency_code(account.id) + self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %s" %(account.id)) total = self.cr.fetchone() - if self.account_currency: - return_field = str(total[0]) + self.account_currency - return return_field - else: - currency_total = self.tot_currency = 0.0 - return currency_total + return total[0] or 0.0 +# if self.amount_currency: +# return_field = total[0] + self.amount_currency +# return return_field +# else: +# currency_total = self.tot_currency = 0.0 +# return currency_total def _display_initial_balance(self, data): if self.initial_balance: diff --git a/addons/account/report/account_partner_ledger_other.rml b/addons/account/report/account_partner_ledger_other.rml index c3315dde64d..36aadc9e0dc 100644 --- a/addons/account/report/account_partner_ledger_other.rml +++ b/addons/account/report/account_partner_ledger_other.rml @@ -327,7 +327,8 @@ - + + @@ -656,7 +657,7 @@ [[ formatLang(get_intial_balance(p)[0][2]) ]] [[ company.currency_id.symbol ]] - + [[ p.property_account_receivable.currency_id and formatLang(sum_currency_amount_account(p.property_account_receivable), digits=get_digits(dp='Account')) + p.property_account_receivable.currency_id.symbol or '' ]] @@ -689,7 +690,7 @@ [[ formatLang((line['progress'])) ]] [[ company.currency_id.symbol ]] - [[ (line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'] ) ]] [[ line['currency_code'] or '' ]] + [[ (p.property_account_receivable.currency_id and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[ line['currency_code'] or '']] From 216fe9522dbe0fa73c5778b4a81bf4da0215ab62 Mon Sep 17 00:00:00 2001 From: pso Date: Fri, 19 Nov 2010 15:31:19 +0530 Subject: [PATCH 02/94] [IMP] account: removed unnecessary var bzr revid: pso@tinyerp.com-20101119100119-1fs913166qqc1dvm --- addons/account/report/account_partner_ledger.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/account/report/account_partner_ledger.py b/addons/account/report/account_partner_ledger.py index 8db8189ac9c..415597e3201 100644 --- a/addons/account/report/account_partner_ledger.py +++ b/addons/account/report/account_partner_ledger.py @@ -179,8 +179,7 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header): " " + RECONCILE_TAG + " "\ "AND " + self.init_query + " ", (partner.id, tuple(move_state), tuple(self.account_ids))) - res = self.cr.fetchall() - return res + return self.cr.fetchall() def _sum_debit_partner(self, partner): move_state = ['draft','posted'] From 4482eeec0565301ada78bef83b2ef7ab341fc7d8 Mon Sep 17 00:00:00 2001 From: pso Date: Fri, 19 Nov 2010 17:36:16 +0530 Subject: [PATCH 03/94] [IMP] account: Improved general ledger report bzr revid: pso@tinyerp.com-20101119120616-tbtwepubi2224ny8 --- addons/account/report/account_general_ledger.rml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/report/account_general_ledger.rml b/addons/account/report/account_general_ledger.rml index 2a3bfda8e48..feeaa1fa18c 100644 --- a/addons/account/report/account_general_ledger.rml +++ b/addons/account/report/account_general_ledger.rml @@ -340,7 +340,7 @@ [[formatLang(sum_debit_account(o)) ]] [[formatLang(sum_credit_account(o)) ]] [[formatLang(sum_balance_account(o)) ]] [[ company.currency_id.symbol ]] - [[ o.currency_id and sum_currency_amount_account(o) +o.currency_id.symbol or '' ]] + [[ (o.currency_id and formatLang(sum_currency_amount_account(o))) or removeParentNode('font') ]] [[ o.currency_id.symbol or '']] From 971d02737ad087fd0c62d379f03c89bb5b543cf3 Mon Sep 17 00:00:00 2001 From: pso Date: Fri, 19 Nov 2010 18:58:58 +0530 Subject: [PATCH 04/94] [IMP] account: Improved general ledger report bzr revid: pso@tinyerp.com-20101119132858-58rfm2hxtd1xha52 --- addons/account/report/account_general_ledger_landscape.rml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/report/account_general_ledger_landscape.rml b/addons/account/report/account_general_ledger_landscape.rml index 02e720f016e..e91bedb4a5d 100644 --- a/addons/account/report/account_general_ledger_landscape.rml +++ b/addons/account/report/account_general_ledger_landscape.rml @@ -301,7 +301,7 @@ [[ formatLang(sum_debit_account(o), digits=get_digits(dp='Account')) ]] [[ formatLang(sum_credit_account(o), digits=get_digits(dp='Account')) ]] [[ formatLang(sum_balance_account(o), digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] - [[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.code or '' ]] + [[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.symbol or '' ]] From 6b0d611eb15d8afda66c92648e95fac60d359c19 Mon Sep 17 00:00:00 2001 From: pso Date: Tue, 23 Nov 2010 12:49:48 +0530 Subject: [PATCH 05/94] [IMP] account: Improved general and partner ledger reports for currency bzr revid: pso@tinyerp.com-20101123071948-v6c42bqfn0wvcj7x --- .../account/report/account_general_ledger.py | 29 ++++++++++++++----- .../account/report/account_general_ledger.rml | 4 +-- .../account_general_ledger_landscape.rml | 3 +- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py index a1e6aca6433..4052fa650f9 100644 --- a/addons/account/report/account_general_ledger.py +++ b/addons/account/report/account_general_ledger.py @@ -170,13 +170,20 @@ class general_ledger(report_sxw.rml_parse, common_report_header): else: sql_sort='l.date' sql = """ - SELECT l.id AS lid, l.date AS ldate, j.code AS lcode, l.currency_id,l.amount_currency,l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, l.period_id AS lperiod_id, l.partner_id AS lpartner_id, + SELECT l.id AS lid, l.date AS ldate, j.code AS lcode, l.currency_id, + case when a.currency_id is not null then + l.amount_currency + else + 0.0 + end as amount_currency, + l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, l.period_id AS lperiod_id, l.partner_id AS lpartner_id, m.name AS move_name, m.id AS mmove_id, c.symbol AS currency_code, i.id AS invoice_id, i.type AS invoice_type, i.number AS invoice_number, p.name AS partner_name FROM account_move_line l JOIN account_move m on (l.move_id=m.id) + LEFT JOIN account_account a ON (l.account_id=a.id) LEFT JOIN res_currency c on (l.currency_id=c.id) LEFT JOIN res_partner p on (l.partner_id=p.id) LEFT JOIN account_invoice i on (m.id =i.move_id) @@ -189,25 +196,31 @@ class general_ledger(report_sxw.rml_parse, common_report_header): if res_lines and self.init_balance: #FIXME: replace the label of lname with a string translatable sql = """ - SELECT 0 AS lid, '' AS ldate, '' AS lcode, COALESCE(SUM(l.amount_currency),0.0) AS amount_currency, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, '' AS lperiod_id, '' AS lpartner_id, - '' AS move_name, '' AS mmove_id, + SELECT 0 AS lid, '' AS ldate, '' AS lcode, + sum(case when a.currency_id is not null then + l.amount_currency + else + 0.0 + end) as amount_currency, + '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, '' AS lperiod_id, '' AS lpartner_id, + '' AS move_name, '' AS mmove_id, c.symbol AS currency_code, - '' AS currency_id, + l.currency_id AS currency_id, '' AS invoice_id, '' AS invoice_type, '' AS invoice_number, '' AS partner_name FROM account_move_line l LEFT JOIN account_move m on (l.move_id=m.id) - LEFT JOIN account_account ac on (l.account_id=ac.id) + LEFT JOIN account_account a ON (l.account_id=a.id) LEFT JOIN res_currency c on (l.currency_id=c.id) LEFT JOIN res_partner p on (l.partner_id=p.id) LEFT JOIN account_invoice i on (m.id =i.move_id) JOIN account_journal j on (l.journal_id=j.id) WHERE %s AND m.state IN %s AND l.account_id = %%s - group by c.symbol + group by c.symbol , l.currency_id """ %(self.init_query, tuple(move_state)) self.cr.execute(sql, (account.id,)) res_init = self.cr.dictfetchall() - res = res_init + res_lines + res = res_init + res_lines account_sum = 0.0 inv_types = { 'out_invoice': 'CI', 'in_invoice': 'SI', 'out_refund': 'OR', 'in_refund': 'SR', } for l in res: @@ -224,6 +237,8 @@ class general_ledger(report_sxw.rml_parse, common_report_header): l['amount_currency'] = abs(l['amount_currency']) * -1 if l['amount_currency'] != None: self.tot_currency = self.tot_currency + l['amount_currency'] + self.cr.execute("select distinct currency_id from account_invoice") + l['cur_id']=self.cr.fetchall() return res def _sum_debit_account(self, account): diff --git a/addons/account/report/account_general_ledger.rml b/addons/account/report/account_general_ledger.rml index feeaa1fa18c..d91b9bbca5c 100644 --- a/addons/account/report/account_general_ledger.rml +++ b/addons/account/report/account_general_ledger.rml @@ -340,7 +340,7 @@ [[formatLang(sum_debit_account(o)) ]] [[formatLang(sum_credit_account(o)) ]] [[formatLang(sum_balance_account(o)) ]] [[ company.currency_id.symbol ]] - [[ (o.currency_id and formatLang(sum_currency_amount_account(o))) or removeParentNode('font') ]] [[ o.currency_id.symbol or '']] + [[ o.currency_id and sum_currency_amount_account(o) +o.currency_id.symbol or '' ]] @@ -362,7 +362,7 @@ [[ formatLang(line['debit']) ]] [[ formatLang(line['credit']) ]] [[ formatLang(line['progress']) ]] [[ company.currency_id.symbol ]] - [[ (line.has_key('currency_id') and line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'])]] [[ line['currency_code'] or '']] + [[ (len(line['cur_id'])==1 and o.currency_id.id==line['currency_id'] and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[ line['currency_code'] or '']] diff --git a/addons/account/report/account_general_ledger_landscape.rml b/addons/account/report/account_general_ledger_landscape.rml index e91bedb4a5d..6c6da958deb 100644 --- a/addons/account/report/account_general_ledger_landscape.rml +++ b/addons/account/report/account_general_ledger_landscape.rml @@ -327,7 +327,8 @@ [[ formatLang(line['debit'], digits=get_digits(dp='Account')) ]] [[ formatLang(line['credit'], digits=get_digits(dp='Account')) ]] [[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] - [[ (o.currency_id and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[ line['currency_code'] or '']] + + [[ (len(line['cur_id'])==1 and o.currency_id.id==line['currency_id'] and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[ line['currency_code'] or '']] From 11d9e19f3c172034f381dbd85dc47bddc5ca5c59 Mon Sep 17 00:00:00 2001 From: pso Date: Wed, 24 Nov 2010 14:00:29 +0530 Subject: [PATCH 06/94] [IMP] account: Improved partner ledger report for currency bzr revid: pso@tinyerp.com-20101124083029-kn69p6roavd6786c --- addons/account/report/account_partner_ledger.py | 5 +++++ addons/account/report/account_partner_ledger_other.rml | 8 +++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/addons/account/report/account_partner_ledger.py b/addons/account/report/account_partner_ledger.py index 01b46ae70bc..9958058bf7c 100644 --- a/addons/account/report/account_partner_ledger.py +++ b/addons/account/report/account_partner_ledger.py @@ -51,6 +51,7 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header): 'display_initial_balance':self._display_initial_balance, 'display_currency':self._display_currency, 'get_target_move': self._get_target_move, + 'get_currency': self._get_currency, 'sum_currency_amount_account': self._sum_currency_amount_account }) @@ -162,6 +163,10 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header): full_account.append(r) return full_account + def _get_currency(self): + self.cr.execute("select distinct currency_id from account_invoice") + return self.cr.fetchall() + def _get_intial_balance(self, partner): move_state = ['draft','posted'] if self.target_move == 'posted': diff --git a/addons/account/report/account_partner_ledger_other.rml b/addons/account/report/account_partner_ledger_other.rml index 36aadc9e0dc..be217dd3312 100644 --- a/addons/account/report/account_partner_ledger_other.rml +++ b/addons/account/report/account_partner_ledger_other.rml @@ -638,9 +638,7 @@ [[ formatLang((sum_debit_partner(p) - sum_credit_partner(p))) ]] [[ company.currency_id.symbol ]] - - - + [[ p.property_account_receivable.currency_id and formatLang(sum_currency_amount_account(p.property_account_receivable), digits=get_digits(dp='Account')) + p.property_account_receivable.currency_id.symbol or '' ]] @@ -657,7 +655,7 @@ [[ formatLang(get_intial_balance(p)[0][2]) ]] [[ company.currency_id.symbol ]] - [[ p.property_account_receivable.currency_id and formatLang(sum_currency_amount_account(p.property_account_receivable), digits=get_digits(dp='Account')) + p.property_account_receivable.currency_id.symbol or '' ]] + [[ len(get_currency())==1 and p.property_account_receivable.currency_id and formatLang(sum_currency_amount_account(p.property_account_receivable), digits=get_digits(dp='Account')) + p.property_account_receivable.currency_id.symbol or '' ]] @@ -690,7 +688,7 @@ [[ formatLang((line['progress'])) ]] [[ company.currency_id.symbol ]] - [[ (p.property_account_receivable.currency_id and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[ line['currency_code'] or '']] + [[ (len(get_currency())==1 and p.property_account_receivable.currency_id and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[ line['currency_code'] or '']] From 6fe87d7ea4f860425b7134018d1eba52ba789fe7 Mon Sep 17 00:00:00 2001 From: mtr Date: Thu, 25 Nov 2010 15:33:55 +0530 Subject: [PATCH 07/94] [FIX] sale:'Recreate procurement' on shipping exception now works for multiple sale order line bzr revid: mtr@mtr-20101125100355-0a1b7m792t63mssv --- addons/sale/sale.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 29826e1c293..c4e0e9200a3 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 = [] @@ -722,6 +724,7 @@ class sale_order(osv.osv): 'note': line.notes, 'company_id': order.company_id.id, }) + if line.product_id: proc_id = self.pool.get('procurement.order').create(cr, uid, { 'name': line.name, @@ -742,6 +745,16 @@ 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 order.state == 'shipping_except': + for pick in order.picking_ids: + for move in pick.move_lines: + if move.state == 'cancel': + mov_ids = move_obj.search(cr, uid, [('state', '=', 'cancel'),('sale_line_id', '=', line.id),('picking_id', '=', pick.id)]) + if mov_ids: + for mov in move_obj.browse(cr, uid, mov_ids): + move_obj.write(cr, uid, [move_id], {'product_qty': mov.product_qty, 'product_uos_qty': mov.product_uos_qty}) + proc_obj.write(cr, uid, [proc_id], {'product_qty': mov.product_qty, 'product_uos_qty': mov.product_uos_qty}) val = {} for proc_id in proc_ids: @@ -749,9 +762,10 @@ class sale_order(osv.osv): if picking_id: wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr) - + if order.state == 'shipping_except': val['state'] = 'progress' + val['shipped'] = False if (order.order_policy == 'manual'): for line in order.order_line: From d227e1455357f0b69714d10608d4a65fa62a3fac Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Sat, 27 Nov 2010 04:29:54 +0100 Subject: [PATCH 08/94] [FIX] account_followup: fixed syntax after server fix bzr revid: odo@openerp.com-20101127032954-f8ufmpywkdrkuk9o --- addons/account_followup/account_followup_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account_followup/account_followup_view.xml b/addons/account_followup/account_followup_view.xml index e246e3659e1..326264ffdcd 100644 --- a/addons/account_followup/account_followup_view.xml +++ b/addons/account_followup/account_followup_view.xml @@ -144,7 +144,7 @@ name="Receivable Items" res_model="account.move.line" src_model="" - view="account_move_line_partner_tree"/> + view_id="account_move_line_partner_tree"/> @@ -154,7 +154,7 @@ name="Payable Items" res_model="account.move.line" src_model="" - view="account_move_line_partner_tree"/> + view_id="account_move_line_partner_tree"/> From bc9bab7db406b0ed3c1b6fabf13c33c7b3929ccf Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Thu, 2 Dec 2010 18:32:17 +0530 Subject: [PATCH 09/94] [IMP] account_voucher: misc changes and moveline with same amount with higer priority bzr revid: psi@tinyerp.co.in-20101202130217-siz1ozkcq5har3mv --- addons/account/account_invoice_view.xml | 2 +- addons/account_voucher/account_voucher.py | 17 +++++-- .../account_voucher_report.xml | 4 +- .../report/account_voucher_print.rml | 51 ------------------- .../voucher_payment_receipt_view.xml | 2 +- 5 files changed, 18 insertions(+), 58 deletions(-) diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index e5427a93361..9d10107c5c9 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -497,7 +497,7 @@ [('type','=','in_refund')] {'type':'in_refund', 'journal_type': 'purchase_refund'} - A vendor refund is a credit note from your supplier indicating that he refunds part or totality of the invoice sent to you. + A supplier refund is a credit note from your supplier indicating that he refunds part or totality of the invoice sent to you. diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index f902810ac31..9d06d181ef2 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -418,6 +418,18 @@ class account_voucher(osv.osv): ids.reverse() moves = move_line_pool.browse(cr, uid, ids) + priority_moves = [] + for line in moves: + original_amount = line.credit or line.debit or 0.0 + if original_amount == price: + priority_moves.append(line) + + if priority_moves: + for line in moves: + if line not in priority_moves: + priority_moves.append(line) + moves = priority_moves + company_currency = journal.company_id.currency_id.id if company_currency != currency_id and ttype == 'payment': total_debit = currency_pool.compute(cr, uid, currency_id, company_currency, total_debit) @@ -438,13 +450,13 @@ class account_voucher(osv.osv): if line.debit and line.reconcile_partial_id and ttype == 'payment': continue - orignal_amount = line.credit or line.debit or 0.0 + original_amount = line.credit or line.debit or 0.0 rs = { 'name':line.move_id.name, 'type': line.credit and 'dr' or 'cr', 'move_line_id':line.id, 'account_id':line.account_id.id, - 'amount_original':currency_pool.compute(cr, uid, company_currency, currency_id, orignal_amount), + 'amount_original':currency_pool.compute(cr, uid, company_currency, currency_id, original_amount), 'date_original':line.date, 'date_due':line.date_maturity, 'amount_unreconciled':currency_pool.compute(cr, uid, company_currency, currency_id, line.amount_unreconciled) @@ -468,7 +480,6 @@ class account_voucher(osv.osv): default['value']['pre_line'] = 1 elif ttype == 'receipt' and len(default['value']['line_dr_ids']) > 0: default['value']['pre_line'] = 1 - return default def onchange_date(self, cr, user, ids, date, context={}): diff --git a/addons/account_voucher/account_voucher_report.xml b/addons/account_voucher/account_voucher_report.xml index 785fd91df73..8af204efbbe 100644 --- a/addons/account_voucher/account_voucher_report.xml +++ b/addons/account_voucher/account_voucher_report.xml @@ -1,7 +1,7 @@ - + menu="True"/> --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Receiver's Signature - - - - - - - - - - - - - Authorised Signatory - - - - - - diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index 83b6243a627..0ed2bac22a5 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -224,7 +224,7 @@ - Vendor Payment + Supplier Payment account.voucher form [('journal_id.type', 'in', ['bank', 'cash']), ('type','=','payment')] From eef825be08f2e121708d557ea289890ea641ccf4 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Sat, 4 Dec 2010 10:54:20 +0530 Subject: [PATCH 10/94] [REF] Account: add domain on bank statement wizard, add constraint on the statement line,improve the configuration wizard of chart of account bzr revid: ara@tinyerp.com-20101204052420-o6zj7apc4rqv1gfy --- addons/account/account_bank_statement.py | 24 +++++++++++++------ addons/account/account_view.xml | 2 +- addons/account_voucher/account_voucher.py | 14 +++++++++-- .../account_statement_from_invoice_view.xml | 2 +- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 173f0651a90..b1c85c5cf45 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -297,14 +297,24 @@ class account_bank_statement(osv.osv): def get_next_st_line_number(self, cr, uid, st_number, st_line, context=None): return st_number + '/' + str(st_line.sequence) - def balance_check(self, cr, uid, st_id, journal_type='bank', context=None): - st = self.browse(cr, uid, st_id, context) - if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001): - raise osv.except_osv(_('Error !'), - _('The statement balance is incorrect !\n') + - _('The expected balance (%.2f) is different than the computed one. (%.2f)') % (st.balance_end_real, st.balance_end)) +# def balance_check(self, cr, uid, st_id, journal_type='bank', context=None): +# st = self.browse(cr, uid, st_id, context) +# if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001): +# raise osv.except_osv(_('Error !'), +# _('The statement balance is incorrect !\n') + +# _('The expected balance (%.2f) is different than the computed one. (%.2f)') % (st.balance_end_real, st.balance_end)) +# return True + + def _balance_check(self, cr, uid, ids, context=None): + for st in self.browse(cr, uid, ids): + if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001): + return False return True + _constraints = [ + (_balance_check, 'The statement balance is incorrect !\n The expected balance is different than the computed one.', ['balance_end','balance_end_real']), + ] + def statement_close(self, cr, uid, ids, journal_type='bank', context=None): return self.write(cr, uid, ids, {'state':'confirm'}, context=context) @@ -323,7 +333,7 @@ class account_bank_statement(osv.osv): if not self.check_status_condition(cr, uid, st.state, journal_type=j_type): continue - self.balance_check(cr, uid, st.id, journal_type=j_type, context=context) +# self.balance_check(cr, uid, st.id, journal_type=j_type, context=context) if (not st.journal_id.default_credit_account_id) \ or (not st.journal_id.default_debit_account_id): raise osv.except_osv(_('Configuration Error !'), diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index c4a1d447ad9..398755486ae 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -2436,7 +2436,7 @@ - + diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 03ac3b87ba0..3fcccb82c5d 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -826,7 +826,6 @@ class account_voucher_line(osv.osv): _defaults = { 'name': '' } - def onchange_move_line_id(self, cr, user, ids, move_line_id, context={}): """ Returns a dict that contains new values and context @@ -949,6 +948,17 @@ class account_bank_statement_line(osv.osv): res[line.id] = 0.0 return res + def _check_amount(self, cr, uid, ids, context=None): + obj = self.browse(cr, uid, ids[0]) + if obj.voucher_id: + if not (obj.amount == obj.voucher_id.amount): + return False + return True + + _constraints = [ + (_check_amount, 'The amount of the voucher must be the same amount as the one on the statement line', ['statement_id']), + ] + _columns = { 'amount_reconciled': fields.function(_amount_reconciled, string='Amount reconciled', method=True, type='float'), @@ -968,4 +978,4 @@ class account_bank_statement_line(osv.osv): account_bank_statement_line() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account_voucher/wizard/account_statement_from_invoice_view.xml b/addons/account_voucher/wizard/account_statement_from_invoice_view.xml index 1da95285c24..1c0c00bd662 100644 --- a/addons/account_voucher/wizard/account_statement_from_invoice_view.xml +++ b/addons/account_voucher/wizard/account_statement_from_invoice_view.xml @@ -38,7 +38,7 @@
- +