Merge lp:~openerp-dev/openobject-addons/trunk-account-voucher-fix-808751-mra into lp:~openerp/openobject-addons/trunk-account-voucher-rework-qdp

Proposed by Mustufa Rangwala (Open ERP)
Status: Merged
Merged at revision: 4894
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-account-voucher-fix-808751-mra
Merge into: lp:~openerp/openobject-addons/trunk-account-voucher-rework-qdp
Diff against target: 126 lines (+16/-16)
2 files modified
account_voucher/account_voucher.py (+15/-15)
account_voucher/wizard/account_statement_from_invoice.py (+1/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-account-voucher-fix-808751-mra
Reviewer Review Type Date Requested Status
qdp (OpenERP) Pending
Review via email: mp+68642@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

Merge proposal fixes two problems.

1. https://bugs.launchpad.net/openobject-addons/+bug/808751
2. importing invoice through bank statement broken

Thanks,
mra

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_voucher/account_voucher.py'
2--- account_voucher/account_voucher.py 2011-07-15 14:41:26 +0000
3+++ account_voucher/account_voucher.py 2011-07-21 09:09:29 +0000
4@@ -152,11 +152,11 @@
5 for l in line_dr_ids:
6 real_amount -= l.get('amount_in_company_currency', 0.0)
7 counter_for_writeoff -= currency_pool.compute(cr, uid, l['company_currency_id'], l['voucher_currency_id'], l.get('amount_in_company_currency',0.0), context=ctx)
8- counter_for_currency_diff -= currency_pool.compute(cr, uid, l['currency_id'], l['company_currency_id'], l['amount'], context=ctx)
9+ counter_for_currency_diff -= currency_pool.compute(cr, uid, l['currency_id'], l['company_currency_id'], l['amount'], context=ctx)
10 for l in line_cr_ids:
11 real_amount += l.get('amount_in_company_currency', 0.0)
12 counter_for_writeoff += currency_pool.compute(cr, uid, l['company_currency_id'], l['voucher_currency_id'], l.get('amount_in_company_currency',0.0), context=ctx)
13- counter_for_currency_diff += currency_pool.compute(cr, uid, l['currency_id'], l['company_currency_id'], l['amount'], context=ctx)
14+ counter_for_currency_diff += currency_pool.compute(cr, uid, l['currency_id'], l['company_currency_id'], l['amount'], context=ctx)
15 writeoff_amount = amount - counter_for_writeoff
16 currency_rate_difference = real_amount - counter_for_currency_diff
17 return writeoff_amount, currency_rate_difference
18@@ -167,7 +167,7 @@
19 line_osv = self.pool.get("account.voucher.line")
20 line_dr_ids = resolve_o2m_operations(cr, uid, line_osv, line_dr_ids, ['amount'], context)
21 line_cr_ids = resolve_o2m_operations(cr, uid, line_osv, line_cr_ids, ['amount'], context)
22- writeoff_amount, currency_rate_diff = self._compute_writeoff_amount(cr, uid, line_dr_ids, line_cr_ids, amount, voucher_date, context=context)
23+ writeoff_amount, currency_rate_diff = self._compute_writeoff_amount(cr, uid, line_dr_ids, line_cr_ids, amount, voucher_date, context=context)
24 return {'value': {'writeoff_amount': writeoff_amount,}}# 'currency_rate_difference': currency_rate_diff}}
25
26 def _get_writeoff_amount(self, cr, uid, ids, name, args, context=None):
27@@ -185,15 +185,15 @@
28 counter_for_writeoff -= (l.voucher_currency_id.id == l.company_currency_id.id) and l.amount_in_company_currency or l.amount_in_voucher_currency
29 #ctx.update({'date': l.date_original})
30 #counter_for_writeoff -= currency_pool.compute(cr, uid, voucher.company_id.currency_id.id, voucher.currency_id.id, l.amount_in_company_currency, context=ctx)
31- counter_for_currency_diff -= currency_pool.compute(cr, uid, l.currency_id.id, voucher.company_id.currency_id.id, l.amount, context=ctx)
32+ counter_for_currency_diff -= currency_pool.compute(cr, uid, l.currency_id.id, voucher.company_id.currency_id.id, l.amount, context=ctx)
33 for l in voucher.line_cr_ids:
34 real_amount += l.amount_in_company_currency
35 counter_for_writeoff += (l.voucher_currency_id.id == l.company_currency_id.id) and l.amount_in_company_currency or l.amount_in_voucher_currency
36 #ctx.update({'date': l.date_original})
37 #counter_for_writeoff += currency_pool.compute(cr, uid, voucher.company_id.currency_id.id, voucher.currency_id.id, l.amount_in_company_currency, context=ctx)
38- counter_for_currency_diff += currency_pool.compute(cr, uid, l.currency_id.id, voucher.company_id.currency_id.id, l.amount, context=ctx)
39+ counter_for_currency_diff += currency_pool.compute(cr, uid, l.currency_id.id, voucher.company_id.currency_id.id, l.amount, context=ctx)
40 writeoff_amount = voucher.amount - counter_for_writeoff
41- res[voucher.id]['writeoff_amount'] = writeoff_amount
42+ res[voucher.id]['writeoff_amount'] = writeoff_amount
43 res[voucher.id]['currency_rate_difference'] = real_amount - counter_for_currency_diff
44 return res
45
46@@ -545,9 +545,9 @@
47 'move_line_id':line.id,
48 'account_id':line.account_id.id,
49 'amount_original': amount_original,
50- 'amount': (move_line_found == line.id) and min(price, amount_unreconciled) or 0.0,
51+ 'amount': (move_line_found == line.id) and min(price, amount_unreconciled) or 0.0,
52 'currency_id': currency_id,
53- 'voucher_currency_id': voucher_currency_id,
54+ 'voucher_currency_id': voucher_currency_id,
55 'date_original':line.date,
56 'company_currency_id': line.company_id.currency_id.id,
57 'date_due':line.date_maturity,
58@@ -766,7 +766,7 @@
59 account_id = voucher.company_id.property_income_currency_exchange
60 if not account_id:
61 raise osv.except_osv(_('Warning'),_("Unable to create accounting entry for currency rate difference. You have to configure the field 'Expense Currency Rate' on the company! "))
62-
63+
64 currency_diff_line = {
65 'name': _('Currency Difference'),
66 'debit': voucher.currency_rate_difference > 0 and voucher.currency_rate_difference or 0.0,
67@@ -833,7 +833,7 @@
68
69 if not currency_pool.is_zero(cr, uid, voucher.currency_id, voucher.writeoff_amount):
70 #create one line for the write off if needed
71- diff = currency_pool.compute(cr, uid, voucher_currency, company_currency, voucher.writeoff_amount, context=context_multi_currency)
72+ diff = currency_pool.compute(cr, uid, voucher_currency, company_currency, voucher.writeoff_amount, context=context_multi_currency)
73 account_id = False
74 write_off_name = ''
75 if voucher.payment_option == 'with_writeoff':
76@@ -939,7 +939,7 @@
77 def _get_amount_in_company_currency(self, cr, uid, ids, name, args, context=None):
78 res = {}
79 for line in self.browse(cr, uid, ids, context=context):
80- amount_in_company_currency, amount_in_voucher_currency = self.__company_currency_amount(cr, uid, line, line.amount, context=context)
81+ amount_in_company_currency, amount_in_voucher_currency = self.__company_currency_amount(cr, uid, line, line.amount, context=context)
82 res[line.id] = {
83 'amount_in_company_currency': amount_in_company_currency,
84 'amount_in_voucher_currency': amount_in_voucher_currency,
85@@ -961,8 +961,8 @@
86 'voucher_currency_id': fields.related('voucher_id', 'currency_id', type='many2one', relation='res.currency', string="Voucher Currency"),
87
88 'amount':fields.float('Amount', digits_compute=dp.get_precision('Account')),
89- 'amount_in_company_currency': fields.function(_get_amount_in_company_currency, string='Amount in Company Currency', type='float', digits_compute=dp.get_precision('Account'), multi="voucher_line_amount"),
90- 'amount_in_voucher_currency': fields.function(_get_amount_in_company_currency, string='Amount in Voucher Currency', type='float', digits_compute=dp.get_precision('Account'), multi="voucher_line_amount"),
91+ 'amount_in_company_currency': fields.function(_get_amount_in_company_currency, string='Amount in Company Currency', type='float', digits_compute=dp.get_precision('Account'), multi="voucher_line_amount"),
92+ 'amount_in_voucher_currency': fields.function(_get_amount_in_company_currency, string='Amount in Voucher Currency', type='float', digits_compute=dp.get_precision('Account'), multi="voucher_line_amount"),
93
94 'date_original': fields.related('move_line_id','date', type='date', relation='account.move.line', string='Date', readonly=1),
95 'date_due': fields.related('move_line_id','date_maturity', type='date', relation='account.move.line', string='Due Date', readonly=1),
96@@ -1062,7 +1062,7 @@
97 bank_st_line_obj = self.pool.get('account.bank.statement.line')
98 st_line = bank_st_line_obj.browse(cr, uid, st_line_id, context=context)
99 if st_line.voucher_id:
100- voucher_obj.write(cr, uid, [st_line.voucher_id.id], {'number': next_number}, context=context)
101+ voucher_obj.write(cr, uid, [st_line.voucher_id.id], {'number': next_number, 'date': st_line.date}, context=context)
102 if st_line.voucher_id.state == 'cancel':
103 voucher_obj.action_cancel_draft(cr, uid, [st_line.voucher_id.id], context=context)
104 wf_service.trg_validate(uid, 'account.voucher', st_line.voucher_id.id, 'proforma_voucher', cr)
105@@ -1072,7 +1072,7 @@
106 'move_ids': [(4, v.move_id.id, False)]
107 })
108
109- return move_line_obj.write(cr, uid, [x.id for x in v.move_ids], {'statement_id': st_line.statement_id.id}, context=context)
110+ return move_line_obj.write(cr, uid, [x.id for x in v.move_ids], {'statement_id': st_line.statement_id.id, 'date': st_line.date}, update_check=False, context=context)
111 return super(account_bank_statement, self).create_move_from_st_line(cr, uid, st_line.id, company_currency_id, next_number, context=context)
112
113 account_bank_statement()
114
115=== modified file 'account_voucher/wizard/account_statement_from_invoice.py'
116--- account_voucher/wizard/account_statement_from_invoice.py 2011-02-10 06:00:26 +0000
117+++ account_voucher/wizard/account_statement_from_invoice.py 2011-07-21 09:09:29 +0000
118@@ -75,7 +75,7 @@
119 statement.currency.id, amount, context=ctx)
120
121 context.update({'move_line_ids': [line.id]})
122- result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt'), date=line_date, context=context)
123+ result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), voucher_currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt'), date=line_date, context=context)
124 voucher_res = { 'type':(amount < 0 and 'payment' or 'receipt'),
125 'name': line.name,
126 'partner_id': line.partner_id.id,

Subscribers

People subscribed via source and target branches