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

Proposed by gpa(OpenERP)
Status: Merged
Merged at revision: 105
Proposed branch: lp:~openbig/bigconsulting/statement_account
Merge into: lp:bigconsulting
Diff against target: 156 lines (+45/-69)
2 files modified
account_invoice_cash_discount/account_invoice_cash_discount.py (+44/-67)
account_invoice_cash_discount/wizard/invoice_statement_payment.py (+1/-2)
To merge this branch: bzr merge lp:~openbig/bigconsulting/statement_account
Reviewer Review Type Date Requested Status
openbig Pending
Review via email: mp+36139@code.launchpad.net

Description of the change

added changes for the account selection in the statement

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-21 10:45:28 +0000
3+++ account_invoice_cash_discount/account_invoice_cash_discount.py 2010-09-21 12:26:27 +0000
4@@ -704,6 +704,7 @@
5 st_base_code_id = False
6 move_tax_amount = 0.0
7 tax_real_amt = 0.0
8+ curr_diff_account_id = False
9
10 if move.type == 'general':
11 if move.tax_type == 'tax_included':
12@@ -807,7 +808,6 @@
13
14 for line in move.reconcile_id.line_ids:
15 move_line_data = self.pool.get('account.move.line').browse(cr, uid, line.id, context=context)
16-
17 if st.currency.id <> move_line_data.currency_id.id:
18 amount_currency = move.amount
19 expense_acc = res_users_obj.browse(cr, uid, uid, context=context).company_id.expense_account_id.id
20@@ -832,72 +832,49 @@
21 if partner_acc_id:
22 partner_acc_id = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, partner_acc_id)
23 ##############################################
24-
25- if balance < 0.00:
26- account_move_line_obj.create(cr, uid, {
27- 'name': move.name,
28- 'date': move.date,
29- 'ref': move.ref,
30- 'move_id': move_id,
31- 'partner_id': ((move.partner_id) and move.partner_id.id) or False,
32- 'account_id': expense_acc,
33- 'credit': abs(balance),
34- 'debit': 0.0,
35- 'statement_id': st.id,
36- 'journal_id': st.journal_id.id,
37- 'period_id': st.period_id.id,
38- 'amount_currency': 0.0,
39- 'currency_id': currency_id,
40- }, context=context)
41-
42- account_move_line_obj.create(cr, uid, {
43- 'name': move.name,
44- 'date': move.date,
45- 'ref': move.ref,
46- 'move_id': move_id,
47- 'partner_id': ((move.partner_id) and move.partner_id.id) or False,
48- 'account_id': partner_acc_id,
49- 'credit': 0.0,
50- 'debit': abs(balance),
51- 'statement_id': st.id,
52- 'journal_id': st.journal_id.id,
53- 'period_id': st.period_id.id,
54- 'amount_currency': 0.0,
55- 'currency_id': currency_id,
56- }, context=context)
57-
58- elif balance > 0.00:
59- account_move_line_obj.create(cr, uid, {
60- 'name': move.name,
61- 'date': move.date,
62- 'ref': move.ref,
63- 'move_id': move_id,
64- 'partner_id': ((move.partner_id) and move.partner_id.id) or False,
65- 'account_id':revene_acc,
66- 'credit': abs(balance),
67- 'debit': 0.0,
68- 'statement_id': st.id,
69- 'journal_id': st.journal_id.id,
70- 'period_id': st.period_id.id,
71- 'amount_currency': 0.0,
72- 'currency_id': currency_id,
73- }, context=context)
74-
75- account_move_line_obj.create(cr, uid, {
76- 'name': move.name,
77- 'date': move.date,
78- 'ref': move.ref,
79- 'move_id': move_id,
80- 'partner_id': ((move.partner_id) and move.partner_id.id) or False,
81- 'account_id': partner_acc_id,
82- 'credit': 0.0,
83- 'debit': abs(balance),
84- 'statement_id': st.id,
85- 'journal_id': st.journal_id.id,
86- 'period_id': st.period_id.id,
87- 'amount_currency': 0.0,
88- 'currency_id': currency_id,
89- }, context=context)
90+
91+ ## Account selection############
92+ if move_line_data.invoice.type in ['in_invoice','out_refund'] and balance < 0.00:
93+ curr_diff_account_id = revene_acc
94+ elif move_line_data.invoice.type in ['in_invoice','out_refund'] and balance > 0.00:
95+ curr_diff_account_id = expense_acc
96+ elif move_line_data.invoice.type in ['out_invoice','in_refund'] and balance < 0.00:
97+ curr_diff_account_id = revene_acc
98+ elif move_line_data.invoice.type in ['out_invoice','in_refund'] and balance > 0.00:
99+ curr_diff_account_id = expense_acc
100+ #######################################
101+
102+ account_move_line_obj.create(cr, uid, {
103+ 'name': move.name,
104+ 'date': move.date,
105+ 'ref': move.ref,
106+ 'move_id': move_id,
107+ 'partner_id': ((move.partner_id) and move.partner_id.id) or False,
108+ 'account_id': expense_acc,
109+ 'credit': abs(balance),
110+ 'debit': 0.0,
111+ 'statement_id': st.id,
112+ 'journal_id': st.journal_id.id,
113+ 'period_id': st.period_id.id,
114+ 'amount_currency': 0.0,
115+ 'currency_id': currency_id,
116+ }, context=context)
117+
118+ account_move_line_obj.create(cr, uid, {
119+ 'name': move.name,
120+ 'date': move.date,
121+ 'ref': move.ref,
122+ 'move_id': move_id,
123+ 'partner_id': ((move.partner_id) and move.partner_id.id) or False,
124+ 'account_id': partner_acc_id,
125+ 'credit': 0.0,
126+ 'debit': abs(balance),
127+ 'statement_id': st.id,
128+ 'journal_id': st.journal_id.id,
129+ 'period_id': st.period_id.id,
130+ 'amount_currency': 0.0,
131+ 'currency_id': currency_id,
132+ }, context=context)
133
134 new_end_value += amount+st_tax_amount-newline_sum
135
136
137=== modified file 'account_invoice_cash_discount/wizard/invoice_statement_payment.py'
138--- account_invoice_cash_discount/wizard/invoice_statement_payment.py 2010-09-21 10:45:28 +0000
139+++ account_invoice_cash_discount/wizard/invoice_statement_payment.py 2010-09-21 12:26:27 +0000
140@@ -126,7 +126,7 @@
141 # else:
142 ctx['date'] = line_date
143 invoice_amount = 0.0
144-
145+ cal_invoice_amount = 0.0
146 if line.debit > 0:
147 invoice_amount = line.debit
148 elif line.credit > 0:
149@@ -144,7 +144,6 @@
150 for invoice_line in invoice.invoice_line:
151 line_tax_amount = 0.0
152 total_tax_amount = 0.0
153- cal_invoice_amount = 0.0
154 tax_account_id = False
155 tax_code_id = False
156 tax_base_id = False

Subscribers

People subscribed via source and target branches