Merge lp:~serpentcs/openerp-usa/base_nationalacct into lp:openerp-usa
- base_nationalacct
- Merge into 7.0
Proposed by
Serpent Consulting Services
Status: | Merged |
---|---|
Merged at revision: | 6 |
Proposed branch: | lp:~serpentcs/openerp-usa/base_nationalacct |
Merge into: | lp:openerp-usa |
Diff against target: |
736 lines (+268/-157) 9 files modified
account_payment_ccapi_authdotnet/cc_auth_api.py (+28/-126) account_payment_ccapi_authdotnet/stock_return_picking.py (+7/-7) account_payment_creditcard/account_journal.py (+5/-5) account_payment_creditcard/account_voucher.py (+19/-19) base_nationalacct/Change Log.txt (+15/-0) base_nationalacct/__init__.py (+26/-0) base_nationalacct/__openerp__.py (+43/-0) base_nationalacct/partner.py (+89/-0) base_nationalacct/partner_view.xml (+36/-0) |
To merge this branch: | bzr merge lp:~serpentcs/openerp-usa/base_nationalacct |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Novapoint Group | Approve | ||
Review via email: mp+229958@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Novapoint Group (npg-team) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'account_payment_ccapi_authdotnet/cc_auth_api.py' | |||
2 | --- account_payment_ccapi_authdotnet/cc_auth_api.py 2014-01-09 18:15:04 +0000 | |||
3 | +++ account_payment_ccapi_authdotnet/cc_auth_api.py 2014-08-07 15:27:11 +0000 | |||
4 | @@ -128,11 +128,11 @@ | |||
5 | 128 | # vals['type'] = 'sale' | 128 | # vals['type'] = 'sale' |
6 | 129 | # vals['currency_id'] = journal_obj.company_id.currency_id.id | 129 | # vals['currency_id'] = journal_obj.company_id.currency_id.id |
7 | 130 | # vals['line_cr_ids'] = [(0,0,cr_ids) for cr_ids in cr_ids_list] | 130 | # vals['line_cr_ids'] = [(0,0,cr_ids) for cr_ids in cr_ids_list] |
9 | 131 | ## vals['narration'] = voucher_obj.narration | 131 | # # vals['narration'] = voucher_obj.narration |
10 | 132 | # vals['pay_now'] = 'pay_now' | 132 | # vals['pay_now'] = 'pay_now' |
11 | 133 | # vals['account_id'] = journal_obj.default_debit_account_id.id | 133 | # vals['account_id'] = journal_obj.default_debit_account_id.id |
14 | 134 | ## vals['reference'] = voucher_obj.reference | 134 | # # vals['reference'] = voucher_obj.reference |
15 | 135 | ## vals['tax_id'] = voucher_obj.tax_id.id | 135 | # # vals['tax_id'] = voucher_obj.tax_id.id |
16 | 136 | # vals['amount'] = sale_obj.amount_total | 136 | # vals['amount'] = sale_obj.amount_total |
17 | 137 | # vals['company_id'] = journal_obj.company_id.id | 137 | # vals['company_id'] = journal_obj.company_id.id |
18 | 138 | # voucher_id = self.pool.get('account.voucher').create(cr,uid,vals,context) | 138 | # voucher_id = self.pool.get('account.voucher').create(cr,uid,vals,context) |
19 | @@ -153,9 +153,9 @@ | |||
20 | 153 | acc_voucher_obj = voucher_obj.browse(cr, uid, ids, context={'cc_no':'no_mask'}) | 153 | acc_voucher_obj = voucher_obj.browse(cr, uid, ids, context={'cc_no':'no_mask'}) |
21 | 154 | user = self.pool.get('res.users').browse(cr, uid, uid) | 154 | user = self.pool.get('res.users').browse(cr, uid, uid) |
22 | 155 | 155 | ||
26 | 156 | creditcard = acc_voucher_obj.cc_number# CREDIT CARD NUMBER | 156 | creditcard = acc_voucher_obj.cc_number # CREDIT CARD NUMBER |
27 | 157 | expiration = acc_voucher_obj.cc_e_d_month + acc_voucher_obj.cc_e_d_year ################ EXPIRATION DATE MM + YY | 157 | expiration = acc_voucher_obj.cc_e_d_month + acc_voucher_obj.cc_e_d_year ################ EXPIRATION DATE MM + YY |
28 | 158 | total = acc_voucher_obj.cc_order_amt ############## ORDER AMOUNT | 158 | total = acc_voucher_obj.cc_order_amt ############## ORDER AMOUNT |
29 | 159 | 159 | ||
30 | 160 | if acc_voucher_obj.cc_save_card_details: | 160 | if acc_voucher_obj.cc_save_card_details: |
31 | 161 | if not acc_voucher_obj.cc_bank: | 161 | if not acc_voucher_obj.cc_bank: |
32 | @@ -164,10 +164,10 @@ | |||
33 | 164 | if not partner_bank_obj.search(cr, uid, [('cc_number', '=', creditcard), ('partner_id', '=', acc_voucher_obj.partner_id.id)]): | 164 | if not partner_bank_obj.search(cr, uid, [('cc_number', '=', creditcard), ('partner_id', '=', acc_voucher_obj.partner_id.id)]): |
34 | 165 | state_id = country_id = False | 165 | state_id = country_id = False |
35 | 166 | if acc_voucher_obj.cc_state: | 166 | if acc_voucher_obj.cc_state: |
37 | 167 | state_ids = self.pool.get('res.country.state').search(cr, uid, [('name','=',acc_voucher_obj.cc_state)]) | 167 | state_ids = self.pool.get('res.country.state').search(cr, uid, [('name', '=', acc_voucher_obj.cc_state)]) |
38 | 168 | state_id = state_ids and state_ids[0] or False | 168 | state_id = state_ids and state_ids[0] or False |
39 | 169 | if acc_voucher_obj.cc_country: | 169 | if acc_voucher_obj.cc_country: |
41 | 170 | country_ids = self.pool.get('res.country').search(cr, uid, [('name','=',acc_voucher_obj.cc_country)]) | 170 | country_ids = self.pool.get('res.country').search(cr, uid, [('name', '=', acc_voucher_obj.cc_country)]) |
42 | 171 | country_id = country_ids and country_ids[0] or False | 171 | country_id = country_ids and country_ids[0] or False |
43 | 172 | part = acc_voucher_obj.partner_id.id | 172 | part = acc_voucher_obj.partner_id.id |
44 | 173 | if acc_voucher_obj.partner_id.parent_id: | 173 | if acc_voucher_obj.partner_id.parent_id: |
45 | @@ -181,7 +181,7 @@ | |||
46 | 181 | 'bank':acc_voucher_obj.cc_bank.id, | 181 | 'bank':acc_voucher_obj.cc_bank.id, |
47 | 182 | 'cc_v':acc_voucher_obj.cc_v, | 182 | 'cc_v':acc_voucher_obj.cc_v, |
48 | 183 | 'owner_name':acc_voucher_obj.cc_name, | 183 | 'owner_name':acc_voucher_obj.cc_name, |
50 | 184 | 'street':str(acc_voucher_obj.cc_b_addr_1) +'-'+ str(acc_voucher_obj.cc_b_addr_2), | 184 | 'street':str(acc_voucher_obj.cc_b_addr_1) + '-' + str(acc_voucher_obj.cc_b_addr_2), |
51 | 185 | 'city': acc_voucher_obj.cc_city, | 185 | 'city': acc_voucher_obj.cc_city, |
52 | 186 | 'zip': acc_voucher_obj.cc_zip, | 186 | 'zip': acc_voucher_obj.cc_zip, |
53 | 187 | 'state_id': state_id, | 187 | 'state_id': state_id, |
54 | @@ -219,13 +219,13 @@ | |||
55 | 219 | 219 | ||
56 | 220 | if str(login).strip() == '' or login == None: | 220 | if str(login).strip() == '' or login == None: |
57 | 221 | raise osv.except_osv(_('Error'), _("No login name provided")) | 221 | raise osv.except_osv(_('Error'), _("No login name provided")) |
59 | 222 | #raise AuthnetAIMError('No login name provided') | 222 | # raise AuthnetAIMError('No login name provided') |
60 | 223 | if str(transkey).strip() == '' or transkey == None: | 223 | if str(transkey).strip() == '' or transkey == None: |
61 | 224 | raise osv.except_osv(_('Error'), _("No transaction key provided")) | 224 | raise osv.except_osv(_('Error'), _("No transaction key provided")) |
63 | 225 | #raise AuthnetAIMError('No transaction key provided') | 225 | # raise AuthnetAIMError('No transaction key provided') |
64 | 226 | if testmode != True and testmode != False: | 226 | if testmode != True and testmode != False: |
65 | 227 | raise osv.except_osv(_('Error'), _("Invalid value for testmode. Must be True or False. ")) | 227 | raise osv.except_osv(_('Error'), _("Invalid value for testmode. Must be True or False. ")) |
67 | 228 | #raise AuthnetAIMError('Invalid value for testmode. Must be True or False. "{0}" given.'.format(testmode)) | 228 | # raise AuthnetAIMError('Invalid value for testmode. Must be True or False. "{0}" given.'.format(testmode)) |
68 | 229 | 229 | ||
69 | 230 | parameters = {} | 230 | parameters = {} |
70 | 231 | proxy = None | 231 | proxy = None |
71 | @@ -247,24 +247,24 @@ | |||
72 | 247 | parameters = voucher_obj.setParameter(parameters, 'x_login', login) | 247 | parameters = voucher_obj.setParameter(parameters, 'x_login', login) |
73 | 248 | parameters = voucher_obj.setParameter(parameters, 'x_tran_key', transkey) | 248 | parameters = voucher_obj.setParameter(parameters, 'x_tran_key', transkey) |
74 | 249 | 249 | ||
76 | 250 | if acc_voucher_obj.cc_charge and x_type !='CREDIT': | 250 | if acc_voucher_obj.cc_charge and x_type != 'CREDIT': |
77 | 251 | parameters = voucher_obj.setParameter(parameters, 'x_auth_code', acc_voucher_obj.cc_auth_code) | 251 | parameters = voucher_obj.setParameter(parameters, 'x_auth_code', acc_voucher_obj.cc_auth_code) |
78 | 252 | 252 | ||
81 | 253 | #PreAuth is done, so sending x_trans_id for capture | 253 | # PreAuth is done, so sending x_trans_id for capture |
82 | 254 | if x_type in ['PRIOR_AUTH_CAPTURE','CREDIT']: | 254 | if x_type in ['PRIOR_AUTH_CAPTURE', 'CREDIT']: |
83 | 255 | parameters = voucher_obj.setParameter(parameters, 'x_trans_id', acc_voucher_obj.cc_trans_id) | 255 | parameters = voucher_obj.setParameter(parameters, 'x_trans_id', acc_voucher_obj.cc_trans_id) |
84 | 256 | 256 | ||
85 | 257 | ########## setTransaction | 257 | ########## setTransaction |
86 | 258 | if str(creditcard).strip() == '' or creditcard == None: | 258 | if str(creditcard).strip() == '' or creditcard == None: |
87 | 259 | raise osv.except_osv(_('Error'), _("No credit card number passed to setTransaction()")) | 259 | raise osv.except_osv(_('Error'), _("No credit card number passed to setTransaction()")) |
89 | 260 | #raise AuthnetAIMError('No credit card number passed to setTransaction(): {0}').format(creditcard) | 260 | # raise AuthnetAIMError('No credit card number passed to setTransaction(): {0}').format(creditcard) |
90 | 261 | if str(expiration).strip() == '' or expiration == None: | 261 | if str(expiration).strip() == '' or expiration == None: |
91 | 262 | raise osv.except_osv(_('Error'), _("No expiration number to setTransaction()")) | 262 | raise osv.except_osv(_('Error'), _("No expiration number to setTransaction()")) |
93 | 263 | #raise AuthnetAIMError('No expiration number to setTransaction(): {0}').format(expiration) | 263 | # raise AuthnetAIMError('No expiration number to setTransaction(): {0}').format(expiration) |
94 | 264 | if str(total).strip() == '' or total == None: | 264 | if str(total).strip() == '' or total == None: |
95 | 265 | raise osv.except_osv(_('Error'), _("No total amount passed to setTransaction()")) | 265 | raise osv.except_osv(_('Error'), _("No total amount passed to setTransaction()")) |
96 | 266 | 266 | ||
98 | 267 | #raise AuthnetAIMError('No total amount passed to setTransaction(): {0}').format(total) | 267 | # raise AuthnetAIMError('No total amount passed to setTransaction(): {0}').format(total) |
99 | 268 | 268 | ||
100 | 269 | parameters = voucher_obj.setParameter(parameters, 'x_card_num', creditcard) | 269 | parameters = voucher_obj.setParameter(parameters, 'x_card_num', creditcard) |
101 | 270 | parameters = voucher_obj.setParameter(parameters, 'x_exp_date', expiration) | 270 | parameters = voucher_obj.setParameter(parameters, 'x_exp_date', expiration) |
102 | @@ -331,13 +331,13 @@ | |||
103 | 331 | ret_dic['cc_trans_id'] = results[6] | 331 | ret_dic['cc_trans_id'] = results[6] |
104 | 332 | ret_dic['cc_transaction'] = True | 332 | ret_dic['cc_transaction'] = True |
105 | 333 | voucher_obj.write(cr, uid, ids, ret_dic) | 333 | voucher_obj.write(cr, uid, ids, ret_dic) |
107 | 334 | voucher_obj._historise(cr, uid, acc_voucher_obj.id, 'Capture',trans_id=results[6], status=status, amount=acc_voucher_obj.cc_order_amt) | 334 | voucher_obj._historise(cr, uid, acc_voucher_obj.id, 'Capture', trans_id=results[6], status=status, amount=acc_voucher_obj.cc_order_amt) |
108 | 335 | cr.commit() | 335 | cr.commit() |
109 | 336 | if results[0] == '1': | 336 | if results[0] == '1': |
110 | 337 | ''' | 337 | ''' |
111 | 338 | Validating sales receipt | 338 | Validating sales receipt |
112 | 339 | ''' | 339 | ''' |
114 | 340 | #self.validate_sales_reciept(cr, uid, ids, context=context) | 340 | # self.validate_sales_reciept(cr, uid, ids, context=context) |
115 | 341 | ''' | 341 | ''' |
116 | 342 | Posting payment voucher | 342 | Posting payment voucher |
117 | 343 | ''' | 343 | ''' |
118 | @@ -348,11 +348,11 @@ | |||
119 | 348 | elif x_type == 'CREDIT': | 348 | elif x_type == 'CREDIT': |
120 | 349 | status = 'Refund: ' + str(results[3]) | 349 | status = 'Refund: ' + str(results[3]) |
121 | 350 | ret_dic['cc_status'] = status | 350 | ret_dic['cc_status'] = status |
123 | 351 | voucher_obj._historise(cr, uid, acc_voucher_obj.id, 'Refund',trans_id=results[6], status=status, amount=acc_voucher_obj.cc_refund_amt) | 351 | voucher_obj._historise(cr, uid, acc_voucher_obj.id, 'Refund', trans_id=results[6], status=status, amount=acc_voucher_obj.cc_refund_amt) |
124 | 352 | if results[0] == '1': | 352 | if results[0] == '1': |
125 | 353 | ret_dic['cc_transaction'] = False | 353 | ret_dic['cc_transaction'] = False |
128 | 354 | #Domain : [('type','=','out_refund')] | 354 | # Domain : [('type','=','out_refund')] |
129 | 355 | #Context: {'type':'out_refund', 'journal_type': 'sale_refund'} | 355 | # Context: {'type':'out_refund', 'journal_type': 'sale_refund'} |
130 | 356 | refund_journal_id = False | 356 | refund_journal_id = False |
131 | 357 | j_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'sale_refund')], context=context) | 357 | j_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'sale_refund')], context=context) |
132 | 358 | if j_ids: | 358 | if j_ids: |
133 | @@ -372,7 +372,7 @@ | |||
134 | 372 | # inv_vals['sale_account_id'] = ship_method.account_id and ship_method.account_id.id, | 372 | # inv_vals['sale_account_id'] = ship_method.account_id and ship_method.account_id.id, |
135 | 373 | inv_vals.update(invoice_obj.onchange_partner_id(cr, uid, [], 'out_refund', acc_voucher_obj.partner_id.id, '', '', '', '')['value']) | 373 | inv_vals.update(invoice_obj.onchange_partner_id(cr, uid, [], 'out_refund', acc_voucher_obj.partner_id.id, '', '', '', '')['value']) |
136 | 374 | inv_lines = [] | 374 | inv_lines = [] |
138 | 375 | refund_lines = context.get('cc_refund',[]) | 375 | refund_lines = context.get('cc_refund', []) |
139 | 376 | for line in refund_lines: | 376 | for line in refund_lines: |
140 | 377 | 377 | ||
141 | 378 | inv_line_vals = { | 378 | inv_line_vals = { |
142 | @@ -388,104 +388,6 @@ | |||
143 | 388 | 388 | ||
144 | 389 | invoice_id = invoice_obj.create(cr, uid, inv_vals, context=context) | 389 | invoice_id = invoice_obj.create(cr, uid, inv_vals, context=context) |
145 | 390 | wf_service.trg_validate(uid, 'account.invoice', invoice_id, 'invoice_open', cr) | 390 | wf_service.trg_validate(uid, 'account.invoice', invoice_id, 'invoice_open', cr) |
146 | 391 | |||
147 | 392 | # ret = True | ||
148 | 393 | # voucher_obj = self.pool.get('account.voucher') | ||
149 | 394 | # | ||
150 | 395 | # | ||
151 | 396 | # refund_journal_id = False | ||
152 | 397 | # if user.company_id.cc_refund_journal_id: | ||
153 | 398 | # refund_journal_id = user.company_id.cc_refund_journal_id.id | ||
154 | 399 | # else | ||
155 | 400 | # j_ids = self.pool.get('account.journal').search(cr, uid, [('type','=','sale_refund')], context=context) | ||
156 | 401 | # if j_ids: | ||
157 | 402 | # refund_journal_id = j_ids[0] | ||
158 | 403 | # | ||
159 | 404 | # account_id=False | ||
160 | 405 | # if refund_journal_id: | ||
161 | 406 | # default_debit_account_id = self.pool.get('account.journal').browse(cr, uid, refund_journal_id,context=context).default_debit_account_id.id | ||
162 | 407 | # | ||
163 | 408 | # | ||
164 | 409 | # vals1 = { | ||
165 | 410 | # | ||
166 | 411 | # 'name' : 'Refund : ' + (acc_voucher_obj.rel_sale_order_id and str(acc_voucher_obj.rel_sale_order_id.name) or ''), | ||
167 | 412 | # 'account_id' : default_debit_account_id, | ||
168 | 413 | # 'partner_id' : acc_voucher_obj.partner_id.id, | ||
169 | 414 | # 'amount' : acc_voucher_obj.cc_order_amt, | ||
170 | 415 | # 'currency_id' : user.company_id.currency_id.id, | ||
171 | 416 | # 'origin':acc_voucher_obj.rel_sale_order_id and acc_voucher_obj.rel_sale_order_id.name or '' | ||
172 | 417 | # } | ||
173 | 418 | # | ||
174 | 419 | # | ||
175 | 420 | # vals = voucher_obj.onchange_partner_id(cr, uid, [], acc_voucher_obj.partner_id.id, refund_journal_id , acc_voucher_obj.cc_order_amt , user.company_id.currency_id.id, 'sale', time()) | ||
176 | 421 | # | ||
177 | 422 | # vals.update(vals1) | ||
178 | 423 | # | ||
179 | 424 | # vals['journal_id'] = refund_journal_id | ||
180 | 425 | # vals['type'] = 'sale' | ||
181 | 426 | # | ||
182 | 427 | # | ||
183 | 428 | # | ||
184 | 429 | # | ||
185 | 430 | # voucher_id = voucher_obj.create(cr, uid, vals, context=context) | ||
186 | 431 | # | ||
187 | 432 | # | ||
188 | 433 | # if acc_voucher_obj.cc_order_amt == acc_voucher_obj.rel_sale_order_id.amount_total and acc_voucher_obj.rel_sale_order_id.shipcharge: | ||
189 | 434 | # self.pool.get('sale.order').write(cr, uid, [acc_voucher_obj.rel_sale_order_id.id],{'cc_ship_refund':True},context=context) | ||
190 | 435 | # | ||
191 | 436 | # refund_voucher=False | ||
192 | 437 | # if 'cc_refund' not in context: | ||
193 | 438 | # refund_voucher=True | ||
194 | 439 | # sales_receipt_ids = voucher_obj.search(cr,uid,[('rel_sale_order_id','=',acc_voucher_obj.rel_sale_order_id.id),('state','=','posted'),('type','=','sale')], order="id desc",context=context) | ||
195 | 440 | # | ||
196 | 441 | # for receipt in voucher_obj.browse(cr, uid, sales_receipt_ids, context): | ||
197 | 442 | # | ||
198 | 443 | # for line in receipt.line_ids: | ||
199 | 444 | # | ||
200 | 445 | # if line.amount: | ||
201 | 446 | # vals = { | ||
202 | 447 | # 'voucher_id': voucher_id, | ||
203 | 448 | # 'name' : line.name, | ||
204 | 449 | # 'account_id' : line.account_id.id, | ||
205 | 450 | # 'partner_id' : line.partner_id.id, | ||
206 | 451 | # 'amount' : line.amount, | ||
207 | 452 | # 'type': line.type, | ||
208 | 453 | # | ||
209 | 454 | # } | ||
210 | 455 | # line_id = self.pool.get('account.voucher.line').create(cr, uid, vals, context) | ||
211 | 456 | # break | ||
212 | 457 | # else: | ||
213 | 458 | # for line in context['cc_refund']: | ||
214 | 459 | # product=self.pool.get('product.product').browse(cr, uid, line['product_id'],context) | ||
215 | 460 | # | ||
216 | 461 | # vals = { | ||
217 | 462 | # 'voucher_id': voucher_id, | ||
218 | 463 | # 'name' : product.name, | ||
219 | 464 | # 'account_id' : product.product_tmpl_id.property_account_income.id, | ||
220 | 465 | # 'partner_id' : acc_voucher_obj.partner_id.id, | ||
221 | 466 | # 'amount' : product.list_price * line['qty'], | ||
222 | 467 | # 'type' : 'cr', | ||
223 | 468 | # } | ||
224 | 469 | # line_id = self.pool.get('account.voucher.line').create(cr, uid, vals, context) | ||
225 | 470 | # if context.get('cc_ship_refund'): | ||
226 | 471 | # vals = { | ||
227 | 472 | # 'voucher_id': voucher_id, | ||
228 | 473 | # 'name' : 'Shipping Charges of ' + acc_voucher_obj.rel_sale_order_id.name, | ||
229 | 474 | # 'account_id' : acc_voucher_obj.rel_sale_order_id.ship_method_id and acc_voucher_obj.rel_sale_order_id.ship_method_id.account_id.id or False, | ||
230 | 475 | # 'partner_id' : acc_voucher_obj.partner_id.id, | ||
231 | 476 | # 'amount' : context['cc_ship_refund'], | ||
232 | 477 | # 'type' : 'cr', | ||
233 | 478 | # } | ||
234 | 479 | # line_id = self.pool.get('account.voucher.line').create(cr, uid, vals, context) | ||
235 | 480 | # self.pool.get('sale.order').write(cr, uid, [acc_voucher_obj.rel_sale_order_id.id],{'cc_ship_refund':True},context=context) | ||
236 | 481 | # | ||
237 | 482 | # # if x_type == 'CAPTURE_ONLY': | ||
238 | 483 | # status = "Capture: " + str(results[3]) | ||
239 | 484 | # ret_dic['cc_status'] = status | ||
240 | 485 | # voucher_obj.write(cr, uid, ids, ret_dic) | ||
241 | 486 | # if not refund_voucher: | ||
242 | 487 | # wf_service = netsvc.LocalService('workflow') | ||
243 | 488 | # wf_service.trg_validate(uid, 'account.voucher', voucher_id, 'proforma_voucher', cr) | ||
244 | 489 | 391 | ||
245 | 490 | else: | 392 | else: |
246 | 491 | ret_dic['cc_transaction'] = True | 393 | ret_dic['cc_transaction'] = True |
247 | @@ -505,7 +407,7 @@ | |||
248 | 505 | ''' | 407 | ''' |
249 | 506 | 408 | ||
250 | 507 | def check_transaction(self, cr, uid, ids, context=None): | 409 | def check_transaction(self, cr, uid, ids, context=None): |
252 | 508 | transaction_record = self.browse( cr, uid, ids,context) | 410 | transaction_record = self.browse(cr, uid, ids, context) |
253 | 509 | for record in transaction_record: | 411 | for record in transaction_record: |
254 | 510 | if record.cc_p_authorize and record.cc_auth_code: | 412 | if record.cc_p_authorize and record.cc_auth_code: |
255 | 511 | raise osv.except_osv(_('Error'), _("Already Authorized!")) | 413 | raise osv.except_osv(_('Error'), _("Already Authorized!")) |
256 | @@ -550,7 +452,7 @@ | |||
257 | 550 | journal_obj = self.pool.get('account.journal').browse(cr, uid, journal_ids[0]) | 452 | journal_obj = self.pool.get('account.journal').browse(cr, uid, journal_ids[0]) |
258 | 551 | if sale_obj and sale_obj.order_line: | 453 | if sale_obj and sale_obj.order_line: |
259 | 552 | for sale_line in sale_obj.order_line: | 454 | for sale_line in sale_obj.order_line: |
261 | 553 | cr_ids['account_id'] = self._get_prod_acc(sale_line.product_id and sale_line.product_id, journal_obj)#journal_obj.default_debit_account_id.id #Change this account to product's income account | 455 | cr_ids['account_id'] = self._get_prod_acc(sale_line.product_id and sale_line.product_id, journal_obj) # journal_obj.default_debit_account_id.id #Change this account to product's income account |
262 | 554 | cr_ids['amount'] = sale_line.price_subtotal | 456 | cr_ids['amount'] = sale_line.price_subtotal |
263 | 555 | cr_ids['partner_id'] = sale_obj.partner_id.id | 457 | cr_ids['partner_id'] = sale_obj.partner_id.id |
264 | 556 | cr_ids['name'] = sale_line.name | 458 | cr_ids['name'] = sale_line.name |
265 | @@ -565,7 +467,7 @@ | |||
266 | 565 | else: | 467 | else: |
267 | 566 | vals['journal_id'] = False | 468 | vals['journal_id'] = False |
268 | 567 | vals['partner_id'] = sale_obj.partner_id.id | 469 | vals['partner_id'] = sale_obj.partner_id.id |
270 | 568 | #vals['date'] = sale_obj.date_order | 470 | # vals['date'] = sale_obj.date_order |
271 | 569 | vals['rel_sale_order_id'] = ids[0] | 471 | vals['rel_sale_order_id'] = ids[0] |
272 | 570 | vals['name'] = 'Auto generated Sales Receipt' | 472 | vals['name'] = 'Auto generated Sales Receipt' |
273 | 571 | vals['type'] = 'sale' | 473 | vals['type'] = 'sale' |
274 | @@ -588,7 +490,7 @@ | |||
275 | 588 | ret = super(sale_order, self).action_wait(cr, uid, ids, context=context) | 490 | ret = super(sale_order, self).action_wait(cr, uid, ids, context=context) |
276 | 589 | for o in self.browse(cr, uid, ids, context=context): | 491 | for o in self.browse(cr, uid, ids, context=context): |
277 | 590 | if (o.order_policy == 'credit_card'): | 492 | if (o.order_policy == 'credit_card'): |
279 | 591 | #self.create_sales_reciept(cr, uid, [o.id]) | 493 | # self.create_sales_reciept(cr, uid, [o.id]) |
280 | 592 | invoice_id = self.action_invoice_create(cr, uid, [o.id], context=context) | 494 | invoice_id = self.action_invoice_create(cr, uid, [o.id], context=context) |
281 | 593 | wf_service = netsvc.LocalService('workflow') | 495 | wf_service = netsvc.LocalService('workflow') |
282 | 594 | wf_service.trg_validate(uid, 'account.invoice', invoice_id, 'invoice_open', cr) | 496 | wf_service.trg_validate(uid, 'account.invoice', invoice_id, 'invoice_open', cr) |
283 | 595 | 497 | ||
284 | === modified file 'account_payment_ccapi_authdotnet/stock_return_picking.py' | |||
285 | --- account_payment_ccapi_authdotnet/stock_return_picking.py 2014-01-09 18:15:04 +0000 | |||
286 | +++ account_payment_ccapi_authdotnet/stock_return_picking.py 2014-08-07 15:27:11 +0000 | |||
287 | @@ -28,7 +28,7 @@ | |||
288 | 28 | _inherit = 'stock.return.picking' | 28 | _inherit = 'stock.return.picking' |
289 | 29 | _columns = { | 29 | _columns = { |
290 | 30 | 'cc_ship_refund' : fields.boolean(string='Refund Shipcharge', required=True), | 30 | 'cc_ship_refund' : fields.boolean(string='Refund Shipcharge', required=True), |
292 | 31 | 'invoice_state': fields.selection([('2binvoiced', 'To be refunded/invoiced'), ('none', 'No invoicing'),('cc_refund','Credit Card Refund')], 'Invoicing',required=True), | 31 | 'invoice_state': fields.selection([('2binvoiced', 'To be refunded/invoiced'), ('none', 'No invoicing'), ('cc_refund', 'Credit Card Refund')], 'Invoicing', required=True), |
293 | 32 | } | 32 | } |
294 | 33 | 33 | ||
295 | 34 | def default_get(self, cr, uid, fields, context=None): | 34 | def default_get(self, cr, uid, fields, context=None): |
296 | @@ -79,7 +79,7 @@ | |||
297 | 79 | res = super(stock_return_picking, self).create_returns(cr, uid, ids, context) | 79 | res = super(stock_return_picking, self).create_returns(cr, uid, ids, context) |
298 | 80 | 80 | ||
299 | 81 | move_lines = data['product_return_moves'] | 81 | move_lines = data['product_return_moves'] |
301 | 82 | #@ Moving the refund process to On Delivery process of related incoming shipment | 82 | # @ Moving the refund process to On Delivery process of related incoming shipment |
302 | 83 | if data['invoice_state'] == 'cc_refund': | 83 | if data['invoice_state'] == 'cc_refund': |
303 | 84 | amount = 0.00 | 84 | amount = 0.00 |
304 | 85 | for move in move_lines: | 85 | for move in move_lines: |
305 | @@ -136,11 +136,11 @@ | |||
306 | 136 | amount = 0.00 | 136 | amount = 0.00 |
307 | 137 | vch_lines = [] | 137 | vch_lines = [] |
308 | 138 | Lines = pick.move_lines | 138 | Lines = pick.move_lines |
310 | 139 | if pick.backorder_id.id and pick.state=='assigned': | 139 | if pick.backorder_id.id and pick.state == 'assigned': |
311 | 140 | Lines = pick.backorder_id.move_lines | 140 | Lines = pick.backorder_id.move_lines |
312 | 141 | for move in Lines: | 141 | for move in Lines: |
315 | 142 | partial_data = partial_datas.get('move%s'%(move.id), {}) | 142 | partial_data = partial_datas.get('move%s' % (move.id), {}) |
316 | 143 | new_qty = partial_data.get('product_qty',0.0) | 143 | new_qty = partial_data.get('product_qty', 0.0) |
317 | 144 | line = {} | 144 | line = {} |
318 | 145 | if IN: | 145 | if IN: |
319 | 146 | line['product_id'] = move.product_id.id | 146 | line['product_id'] = move.product_id.id |
320 | @@ -162,7 +162,7 @@ | |||
321 | 162 | if sale and sale.payment_method == 'cc_pre_auth' and not sale.invoiced: | 162 | if sale and sale.payment_method == 'cc_pre_auth' and not sale.invoiced: |
322 | 163 | rel_voucher = sale.rel_account_voucher_id or False | 163 | rel_voucher = sale.rel_account_voucher_id or False |
323 | 164 | if rel_voucher and rel_voucher.state != 'posted' and rel_voucher.cc_auth_code: | 164 | if rel_voucher and rel_voucher.state != 'posted' and rel_voucher.cc_auth_code: |
325 | 165 | vals_vouch = {'cc_order_amt': amount,'cc_p_authorize': False, 'cc_charge': True} | 165 | vals_vouch = {'cc_order_amt': amount, 'cc_p_authorize': False, 'cc_charge': True} |
326 | 166 | if 'trans_type' in rel_voucher._columns.keys(): | 166 | if 'trans_type' in rel_voucher._columns.keys(): |
327 | 167 | vals_vouch.update({'trans_type': 'PriorAuthCapture'}) | 167 | vals_vouch.update({'trans_type': 'PriorAuthCapture'}) |
328 | 168 | voucher_obj.write(cr, uid, [rel_voucher.id], vals_vouch, context=context) | 168 | voucher_obj.write(cr, uid, [rel_voucher.id], vals_vouch, context=context) |
329 | @@ -176,4 +176,4 @@ | |||
330 | 176 | 176 | ||
331 | 177 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | 177 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
332 | 178 | 178 | ||
333 | 179 | |||
334 | 180 | \ No newline at end of file | 179 | \ No newline at end of file |
335 | 180 | |||
336 | 181 | 181 | ||
337 | === modified file 'account_payment_creditcard/account_journal.py' | |||
338 | --- account_payment_creditcard/account_journal.py 2014-01-09 18:15:04 +0000 | |||
339 | +++ account_payment_creditcard/account_journal.py 2014-08-07 15:27:11 +0000 | |||
340 | @@ -36,8 +36,8 @@ | |||
341 | 36 | _inherit = "res.partner" | 36 | _inherit = "res.partner" |
342 | 37 | 37 | ||
343 | 38 | def write(self, cr, uid, ids, vals, context=None): | 38 | def write(self, cr, uid, ids, vals, context=None): |
346 | 39 | if vals.get('bank_ids',[]) and len(vals['bank_ids'][0]) == 3 and vals['bank_ids'][0][2] : | 39 | if vals.get('bank_ids', []) and len(vals['bank_ids'][0]) == 3 and vals['bank_ids'][0][2] : |
347 | 40 | if vals['bank_ids'][0][2].get('cc_number',False): | 40 | if vals['bank_ids'][0][2].get('cc_number', False): |
348 | 41 | if ('XXXXXXXXX' in vals['bank_ids'][0][2]['cc_number']): | 41 | if ('XXXXXXXXX' in vals['bank_ids'][0][2]['cc_number']): |
349 | 42 | if vals.get('cc_number'): | 42 | if vals.get('cc_number'): |
350 | 43 | del vals['cc_number'] | 43 | del vals['cc_number'] |
351 | @@ -52,7 +52,7 @@ | |||
352 | 52 | _inherit = "res.partner.bank" | 52 | _inherit = "res.partner.bank" |
353 | 53 | 53 | ||
354 | 54 | _columns = { | 54 | _columns = { |
356 | 55 | 'cc_number':fields.char('Credit Card Number', size=256),#Given size 256 because the credit card is stored as encrypted format. | 55 | 'cc_number':fields.char('Credit Card Number', size=256), # Given size 256 because the credit card is stored as encrypted format. |
357 | 56 | 'cc_e_d_month':fields.char('Expiration Date MM', size=32), | 56 | 'cc_e_d_month':fields.char('Expiration Date MM', size=32), |
358 | 57 | 'cc_e_d_year':fields.char('Expiration Date YY', size=32), | 57 | 'cc_e_d_year':fields.char('Expiration Date YY', size=32), |
359 | 58 | 'cc_v':fields.char('Card Code Verification', size=3), | 58 | 'cc_v':fields.char('Card Code Verification', size=3), |
360 | @@ -94,7 +94,7 @@ | |||
361 | 94 | if context is None: | 94 | if context is None: |
362 | 95 | context = {} | 95 | context = {} |
363 | 96 | context.update({'cc_no':'no_mask'}) | 96 | context.update({'cc_no':'no_mask'}) |
365 | 97 | if not isinstance(ids,list): | 97 | if not isinstance(ids, list): |
366 | 98 | ids = [ids] | 98 | ids = [ids] |
367 | 99 | for record in self.browse(cr, uid, ids, context=context): | 99 | for record in self.browse(cr, uid, ids, context=context): |
368 | 100 | if vals.get('cc_number', False): | 100 | if vals.get('cc_number', False): |
369 | @@ -159,4 +159,4 @@ | |||
370 | 159 | 159 | ||
371 | 160 | res_partner_bank() | 160 | res_partner_bank() |
372 | 161 | 161 | ||
373 | 162 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
374 | 163 | \ No newline at end of file | 162 | \ No newline at end of file |
375 | 163 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
376 | 164 | 164 | ||
377 | === modified file 'account_payment_creditcard/account_voucher.py' | |||
378 | --- account_payment_creditcard/account_voucher.py 2014-01-09 18:15:04 +0000 | |||
379 | +++ account_payment_creditcard/account_voucher.py 2014-08-07 15:27:11 +0000 | |||
380 | @@ -124,7 +124,7 @@ | |||
381 | 124 | if context is None: | 124 | if context is None: |
382 | 125 | context = {} | 125 | context = {} |
383 | 126 | context.update({'cc_no':'no_mask'}) | 126 | context.update({'cc_no':'no_mask'}) |
385 | 127 | if not isinstance(ids,list): | 127 | if not isinstance(ids, list): |
386 | 128 | ids = [ids] | 128 | ids = [ids] |
387 | 129 | for record in self.browse(cr, uid, ids, context=context): | 129 | for record in self.browse(cr, uid, ids, context=context): |
388 | 130 | if vals.get('cc_number', False): | 130 | if vals.get('cc_number', False): |
389 | @@ -222,7 +222,7 @@ | |||
390 | 222 | 'cc_zip':fields.char('Postal/Zip', size=32,), | 222 | 'cc_zip':fields.char('Postal/Zip', size=32,), |
391 | 223 | 'cc_country':fields.char('Country', size=32,), | 223 | 'cc_country':fields.char('Country', size=32,), |
392 | 224 | 'cc_order_date':fields.date('Order Date',), | 224 | 'cc_order_date':fields.date('Order Date',), |
394 | 225 | 'cc_order_amt':fields.float('Order Amt',required=True), | 225 | 'cc_order_amt':fields.float('Order Amt', required=True), |
395 | 226 | 'cc_number':fields.char('Credit Card Number', size=256), | 226 | 'cc_number':fields.char('Credit Card Number', size=256), |
396 | 227 | 'cc_v':fields.char('Card Code Verification', size=3), | 227 | 'cc_v':fields.char('Card Code Verification', size=3), |
397 | 228 | 'cc_e_d_month':fields.char('Expiration Date MM', size=32), | 228 | 'cc_e_d_month':fields.char('Expiration Date MM', size=32), |
398 | @@ -278,7 +278,7 @@ | |||
399 | 278 | cc_allow_refunds = jorurnal_cc_allow = False | 278 | cc_allow_refunds = jorurnal_cc_allow = False |
400 | 279 | cardholder_details = self._get_cardholder_details(cr, uid, ids, partner_id, context=context) | 279 | cardholder_details = self._get_cardholder_details(cr, uid, ids, partner_id, context=context) |
401 | 280 | if journal_id and cardholder_details: | 280 | if journal_id and cardholder_details: |
403 | 281 | journal_read = self.pool.get('account.journal').read(cr, uid, journal_id, ['cc_allow_processing','cc_allow_refunds']) | 281 | journal_read = self.pool.get('account.journal').read(cr, uid, journal_id, ['cc_allow_processing', 'cc_allow_refunds']) |
404 | 282 | jorurnal_cc_allow = journal_read['cc_allow_processing'] | 282 | jorurnal_cc_allow = journal_read['cc_allow_processing'] |
405 | 283 | cc_allow_refunds = journal_read['cc_allow_refunds'] | 283 | cc_allow_refunds = journal_read['cc_allow_refunds'] |
406 | 284 | res['value']['cc_name'] = cardholder_details['name'] | 284 | res['value']['cc_name'] = cardholder_details['name'] |
407 | @@ -349,12 +349,12 @@ | |||
408 | 349 | journal_pool = self.pool.get('account.journal') | 349 | journal_pool = self.pool.get('account.journal') |
409 | 350 | line_pool = self.pool.get('account.voucher.line') | 350 | line_pool = self.pool.get('account.voucher.line') |
410 | 351 | 351 | ||
412 | 352 | #set default values | 352 | # set default values |
413 | 353 | default = { | 353 | default = { |
415 | 354 | 'value': {'line_dr_ids': [] ,'line_cr_ids': [] ,'pre_line': False,}, | 354 | 'value': {'line_dr_ids': [] , 'line_cr_ids': [] , 'pre_line': False, }, |
416 | 355 | } | 355 | } |
417 | 356 | 356 | ||
419 | 357 | #drop existing lines | 357 | # drop existing lines |
420 | 358 | line_ids = ids and line_pool.search(cr, uid, [('voucher_id', '=', ids[0])]) or False | 358 | line_ids = ids and line_pool.search(cr, uid, [('voucher_id', '=', ids[0])]) or False |
421 | 359 | if line_ids: | 359 | if line_ids: |
422 | 360 | line_pool.unlink(cr, uid, line_ids) | 360 | line_pool.unlink(cr, uid, line_ids) |
423 | @@ -377,14 +377,14 @@ | |||
424 | 377 | account_type = 'receivable' | 377 | account_type = 'receivable' |
425 | 378 | 378 | ||
426 | 379 | if not context.get('move_line_ids', False): | 379 | if not context.get('move_line_ids', False): |
428 | 380 | ids = move_line_pool.search(cr, uid, [('state','=','valid'), ('account_id.type', '=', account_type), ('reconcile_id', '=', False), ('partner_id', '=', partner_id)], context=context) | 380 | ids = move_line_pool.search(cr, uid, [('state', '=', 'valid'), ('account_id.type', '=', account_type), ('reconcile_id', '=', False), ('partner_id', '=', partner_id)], context=context) |
429 | 381 | else: | 381 | else: |
430 | 382 | ids = context['move_line_ids'] | 382 | ids = context['move_line_ids'] |
431 | 383 | invoice_id = context.get('invoice_id', False) | 383 | invoice_id = context.get('invoice_id', False) |
432 | 384 | company_currency = journal.company_id.currency_id.id | 384 | company_currency = journal.company_id.currency_id.id |
433 | 385 | move_line_found = False | 385 | move_line_found = False |
434 | 386 | 386 | ||
436 | 387 | #order the lines by most old first | 387 | # order the lines by most old first |
437 | 388 | ids.reverse() | 388 | ids.reverse() |
438 | 389 | account_move_lines = move_line_pool.browse(cr, uid, ids, context=context) | 389 | account_move_lines = move_line_pool.browse(cr, uid, ids, context=context) |
439 | 390 | 390 | ||
440 | @@ -393,25 +393,25 @@ | |||
441 | 393 | if context.get('sale_id'): | 393 | if context.get('sale_id'): |
442 | 394 | INV_IDS = [x.id for x in self.pool.get('sale.order').browse(cr, uid, context['sale_id'], context=context).invoice_ids] | 394 | INV_IDS = [x.id for x in self.pool.get('sale.order').browse(cr, uid, context['sale_id'], context=context).invoice_ids] |
443 | 395 | 395 | ||
445 | 396 | #compute the total debit/credit and look for a matching open amount or invoice | 396 | # compute the total debit/credit and look for a matching open amount or invoice |
446 | 397 | for line in account_move_lines: | 397 | for line in account_move_lines: |
447 | 398 | if _remove_noise_in_o2m(): | 398 | if _remove_noise_in_o2m(): |
448 | 399 | continue | 399 | continue |
449 | 400 | 400 | ||
450 | 401 | if INV_IDS: | 401 | if INV_IDS: |
451 | 402 | if line.invoice.id in INV_IDS: | 402 | if line.invoice.id in INV_IDS: |
454 | 403 | #if the invoice linked to the voucher line is equal to the invoice_id in context | 403 | # if the invoice linked to the voucher line is equal to the invoice_id in context |
455 | 404 | #then we assign the amount on that line, whatever the other voucher lines | 404 | # then we assign the amount on that line, whatever the other voucher lines |
456 | 405 | move_line_found = line.id | 405 | move_line_found = line.id |
457 | 406 | break | 406 | break |
458 | 407 | elif currency_id == company_currency: | 407 | elif currency_id == company_currency: |
460 | 408 | #otherwise treatments is the same but with other field names | 408 | # otherwise treatments is the same but with other field names |
461 | 409 | if line.amount_residual == price: | 409 | if line.amount_residual == price: |
464 | 410 | #if the amount residual is equal the amount voucher, we assign it to that voucher | 410 | # if the amount residual is equal the amount voucher, we assign it to that voucher |
465 | 411 | #line, whatever the other voucher lines | 411 | # line, whatever the other voucher lines |
466 | 412 | move_line_found = line.id | 412 | move_line_found = line.id |
467 | 413 | break | 413 | break |
469 | 414 | #otherwise we will split the voucher amount on each line (by most old first) | 414 | # otherwise we will split the voucher amount on each line (by most old first) |
470 | 415 | total_credit += line.credit or 0.0 | 415 | total_credit += line.credit or 0.0 |
471 | 416 | total_debit += line.debit or 0.0 | 416 | total_debit += line.debit or 0.0 |
472 | 417 | elif currency_id == line.currency_id.id: | 417 | elif currency_id == line.currency_id.id: |
473 | @@ -422,7 +422,7 @@ | |||
474 | 422 | total_debit += line.debit and line.amount_currency or 0.0 | 422 | total_debit += line.debit and line.amount_currency or 0.0 |
475 | 423 | 423 | ||
476 | 424 | 424 | ||
478 | 425 | #voucher line creation | 425 | # voucher line creation |
479 | 426 | for line in account_move_lines: | 426 | for line in account_move_lines: |
480 | 427 | if _remove_noise_in_o2m(): | 427 | if _remove_noise_in_o2m(): |
481 | 428 | continue | 428 | continue |
482 | @@ -430,7 +430,7 @@ | |||
483 | 430 | amount_original = abs(line.amount_currency) | 430 | amount_original = abs(line.amount_currency) |
484 | 431 | amount_unreconciled = abs(line.amount_residual_currency) | 431 | amount_unreconciled = abs(line.amount_residual_currency) |
485 | 432 | else: | 432 | else: |
487 | 433 | #always use the amount booked in the company currency as the basis of the conversion into the voucher currency | 433 | # always use the amount booked in the company currency as the basis of the conversion into the voucher currency |
488 | 434 | amount_original = currency_pool.compute(cr, uid, company_currency, currency_id, line.credit or line.debit or 0.0, context=context_multi_currency) | 434 | amount_original = currency_pool.compute(cr, uid, company_currency, currency_id, line.credit or line.debit or 0.0, context=context_multi_currency) |
489 | 435 | amount_unreconciled = currency_pool.compute(cr, uid, company_currency, currency_id, abs(line.amount_residual), context=context_multi_currency) | 435 | amount_unreconciled = currency_pool.compute(cr, uid, company_currency, currency_id, abs(line.amount_residual), context=context_multi_currency) |
490 | 436 | line_currency_id = line.currency_id and line.currency_id.id or company_currency | 436 | line_currency_id = line.currency_id and line.currency_id.id or company_currency |
491 | @@ -446,8 +446,8 @@ | |||
492 | 446 | 'amount_unreconciled': amount_unreconciled, | 446 | 'amount_unreconciled': amount_unreconciled, |
493 | 447 | 'currency_id': line_currency_id, | 447 | 'currency_id': line_currency_id, |
494 | 448 | } | 448 | } |
497 | 449 | #in case a corresponding move_line hasn't been found, we now try to assign the voucher amount | 449 | # in case a corresponding move_line hasn't been found, we now try to assign the voucher amount |
498 | 450 | #on existing invoices: we split voucher amount by most old first, but only for lines in the same currency | 450 | # on existing invoices: we split voucher amount by most old first, but only for lines in the same currency |
499 | 451 | inv_ids = [] | 451 | inv_ids = [] |
500 | 452 | REC = False | 452 | REC = False |
501 | 453 | if line.invoice.id and context.get('sale_id'): | 453 | if line.invoice.id and context.get('sale_id'): |
502 | 454 | 454 | ||
503 | === added directory 'base_nationalacct' | |||
504 | === added file 'base_nationalacct/Change Log.txt' | |||
505 | --- base_nationalacct/Change Log.txt 1970-01-01 00:00:00 +0000 | |||
506 | +++ base_nationalacct/Change Log.txt 2014-08-07 15:27:11 +0000 | |||
507 | @@ -0,0 +1,15 @@ | |||
508 | 1 | =============================================================================== | ||
509 | 2 | Version Change Log (base_jdc) | ||
510 | 3 | =============================================================================== | ||
511 | 4 | 2.00 (2014-08-07) By Serpent Consulting Services Pvt Ltd. | ||
512 | 5 | * Code migration to v7 | ||
513 | 6 | |||
514 | 7 | 1.02 (2012-03-20) By Sinoj | ||
515 | 8 | * Code clean-up | ||
516 | 9 | |||
517 | 10 | 1.01 (2011-01-13) By Sinoj | ||
518 | 11 | * Module is reviewed and comments added | ||
519 | 12 | |||
520 | 13 | 1.0 (2010-11-23) By jabir | ||
521 | 14 | * Created "National Acct Parent" variable in partner and displayed it in tree and form view | ||
522 | 15 | * Displayed parent partner in partner form | ||
523 | 0 | 16 | ||
524 | === added file 'base_nationalacct/__init__.py' | |||
525 | --- base_nationalacct/__init__.py 1970-01-01 00:00:00 +0000 | |||
526 | +++ base_nationalacct/__init__.py 2014-08-07 15:27:11 +0000 | |||
527 | @@ -0,0 +1,26 @@ | |||
528 | 1 | # -*- coding: utf-8 -*- | ||
529 | 2 | ############################################################################## | ||
530 | 3 | # | ||
531 | 4 | # OpenERP, Open Source Management Solution | ||
532 | 5 | # Copyright (C) 2011 NovaPoint Group LLC (<http://www.novapointgroup.com>) | ||
533 | 6 | # Copyright (C) 2004-2010 OpenERP SA (<http://www.openerp.com>) | ||
534 | 7 | # | ||
535 | 8 | # This program is free software: you can redistribute it and/or modify | ||
536 | 9 | # it under the terms of the GNU General Public License as published by | ||
537 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
538 | 11 | # (at your option) any later version. | ||
539 | 12 | # | ||
540 | 13 | # This program is distributed in the hope that it will be useful, | ||
541 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
542 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
543 | 16 | # GNU General Public License for more details. | ||
544 | 17 | # | ||
545 | 18 | # You should have received a copy of the GNU General Public License | ||
546 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/> | ||
547 | 20 | # | ||
548 | 21 | ############################################################################## | ||
549 | 22 | |||
550 | 23 | from . import partner | ||
551 | 24 | |||
552 | 25 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
553 | 26 | |||
554 | 0 | 27 | ||
555 | === added file 'base_nationalacct/__openerp__.py' | |||
556 | --- base_nationalacct/__openerp__.py 1970-01-01 00:00:00 +0000 | |||
557 | +++ base_nationalacct/__openerp__.py 2014-08-07 15:27:11 +0000 | |||
558 | @@ -0,0 +1,43 @@ | |||
559 | 1 | # -*- coding: utf-8 -*- | ||
560 | 2 | ############################################################################## | ||
561 | 3 | # | ||
562 | 4 | # OpenERP, Open Source Management Solution | ||
563 | 5 | # Copyright (C) 2011 NovaPoint Group LLC (<http://www.novapointgroup.com>) | ||
564 | 6 | # Copyright (C) 2004-2010 OpenERP SA (<http://www.openerp.com>) | ||
565 | 7 | # | ||
566 | 8 | # This program is free software: you can redistribute it and/or modify | ||
567 | 9 | # it under the terms of the GNU General Public License as published by | ||
568 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
569 | 11 | # (at your option) any later version. | ||
570 | 12 | # | ||
571 | 13 | # This program is distributed in the hope that it will be useful, | ||
572 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
573 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
574 | 16 | # GNU General Public License for more details. | ||
575 | 17 | # | ||
576 | 18 | # You should have received a copy of the GNU General Public License | ||
577 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/> | ||
578 | 20 | # | ||
579 | 21 | ############################################################################## | ||
580 | 22 | |||
581 | 23 | |||
582 | 24 | { | ||
583 | 25 | 'name': 'Base Modifications', | ||
584 | 26 | 'version': '2.0', | ||
585 | 27 | 'category': 'US Localisation/Account', | ||
586 | 28 | 'description': """ | ||
587 | 29 | This module implements changes to Partner and Company . | ||
588 | 30 | Adds new field National Acct Parent in Partner. | ||
589 | 31 | The parent company can process the invoice of child company if the account is national account | ||
590 | 32 | """, | ||
591 | 33 | 'author': 'NovaPoint Group', | ||
592 | 34 | 'website': 'http://www.novapointgroup.com', | ||
593 | 35 | 'depends': ['account'], | ||
594 | 36 | 'data': [ | ||
595 | 37 | 'partner_view.xml', | ||
596 | 38 | ], | ||
597 | 39 | 'installable': True, | ||
598 | 40 | 'auto_install': False, | ||
599 | 41 | 'certificate': '', | ||
600 | 42 | } | ||
601 | 43 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
602 | 0 | 44 | ||
603 | === added file 'base_nationalacct/partner.py' | |||
604 | --- base_nationalacct/partner.py 1970-01-01 00:00:00 +0000 | |||
605 | +++ base_nationalacct/partner.py 2014-08-07 15:27:11 +0000 | |||
606 | @@ -0,0 +1,89 @@ | |||
607 | 1 | # -*- coding: utf-8 -*- | ||
608 | 2 | ############################################################################## | ||
609 | 3 | # | ||
610 | 4 | # OpenERP, Open Source Management Solution | ||
611 | 5 | # Copyright (C) 2011 NovaPoint Group LLC (<http://www.novapointgroup.com>) | ||
612 | 6 | # Copyright (C) 2004-2010 OpenERP SA (<http://www.openerp.com>) | ||
613 | 7 | # | ||
614 | 8 | # This program is free software: you can redistribute it and/or modify | ||
615 | 9 | # it under the terms of the GNU General Public License as published by | ||
616 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
617 | 11 | # (at your option) any later version. | ||
618 | 12 | # | ||
619 | 13 | # This program is distributed in the hope that it will be useful, | ||
620 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
621 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
622 | 16 | # GNU General Public License for more details. | ||
623 | 17 | # | ||
624 | 18 | # You should have received a copy of the GNU General Public License | ||
625 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/> | ||
626 | 20 | # | ||
627 | 21 | ############################################################################## | ||
628 | 22 | |||
629 | 23 | from openerp.osv import fields, osv | ||
630 | 24 | |||
631 | 25 | class res_partner(osv.Model): | ||
632 | 26 | _inherit = "res.partner" | ||
633 | 27 | |||
634 | 28 | #=========================================================================== | ||
635 | 29 | # Overriding a function defined on account module. | ||
636 | 30 | # This is to include the payable and receivable from child partners if the | ||
637 | 31 | # account is a national account. | ||
638 | 32 | #=========================================================================== | ||
639 | 33 | def _credit_debit_get(self, cr, uid, ids, field_names, arg, context=None): | ||
640 | 34 | """ | ||
641 | 35 | calculating payable and receivable from account moves for the mentioned partners | ||
642 | 36 | """ | ||
643 | 37 | query = self.pool.get('account.move.line')._query_get(cr, uid, context=context) | ||
644 | 38 | cr.execute(""" | ||
645 | 39 | SELECT l.partner_id, a.type, SUM(l.debit-l.credit) | ||
646 | 40 | FROM account_move_line l | ||
647 | 41 | LEFT JOIN account_account a ON (l.account_id=a.id) | ||
648 | 42 | WHERE a.type IN ('receivable','payable') | ||
649 | 43 | AND l.partner_id IN %s | ||
650 | 44 | AND l.reconcile_id IS NULL | ||
651 | 45 | AND """ + query + """ | ||
652 | 46 | GROUP BY l.partner_id, a.type | ||
653 | 47 | """,(tuple(ids), )) | ||
654 | 48 | maps = {'receivable': 'credit', 'payable': 'debit'} | ||
655 | 49 | res = {} | ||
656 | 50 | for id in ids: | ||
657 | 51 | res[id] = dict.fromkeys(field_names, 0) | ||
658 | 52 | for pid, type, val in cr.fetchall(): | ||
659 | 53 | if val is None: val = 0 | ||
660 | 54 | partner = self.browse(cr, uid, pid, context=context) | ||
661 | 55 | #Include the payable and receivable form child partner if the Partner is national account | ||
662 | 56 | if partner.nat_acc_parent: | ||
663 | 57 | res[pid][maps[type]] = (type == 'receivable') and val or -val | ||
664 | 58 | child_partner_ids = self.search(cr, uid, [('parent_id', 'child_of', [partner.id])], context=context) | ||
665 | 59 | if child_partner_ids: | ||
666 | 60 | child_partner_ids.remove(partner.id) | ||
667 | 61 | for val in self.read(cr, uid, child_partner_ids, ['credit', 'debit'], context=context): | ||
668 | 62 | res[pid][maps[type]] += val.get(maps[type], 0) | ||
669 | 63 | else: | ||
670 | 64 | res[pid][maps[type]] = (type == 'receivable') and val or -val | ||
671 | 65 | |||
672 | 66 | return res | ||
673 | 67 | |||
674 | 68 | def _credit_search(self, cr, uid, obj, name, args, context=None): | ||
675 | 69 | """ | ||
676 | 70 | search function for the credit field | ||
677 | 71 | """ | ||
678 | 72 | return self._asset_difference_search(cr, uid, obj, name, 'receivable', args, context=context) | ||
679 | 73 | |||
680 | 74 | def _debit_search(self, cr, uid, obj, name, args, context=None): | ||
681 | 75 | """ | ||
682 | 76 | search function for the debit field | ||
683 | 77 | """ | ||
684 | 78 | return self._asset_difference_search(cr, uid, obj, name, 'payable', args, context=context) | ||
685 | 79 | |||
686 | 80 | _columns = { | ||
687 | 81 | 'credit': fields.function(_credit_debit_get, fnct_search=_credit_search, method=True, string='Total Receivable', multi='dc', | ||
688 | 82 | help="Total amount this customer owes you."), | ||
689 | 83 | 'debit': fields.function(_credit_debit_get, fnct_search=_debit_search, method=True, string='Total Payable', multi='dc', | ||
690 | 84 | help="Total amount you have to pay to this supplier."), | ||
691 | 85 | 'nat_acc_parent': fields.boolean('National Acct Parent', help='Designates this partner as the top level parent of a "National Account".'), | ||
692 | 86 | } | ||
693 | 87 | |||
694 | 88 | |||
695 | 89 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
696 | 0 | 90 | ||
697 | === added file 'base_nationalacct/partner_view.xml' | |||
698 | --- base_nationalacct/partner_view.xml 1970-01-01 00:00:00 +0000 | |||
699 | +++ base_nationalacct/partner_view.xml 2014-08-07 15:27:11 +0000 | |||
700 | @@ -0,0 +1,36 @@ | |||
701 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
702 | 2 | <openerp> | ||
703 | 3 | <data> | ||
704 | 4 | |||
705 | 5 | <!-- Partner Form --> | ||
706 | 6 | |||
707 | 7 | <record id="view_partner_form_base_nat" model="ir.ui.view"> | ||
708 | 8 | <field name="name">res.partner.form.base.nat</field> | ||
709 | 9 | <field name="model">res.partner</field> | ||
710 | 10 | <field name="type">form</field> | ||
711 | 11 | <field name="inherit_id" ref="base.view_partner_form"/> | ||
712 | 12 | <field name="priority" eval="1"/> | ||
713 | 13 | <field name="arch" type="xml"> | ||
714 | 14 | <xpath expr="//field[@name='date']" position="after" > | ||
715 | 15 | <field name="nat_acc_parent" /> | ||
716 | 16 | </xpath> | ||
717 | 17 | </field> | ||
718 | 18 | </record> | ||
719 | 19 | |||
720 | 20 | <!-- Partner List--> | ||
721 | 21 | |||
722 | 22 | <record id="view_partner_tree_base_nat" model="ir.ui.view"> | ||
723 | 23 | <field name="name">res.partner.tree.base.nat</field> | ||
724 | 24 | <field name="model">res.partner</field> | ||
725 | 25 | <field name="type">tree</field> | ||
726 | 26 | <field eval="8" name="priority"/> | ||
727 | 27 | <field name="inherit_id" ref="base.view_partner_tree"/> | ||
728 | 28 | <field name="arch" type="xml"> | ||
729 | 29 | <xpath expr="//field[@name='user_id']" position="after"> | ||
730 | 30 | <field name="nat_acc_parent"/> | ||
731 | 31 | </xpath> | ||
732 | 32 | </field> | ||
733 | 33 | </record> | ||
734 | 34 | |||
735 | 35 | </data> | ||
736 | 36 | </openerp> |