Merge lp:~vauxoo/addons-vauxoo/7.0-addons-vauxoo-avt-dev-julio into lp:addons-vauxoo/7.0
- 7.0-addons-vauxoo-avt-dev-julio
- Merge into 7.0
Proposed by
Julio Serna-http://www.vauxoo.com
Status: | Merged |
---|---|
Merged at revision: | 976 |
Proposed branch: | lp:~vauxoo/addons-vauxoo/7.0-addons-vauxoo-avt-dev-julio |
Merge into: | lp:addons-vauxoo/7.0 |
Diff against target: |
211 lines (+2/-180) 1 file modified
account_voucher_tax/account_voucher.py (+2/-180) |
To merge this branch: | bzr merge lp:~vauxoo/addons-vauxoo/7.0-addons-vauxoo-avt-dev-julio |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Julio Serna-http://www.vauxoo.com | Pending | ||
Moisés López - http://www.vauxoo.com | Pending | ||
Review via email:
|
Commit message
Description of the change
added by context date of invoice to payment with currency distinct to company
To post a comment you must log in.
- 962. By Julio Serna-http://www.vauxoo.com
-
[MERGE] merge with addons-vauxoo/7.0
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'account_voucher_tax/account_voucher.py' |
2 | --- account_voucher_tax/account_voucher.py 2013-11-14 20:26:01 +0000 |
3 | +++ account_voucher_tax/account_voucher.py 2014-03-06 22:42:43 +0000 |
4 | @@ -110,139 +110,13 @@ |
5 | for line_tax in line.tax_line_ids: |
6 | credit=line_tax.amount_tax |
7 | amount_tax_unround=line_tax.amount_tax_unround |
8 | - #############funcionamiento anterior se esta haciendo funcionamineto en la funcion get_move_writeoff############################### |
9 | - # debit=0.0 |
10 | - # if company_currency!=current_currency: |
11 | - # credit=currency_obj.compute(cr, uid, current_currency,company_currency, float('%.*f' % (2,credit)), round=True, context=context) |
12 | - # if credit < 0: |
13 | - # credit, debit=debit, credit |
14 | - # if voucher.type=='payment': |
15 | - # credit, debit=debit, credit |
16 | - # move_line={ |
17 | - # 'journal_id': voucher.journal_id.id, |
18 | - # 'period_id': voucher.period_id.id, |
19 | - # 'name': line_tax.tax_id.account_collected_voucher_id.name or '/', |
20 | - # 'account_id': account_tax_voucher, |
21 | - # 'move_id': int(move_id), |
22 | - # 'partner_id': voucher.partner_id.id, |
23 | - # 'company_id':company_currency, |
24 | - # 'currency_id': line.move_line_id and (company_currency <> current_currency and current_currency) or False, |
25 | - # #~ 'currency_id': voucher.journal_id.currency.id, |
26 | - # 'quantity': 1, |
27 | - # 'credit': float('%.*f' % (2,abs(credit))), |
28 | - # 'debit': float('%.*f' % (2,abs(debit))), |
29 | - # 'amount_tax_unround':amount_tax_unround, |
30 | -# # 'analytic_account_id': line_tax.analytic_account_id and line_tax.analytic_account_id.id or False, |
31 | - # 'date': voucher.date, |
32 | - # 'tax_id': line_tax.id |
33 | - # } |
34 | -# # if company_currency!=current_currency: |
35 | - # # move_line['amount_currency']=line_tax.amount_tax |
36 | - # # move_ids.append(move_line_obj.create(cr ,uid, move_line, context=context)) |
37 | - # #~ if line_tax.diff_amount_tax: |
38 | - # context['date']=line.move_line_id.date |
39 | - # #~ amount=currency_obj.compute(cr, uid, current_currency,company_currency, float('%.*f' % (2,line_tax.original_tax)), round=False, context=context) |
40 | - # #~ if credit and voucher.payment_option=='with_writeoff'and line_tax.diff_amount_tax: |
41 | - # #~ credit=amount |
42 | - # #~ if debit and voucher.payment_option=='with_writeoff' and line_tax.diff_amount_tax: |
43 | - # #~ debit=amount |
44 | - # credit, debit=debit, credit |
45 | - # entrie_name = line_tax.tax_id.name |
46 | - #################################################################### |
47 | - |
48 | - |
49 | - #########borrado mientras se hizo en una funcion del writeoff |
50 | - # if voucher.payment_option=='with_writeoff': |
51 | - # if debit: |
52 | - # debit=line_tax.balance_tax |
53 | - # else: |
54 | - # credit=line_tax.balance_tax |
55 | - # entrie_name = 'poliza de writeof' |
56 | - ############################################################# |
57 | - |
58 | - |
59 | - #############funcionamiento anterior se esta haciendo funcionamineto en la funcion get_move_writeoff############################### |
60 | - # move_line={ |
61 | - # 'journal_id': voucher.journal_id.id, |
62 | - # 'period_id': voucher.period_id.id, |
63 | - # 'name': entrie_name or '/', |
64 | - # 'account_id':account_tax_collected, |
65 | - # 'move_id': int(move_id), |
66 | - # 'partner_id': voucher.partner_id.id, |
67 | - # 'company_id':company_currency, |
68 | - # #~ 'currency_id': voucher.journal_id.currency.id, |
69 | - # 'currency_id': line.move_line_id and (company_currency <> current_currency and current_currency) or False, |
70 | - # 'quantity': 1, |
71 | - # 'credit': float('%.*f' % (2,abs(credit))), |
72 | - # 'debit': float('%.*f' % (2,abs(debit))), |
73 | - # # 'amount_tax_unround':amount_tax_unround, |
74 | - # 'analytic_account_id': line_tax.analytic_account_id and line_tax.analytic_account_id.id or False, |
75 | - # 'date': voucher.date, |
76 | - # 'tax_id': line_tax.id |
77 | - # } |
78 | -# # if company_currency!=current_currency: |
79 | - # # move_line['amount_currency']=line_tax.amount_tax |
80 | - # # move_ids.append(move_line_obj.create(cr ,uid, move_line, context=context)) |
81 | - ############################################################################################# |
82 | - |
83 | -#####################no se usa codigo################################################################################################ |
84 | -# if line_tax.balance_tax + line_tax.amount_tax < line_tax.original_tax and voucher.payment_option=='with_writeoff': |
85 | -# context['date']=line.move_line_id.date |
86 | -# credit_orig=currency_obj.compute(cr, uid, current_currency,company_currency, float('%.*f' % (2,line_tax.balance_tax)), round=True, context=context) |
87 | -# context['date']=voucher.date |
88 | -# credit_now=currency_obj.compute(cr, uid, current_currency,company_currency, float('%.*f' % (2,line_tax.amount_tax)), round=False, context=context) |
89 | -# amount_diff=abs(credit_orig-credit_now) |
90 | -# debit_diff=0.0 |
91 | -# if voucher.type=='payment': |
92 | -# if not credit_orig-credit_now < 0: |
93 | -# amount_diff, debit_diff= debit_diff, amount_diff |
94 | -# move_line={ |
95 | -# 'journal_id': voucher.journal_id.id, |
96 | -# 'period_id': voucher.period_id.id, |
97 | -# 'name': 'change_tax: ' + str(line.name), |
98 | -# 'account_id':line_tax.diff_account_id and line_tax.diff_account_id.id or voucher.writeoff_acc_id.id, |
99 | -# 'move_id': int(move_id), |
100 | -# 'partner_id': voucher.partner_id.id, |
101 | -# 'company_id':company_currency, |
102 | -# #~ 'currency_id': voucher.journal_id.currency.id, |
103 | -# 'currency_id': line.move_line_id and (company_currency <> current_currency and current_currency) or False, |
104 | -# 'quantity': 1, |
105 | -# 'credit': float('%.*f' % (2,amount_diff)), |
106 | -# 'debit': float('%.*f' % (2,debit_diff)), |
107 | -# #~ 'analytic_account_id': line.account_analytic_id and line.account_analytic_id.id or False, |
108 | -# 'date': voucher.date, |
109 | -# 'tax_id': line_tax.id, |
110 | -# 'amount_tax_unround':amount_tax_unround, |
111 | -# } |
112 | -# #move_line_obj.create(cr ,uid, move_line, context=context) |
113 | -# else: |
114 | -# if credit_orig-credit_now < 0: |
115 | -# amount_diff, debit_diff= debit_diff, amount_diff |
116 | -# move_line={ |
117 | -# 'journal_id': voucher.journal_id.id, |
118 | -# 'period_id': voucher.period_id.id, |
119 | -# 'name': 'change_tax: ' + str(line.name), |
120 | -# 'account_id':line_tax.diff_account_id and line_tax.diff_account_id.id or voucher.writeoff_acc_id.id, |
121 | -# 'move_id': int(move_id), |
122 | -# 'partner_id': voucher.partner_id.id, |
123 | -# 'company_id':company_currency, |
124 | -# #~ 'currency_id': voucher.journal_id.currency.id, |
125 | -# 'currency_id': line.move_line_id and (company_currency <> current_currency and current_currency) or False, |
126 | -# 'quantity': 1, |
127 | -# 'credit': float('%.*f' % (2,amount_diff)), |
128 | -# 'debit': float('%.*f' % (2,debit_diff)), |
129 | -# #~ 'analytic_account_id': line.account_analytic_id and line.account_analytic_id.id or False, |
130 | -# 'date': voucher.date, |
131 | -# 'tax_id': line_tax.id |
132 | -# } |
133 | -# #move_line_obj.create(cr ,uid, move_line, context=context) |
134 | -##################################################################################################################################### |
135 | + |
136 | if voucher.type in ('sale', 'receipt'): |
137 | account_tax_voucher=line_tax.tax_id.account_collected_voucher_id.id |
138 | else: |
139 | account_tax_voucher=line_tax.tax_id.account_paid_voucher_id.id |
140 | account_tax_collected=line_tax.tax_id.account_collected_id.id |
141 | - |
142 | + context['date'] = line.move_line_id.date |
143 | reference_amount = line_tax.amount_tax |
144 | move_lines_tax = self._preparate_move_line_tax(cr, uid, |
145 | account_tax_voucher, account_tax_collected, |
146 | @@ -259,57 +133,6 @@ |
147 | move_create = move_line_obj.create(cr ,uid, move_line_tax, |
148 | context=context) |
149 | move_ids.append(move_create) |
150 | - |
151 | - amount_exchange = self._convert_amount(cr, uid, line.untax_amount or line.amount, voucher.id, context=context) |
152 | - tax_amount_exchange = self._convert_amount(cr, uid, line.amount_original, voucher.id, context=context) |
153 | - base_exchange = self._convert_amount(cr, uid, 2.88, voucher.id, context=context) |
154 | - if line.amount == line.amount_unreconciled: |
155 | - if not line.move_line_id: |
156 | - raise osv.except_osv(_('Wrong voucher line'),_("The invoice you are willing to pay is not valid anymore.")) |
157 | - sign = voucher.type in ('payment', 'purchase') and -1 or 1 |
158 | - currency_rate_difference = sign * (line.move_line_id.amount_residual - amount_exchange) |
159 | - if round(currency_rate_difference, 2): |
160 | - factor=self.get_percent_pay_vs_invoice(cr ,uid, tax_amount_exchange, currency_rate_difference,context=context) |
161 | - base_amount=self.get_partial_amount_tax_pay(cr, uid, line_tax.tax_id.amount, base_exchange, context=context) |
162 | - move_lines_tax = self._preparate_move_line_tax(cr, uid, |
163 | - account_tax_voucher, account_tax_collected, |
164 | - move_id, voucher.type, voucher.partner_id.id, |
165 | - voucher.period_id.id, voucher.journal_id.id, |
166 | - voucher.date, company_currency, |
167 | - factor * base_amount, None, |
168 | - company_currency, |
169 | - line_tax.id, line_tax.tax_id, |
170 | - line_tax.analytic_account_id and\ |
171 | - line_tax.analytic_account_id.id or False, |
172 | - line_tax.amount_base, |
173 | - factor, context=context) |
174 | - for move_line_tax in move_lines_tax: |
175 | - move_create = move_line_obj.create(cr ,uid, move_line_tax, |
176 | - context=context) |
177 | - move_ids.append(move_create) |
178 | - |
179 | -##commented code section that we are not considering |
180 | -##taxes actually paid by cases writeoff |
181 | -# if voucher.writeoff_amount > 0: |
182 | - # reference_amount_w = self.get_partial_amount_tax_pay(cr, |
183 | - # uid, voucher.writeoff_amount, |
184 | - # line_tax.original_tax, context=context) |
185 | - # context['writeoff'] = True |
186 | - # move_lines_w = self._preparate_move_line_tax(cr, uid, |
187 | - # account_tax_voucher, voucher.writeoff_acc_id.id, |
188 | - # move_id, voucher.type, voucher.partner_id.id, |
189 | - # voucher.period_id.id, voucher.journal_id.id, |
190 | - # voucher.date, company_currency, reference_amount_w, |
191 | - # None, current_currency, |
192 | - # line_tax.id, line_tax.tax_id.name, |
193 | - # line_tax.analytic_account_id and\ |
194 | - # line_tax.analytic_account_id.id or False, |
195 | - # line_tax.amount_base, |
196 | - # factor, context=context) |
197 | - # for move_line_w in move_lines_w: |
198 | - # move_create = move_line_obj.create(cr ,uid, move_line_w, |
199 | - # context=context) |
200 | - # move_ids.append(move_create) |
201 | return move_ids |
202 | |
203 | def _preparate_move_line_tax(self, cr, uid, src_account_id, dest_account_id, |
204 | @@ -361,7 +184,6 @@ |
205 | 'date' : date, |
206 | 'tax_voucher_id' : tax_id, |
207 | } |
208 | - |
209 | if type in ('payment','purchase'): |
210 | reference_amount < 0 and\ |
211 | [credit_line_vals.pop('analytic_account_id'), |