Merge lp:~openbig/bigconsulting/currency_diff_invoice into lp:bigconsulting

Proposed by gpa(OpenERP)
Status: Merged
Merged at revision: 107
Proposed branch: lp:~openbig/bigconsulting/currency_diff_invoice
Merge into: lp:bigconsulting
Diff against target: 50 lines (+16/-3)
1 file modified
account_invoice_cash_discount/account_invoice_cash_discount.py (+16/-3)
To merge this branch: bzr merge lp:~openbig/bigconsulting/currency_diff_invoice
Reviewer Review Type Date Requested Status
openbig Pending
Review via email: mp+36419@code.launchpad.net

Description of the change

improvement for the currency difference.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_invoice_cash_discount/account_invoice_cash_discount.py'
2--- account_invoice_cash_discount/account_invoice_cash_discount.py 2010-09-22 14:21:33 +0000
3+++ account_invoice_cash_discount/account_invoice_cash_discount.py 2010-09-23 08:35:54 +0000
4@@ -786,7 +786,7 @@
5 new_amount_currency = 0.0
6 newline_amount_currency = 0.0
7 for newline in move.reconcile_id.line_new_ids:
8- newline_amount_currency += newline.amount
9+ newline_amount_currency = newline.amount
10 if st.currency.id <> company_currency_id:
11 newline_amount_currency = res_currency_obj.compute(cr, uid, st.currency.id,
12 company_currency_id, newline.amount, context=context)
13@@ -817,8 +817,7 @@
14
15 for line in move.reconcile_id.line_ids:
16 move_line_data = self.pool.get('account.move.line').browse(cr, uid, line.id, context=context)
17- if st.currency.id <> (move_line_data.currency_id.id or company_currency_id):
18-
19+ if st.currency.id <> company_currency_id:
20 expense_acc = res_users_obj.browse(cr, uid, uid, context=context).company_id.expense_account_id.id
21 revene_acc = res_users_obj.browse(cr, uid, uid, context=context).company_id.revenue_account_id.id
22 currency_id = st.currency.id
23@@ -836,6 +835,19 @@
24 for line in reconcile_data.line_new_ids:
25 reconcile_sum += line.amount
26 balance = round((balance_sum - reconcile_sum),2)
27+
28+ if st.currency.id <> move_line_data.currency_id.id:
29+ invoice_cret_balance = 0.0
30+ payment_balance = 0.0
31+ context.update({'date': move_line_data.date})
32+ inv_create_balance = res_currency_obj.compute(cr, uid, company_currency_id,
33+ st.currency.id, amount, context=context)
34+ currenct_date = time.strftime('%Y-%m-%d')
35+ context.update({'date': currenct_date})
36+ payment_balance = res_currency_obj.compute(cr, uid, company_currency_id,
37+ st.currency.id, amount, context=context)
38+ balance = inv_create_balance - payment_balance
39+
40 ###### set fisical position for the currency_diff account and partner account
41 fpos = move_line_data.invoice.fiscal_position or False
42 if expense_acc:
43@@ -895,6 +907,7 @@
44 amount_currency = res_currency_obj.compute(cr, uid, company_currency_id, st.currency.id,
45 (amount+st_tax_amount-newline_sum), context=context,
46 account=acc_cur)
47+ currency_id = st.currency.id
48
49 account_move_line_obj.create(cr, uid, {
50 'name': move.name,

Subscribers

People subscribed via source and target branches