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 | 110 | for line_tax in line.tax_line_ids: | 110 | for line_tax in line.tax_line_ids: |
6 | 111 | credit=line_tax.amount_tax | 111 | credit=line_tax.amount_tax |
7 | 112 | amount_tax_unround=line_tax.amount_tax_unround | 112 | amount_tax_unround=line_tax.amount_tax_unround |
135 | 113 | #############funcionamiento anterior se esta haciendo funcionamineto en la funcion get_move_writeoff############################### | 113 | |
9 | 114 | # debit=0.0 | ||
10 | 115 | # if company_currency!=current_currency: | ||
11 | 116 | # credit=currency_obj.compute(cr, uid, current_currency,company_currency, float('%.*f' % (2,credit)), round=True, context=context) | ||
12 | 117 | # if credit < 0: | ||
13 | 118 | # credit, debit=debit, credit | ||
14 | 119 | # if voucher.type=='payment': | ||
15 | 120 | # credit, debit=debit, credit | ||
16 | 121 | # move_line={ | ||
17 | 122 | # 'journal_id': voucher.journal_id.id, | ||
18 | 123 | # 'period_id': voucher.period_id.id, | ||
19 | 124 | # 'name': line_tax.tax_id.account_collected_voucher_id.name or '/', | ||
20 | 125 | # 'account_id': account_tax_voucher, | ||
21 | 126 | # 'move_id': int(move_id), | ||
22 | 127 | # 'partner_id': voucher.partner_id.id, | ||
23 | 128 | # 'company_id':company_currency, | ||
24 | 129 | # 'currency_id': line.move_line_id and (company_currency <> current_currency and current_currency) or False, | ||
25 | 130 | # #~ 'currency_id': voucher.journal_id.currency.id, | ||
26 | 131 | # 'quantity': 1, | ||
27 | 132 | # 'credit': float('%.*f' % (2,abs(credit))), | ||
28 | 133 | # 'debit': float('%.*f' % (2,abs(debit))), | ||
29 | 134 | # 'amount_tax_unround':amount_tax_unround, | ||
30 | 135 | # # 'analytic_account_id': line_tax.analytic_account_id and line_tax.analytic_account_id.id or False, | ||
31 | 136 | # 'date': voucher.date, | ||
32 | 137 | # 'tax_id': line_tax.id | ||
33 | 138 | # } | ||
34 | 139 | # # if company_currency!=current_currency: | ||
35 | 140 | # # move_line['amount_currency']=line_tax.amount_tax | ||
36 | 141 | # # move_ids.append(move_line_obj.create(cr ,uid, move_line, context=context)) | ||
37 | 142 | # #~ if line_tax.diff_amount_tax: | ||
38 | 143 | # context['date']=line.move_line_id.date | ||
39 | 144 | # #~ amount=currency_obj.compute(cr, uid, current_currency,company_currency, float('%.*f' % (2,line_tax.original_tax)), round=False, context=context) | ||
40 | 145 | # #~ if credit and voucher.payment_option=='with_writeoff'and line_tax.diff_amount_tax: | ||
41 | 146 | # #~ credit=amount | ||
42 | 147 | # #~ if debit and voucher.payment_option=='with_writeoff' and line_tax.diff_amount_tax: | ||
43 | 148 | # #~ debit=amount | ||
44 | 149 | # credit, debit=debit, credit | ||
45 | 150 | # entrie_name = line_tax.tax_id.name | ||
46 | 151 | #################################################################### | ||
47 | 152 | |||
48 | 153 | |||
49 | 154 | #########borrado mientras se hizo en una funcion del writeoff | ||
50 | 155 | # if voucher.payment_option=='with_writeoff': | ||
51 | 156 | # if debit: | ||
52 | 157 | # debit=line_tax.balance_tax | ||
53 | 158 | # else: | ||
54 | 159 | # credit=line_tax.balance_tax | ||
55 | 160 | # entrie_name = 'poliza de writeof' | ||
56 | 161 | ############################################################# | ||
57 | 162 | |||
58 | 163 | |||
59 | 164 | #############funcionamiento anterior se esta haciendo funcionamineto en la funcion get_move_writeoff############################### | ||
60 | 165 | # move_line={ | ||
61 | 166 | # 'journal_id': voucher.journal_id.id, | ||
62 | 167 | # 'period_id': voucher.period_id.id, | ||
63 | 168 | # 'name': entrie_name or '/', | ||
64 | 169 | # 'account_id':account_tax_collected, | ||
65 | 170 | # 'move_id': int(move_id), | ||
66 | 171 | # 'partner_id': voucher.partner_id.id, | ||
67 | 172 | # 'company_id':company_currency, | ||
68 | 173 | # #~ 'currency_id': voucher.journal_id.currency.id, | ||
69 | 174 | # 'currency_id': line.move_line_id and (company_currency <> current_currency and current_currency) or False, | ||
70 | 175 | # 'quantity': 1, | ||
71 | 176 | # 'credit': float('%.*f' % (2,abs(credit))), | ||
72 | 177 | # 'debit': float('%.*f' % (2,abs(debit))), | ||
73 | 178 | # # 'amount_tax_unround':amount_tax_unround, | ||
74 | 179 | # 'analytic_account_id': line_tax.analytic_account_id and line_tax.analytic_account_id.id or False, | ||
75 | 180 | # 'date': voucher.date, | ||
76 | 181 | # 'tax_id': line_tax.id | ||
77 | 182 | # } | ||
78 | 183 | # # if company_currency!=current_currency: | ||
79 | 184 | # # move_line['amount_currency']=line_tax.amount_tax | ||
80 | 185 | # # move_ids.append(move_line_obj.create(cr ,uid, move_line, context=context)) | ||
81 | 186 | ############################################################################################# | ||
82 | 187 | |||
83 | 188 | #####################no se usa codigo################################################################################################ | ||
84 | 189 | # if line_tax.balance_tax + line_tax.amount_tax < line_tax.original_tax and voucher.payment_option=='with_writeoff': | ||
85 | 190 | # context['date']=line.move_line_id.date | ||
86 | 191 | # credit_orig=currency_obj.compute(cr, uid, current_currency,company_currency, float('%.*f' % (2,line_tax.balance_tax)), round=True, context=context) | ||
87 | 192 | # context['date']=voucher.date | ||
88 | 193 | # credit_now=currency_obj.compute(cr, uid, current_currency,company_currency, float('%.*f' % (2,line_tax.amount_tax)), round=False, context=context) | ||
89 | 194 | # amount_diff=abs(credit_orig-credit_now) | ||
90 | 195 | # debit_diff=0.0 | ||
91 | 196 | # if voucher.type=='payment': | ||
92 | 197 | # if not credit_orig-credit_now < 0: | ||
93 | 198 | # amount_diff, debit_diff= debit_diff, amount_diff | ||
94 | 199 | # move_line={ | ||
95 | 200 | # 'journal_id': voucher.journal_id.id, | ||
96 | 201 | # 'period_id': voucher.period_id.id, | ||
97 | 202 | # 'name': 'change_tax: ' + str(line.name), | ||
98 | 203 | # 'account_id':line_tax.diff_account_id and line_tax.diff_account_id.id or voucher.writeoff_acc_id.id, | ||
99 | 204 | # 'move_id': int(move_id), | ||
100 | 205 | # 'partner_id': voucher.partner_id.id, | ||
101 | 206 | # 'company_id':company_currency, | ||
102 | 207 | # #~ 'currency_id': voucher.journal_id.currency.id, | ||
103 | 208 | # 'currency_id': line.move_line_id and (company_currency <> current_currency and current_currency) or False, | ||
104 | 209 | # 'quantity': 1, | ||
105 | 210 | # 'credit': float('%.*f' % (2,amount_diff)), | ||
106 | 211 | # 'debit': float('%.*f' % (2,debit_diff)), | ||
107 | 212 | # #~ 'analytic_account_id': line.account_analytic_id and line.account_analytic_id.id or False, | ||
108 | 213 | # 'date': voucher.date, | ||
109 | 214 | # 'tax_id': line_tax.id, | ||
110 | 215 | # 'amount_tax_unround':amount_tax_unround, | ||
111 | 216 | # } | ||
112 | 217 | # #move_line_obj.create(cr ,uid, move_line, context=context) | ||
113 | 218 | # else: | ||
114 | 219 | # if credit_orig-credit_now < 0: | ||
115 | 220 | # amount_diff, debit_diff= debit_diff, amount_diff | ||
116 | 221 | # move_line={ | ||
117 | 222 | # 'journal_id': voucher.journal_id.id, | ||
118 | 223 | # 'period_id': voucher.period_id.id, | ||
119 | 224 | # 'name': 'change_tax: ' + str(line.name), | ||
120 | 225 | # 'account_id':line_tax.diff_account_id and line_tax.diff_account_id.id or voucher.writeoff_acc_id.id, | ||
121 | 226 | # 'move_id': int(move_id), | ||
122 | 227 | # 'partner_id': voucher.partner_id.id, | ||
123 | 228 | # 'company_id':company_currency, | ||
124 | 229 | # #~ 'currency_id': voucher.journal_id.currency.id, | ||
125 | 230 | # 'currency_id': line.move_line_id and (company_currency <> current_currency and current_currency) or False, | ||
126 | 231 | # 'quantity': 1, | ||
127 | 232 | # 'credit': float('%.*f' % (2,amount_diff)), | ||
128 | 233 | # 'debit': float('%.*f' % (2,debit_diff)), | ||
129 | 234 | # #~ 'analytic_account_id': line.account_analytic_id and line.account_analytic_id.id or False, | ||
130 | 235 | # 'date': voucher.date, | ||
131 | 236 | # 'tax_id': line_tax.id | ||
132 | 237 | # } | ||
133 | 238 | # #move_line_obj.create(cr ,uid, move_line, context=context) | ||
134 | 239 | ##################################################################################################################################### | ||
136 | 240 | if voucher.type in ('sale', 'receipt'): | 114 | if voucher.type in ('sale', 'receipt'): |
137 | 241 | account_tax_voucher=line_tax.tax_id.account_collected_voucher_id.id | 115 | account_tax_voucher=line_tax.tax_id.account_collected_voucher_id.id |
138 | 242 | else: | 116 | else: |
139 | 243 | account_tax_voucher=line_tax.tax_id.account_paid_voucher_id.id | 117 | account_tax_voucher=line_tax.tax_id.account_paid_voucher_id.id |
140 | 244 | account_tax_collected=line_tax.tax_id.account_collected_id.id | 118 | account_tax_collected=line_tax.tax_id.account_collected_id.id |
142 | 245 | 119 | context['date'] = line.move_line_id.date | |
143 | 246 | reference_amount = line_tax.amount_tax | 120 | reference_amount = line_tax.amount_tax |
144 | 247 | move_lines_tax = self._preparate_move_line_tax(cr, uid, | 121 | move_lines_tax = self._preparate_move_line_tax(cr, uid, |
145 | 248 | account_tax_voucher, account_tax_collected, | 122 | account_tax_voucher, account_tax_collected, |
146 | @@ -259,57 +133,6 @@ | |||
147 | 259 | move_create = move_line_obj.create(cr ,uid, move_line_tax, | 133 | move_create = move_line_obj.create(cr ,uid, move_line_tax, |
148 | 260 | context=context) | 134 | context=context) |
149 | 261 | move_ids.append(move_create) | 135 | move_ids.append(move_create) |
150 | 262 | |||
151 | 263 | amount_exchange = self._convert_amount(cr, uid, line.untax_amount or line.amount, voucher.id, context=context) | ||
152 | 264 | tax_amount_exchange = self._convert_amount(cr, uid, line.amount_original, voucher.id, context=context) | ||
153 | 265 | base_exchange = self._convert_amount(cr, uid, 2.88, voucher.id, context=context) | ||
154 | 266 | if line.amount == line.amount_unreconciled: | ||
155 | 267 | if not line.move_line_id: | ||
156 | 268 | raise osv.except_osv(_('Wrong voucher line'),_("The invoice you are willing to pay is not valid anymore.")) | ||
157 | 269 | sign = voucher.type in ('payment', 'purchase') and -1 or 1 | ||
158 | 270 | currency_rate_difference = sign * (line.move_line_id.amount_residual - amount_exchange) | ||
159 | 271 | if round(currency_rate_difference, 2): | ||
160 | 272 | factor=self.get_percent_pay_vs_invoice(cr ,uid, tax_amount_exchange, currency_rate_difference,context=context) | ||
161 | 273 | base_amount=self.get_partial_amount_tax_pay(cr, uid, line_tax.tax_id.amount, base_exchange, context=context) | ||
162 | 274 | move_lines_tax = self._preparate_move_line_tax(cr, uid, | ||
163 | 275 | account_tax_voucher, account_tax_collected, | ||
164 | 276 | move_id, voucher.type, voucher.partner_id.id, | ||
165 | 277 | voucher.period_id.id, voucher.journal_id.id, | ||
166 | 278 | voucher.date, company_currency, | ||
167 | 279 | factor * base_amount, None, | ||
168 | 280 | company_currency, | ||
169 | 281 | line_tax.id, line_tax.tax_id, | ||
170 | 282 | line_tax.analytic_account_id and\ | ||
171 | 283 | line_tax.analytic_account_id.id or False, | ||
172 | 284 | line_tax.amount_base, | ||
173 | 285 | factor, context=context) | ||
174 | 286 | for move_line_tax in move_lines_tax: | ||
175 | 287 | move_create = move_line_obj.create(cr ,uid, move_line_tax, | ||
176 | 288 | context=context) | ||
177 | 289 | move_ids.append(move_create) | ||
178 | 290 | |||
179 | 291 | ##commented code section that we are not considering | ||
180 | 292 | ##taxes actually paid by cases writeoff | ||
181 | 293 | # if voucher.writeoff_amount > 0: | ||
182 | 294 | # reference_amount_w = self.get_partial_amount_tax_pay(cr, | ||
183 | 295 | # uid, voucher.writeoff_amount, | ||
184 | 296 | # line_tax.original_tax, context=context) | ||
185 | 297 | # context['writeoff'] = True | ||
186 | 298 | # move_lines_w = self._preparate_move_line_tax(cr, uid, | ||
187 | 299 | # account_tax_voucher, voucher.writeoff_acc_id.id, | ||
188 | 300 | # move_id, voucher.type, voucher.partner_id.id, | ||
189 | 301 | # voucher.period_id.id, voucher.journal_id.id, | ||
190 | 302 | # voucher.date, company_currency, reference_amount_w, | ||
191 | 303 | # None, current_currency, | ||
192 | 304 | # line_tax.id, line_tax.tax_id.name, | ||
193 | 305 | # line_tax.analytic_account_id and\ | ||
194 | 306 | # line_tax.analytic_account_id.id or False, | ||
195 | 307 | # line_tax.amount_base, | ||
196 | 308 | # factor, context=context) | ||
197 | 309 | # for move_line_w in move_lines_w: | ||
198 | 310 | # move_create = move_line_obj.create(cr ,uid, move_line_w, | ||
199 | 311 | # context=context) | ||
200 | 312 | # move_ids.append(move_create) | ||
201 | 313 | return move_ids | 136 | return move_ids |
202 | 314 | 137 | ||
203 | 315 | def _preparate_move_line_tax(self, cr, uid, src_account_id, dest_account_id, | 138 | def _preparate_move_line_tax(self, cr, uid, src_account_id, dest_account_id, |
204 | @@ -361,7 +184,6 @@ | |||
205 | 361 | 'date' : date, | 184 | 'date' : date, |
206 | 362 | 'tax_voucher_id' : tax_id, | 185 | 'tax_voucher_id' : tax_id, |
207 | 363 | } | 186 | } |
208 | 364 | |||
209 | 365 | if type in ('payment','purchase'): | 187 | if type in ('payment','purchase'): |
210 | 366 | reference_amount < 0 and\ | 188 | reference_amount < 0 and\ |
211 | 367 | [credit_line_vals.pop('analytic_account_id'), | 189 | [credit_line_vals.pop('analytic_account_id'), |