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
=== modified file 'account_invoice_cash_discount/account_invoice_cash_discount.py'
--- account_invoice_cash_discount/account_invoice_cash_discount.py 2010-09-22 14:21:33 +0000
+++ account_invoice_cash_discount/account_invoice_cash_discount.py 2010-09-23 08:35:54 +0000
@@ -786,7 +786,7 @@
786 new_amount_currency = 0.0786 new_amount_currency = 0.0
787 newline_amount_currency = 0.0787 newline_amount_currency = 0.0
788 for newline in move.reconcile_id.line_new_ids:788 for newline in move.reconcile_id.line_new_ids:
789 newline_amount_currency += newline.amount789 newline_amount_currency = newline.amount
790 if st.currency.id <> company_currency_id:790 if st.currency.id <> company_currency_id:
791 newline_amount_currency = res_currency_obj.compute(cr, uid, st.currency.id,791 newline_amount_currency = res_currency_obj.compute(cr, uid, st.currency.id,
792 company_currency_id, newline.amount, context=context)792 company_currency_id, newline.amount, context=context)
@@ -817,8 +817,7 @@
817 817
818 for line in move.reconcile_id.line_ids:818 for line in move.reconcile_id.line_ids:
819 move_line_data = self.pool.get('account.move.line').browse(cr, uid, line.id, context=context)819 move_line_data = self.pool.get('account.move.line').browse(cr, uid, line.id, context=context)
820 if st.currency.id <> (move_line_data.currency_id.id or company_currency_id):820 if st.currency.id <> company_currency_id:
821
822 expense_acc = res_users_obj.browse(cr, uid, uid, context=context).company_id.expense_account_id.id821 expense_acc = res_users_obj.browse(cr, uid, uid, context=context).company_id.expense_account_id.id
823 revene_acc = res_users_obj.browse(cr, uid, uid, context=context).company_id.revenue_account_id.id822 revene_acc = res_users_obj.browse(cr, uid, uid, context=context).company_id.revenue_account_id.id
824 currency_id = st.currency.id823 currency_id = st.currency.id
@@ -836,6 +835,19 @@
836 for line in reconcile_data.line_new_ids:835 for line in reconcile_data.line_new_ids:
837 reconcile_sum += line.amount836 reconcile_sum += line.amount
838 balance = round((balance_sum - reconcile_sum),2)837 balance = round((balance_sum - reconcile_sum),2)
838
839 if st.currency.id <> move_line_data.currency_id.id:
840 invoice_cret_balance = 0.0
841 payment_balance = 0.0
842 context.update({'date': move_line_data.date})
843 inv_create_balance = res_currency_obj.compute(cr, uid, company_currency_id,
844 st.currency.id, amount, context=context)
845 currenct_date = time.strftime('%Y-%m-%d')
846 context.update({'date': currenct_date})
847 payment_balance = res_currency_obj.compute(cr, uid, company_currency_id,
848 st.currency.id, amount, context=context)
849 balance = inv_create_balance - payment_balance
850
839 ###### set fisical position for the currency_diff account and partner account851 ###### set fisical position for the currency_diff account and partner account
840 fpos = move_line_data.invoice.fiscal_position or False852 fpos = move_line_data.invoice.fiscal_position or False
841 if expense_acc:853 if expense_acc:
@@ -895,6 +907,7 @@
895 amount_currency = res_currency_obj.compute(cr, uid, company_currency_id, st.currency.id,907 amount_currency = res_currency_obj.compute(cr, uid, company_currency_id, st.currency.id,
896 (amount+st_tax_amount-newline_sum), context=context,908 (amount+st_tax_amount-newline_sum), context=context,
897 account=acc_cur)909 account=acc_cur)
910 currency_id = st.currency.id
898911
899 account_move_line_obj.create(cr, uid, {912 account_move_line_obj.create(cr, uid, {
900 'name': move.name,913 'name': move.name,

Subscribers

People subscribed via source and target branches