Merge lp:~serpentcs/openerp-usa/base_nationalacct into lp:openerp-usa

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
Reviewer Review Type Date Requested Status
Novapoint Group Approve
Review via email: mp+229958@code.launchpad.net
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
=== modified file 'account_payment_ccapi_authdotnet/cc_auth_api.py'
--- account_payment_ccapi_authdotnet/cc_auth_api.py 2014-01-09 18:15:04 +0000
+++ account_payment_ccapi_authdotnet/cc_auth_api.py 2014-08-07 15:27:11 +0000
@@ -128,11 +128,11 @@
128# vals['type'] = 'sale'128# vals['type'] = 'sale'
129# vals['currency_id'] = journal_obj.company_id.currency_id.id129# vals['currency_id'] = journal_obj.company_id.currency_id.id
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]
131## vals['narration'] = voucher_obj.narration131# # vals['narration'] = voucher_obj.narration
132# vals['pay_now'] = 'pay_now'132# vals['pay_now'] = 'pay_now'
133# vals['account_id'] = journal_obj.default_debit_account_id.id 133# vals['account_id'] = journal_obj.default_debit_account_id.id
134## vals['reference'] = voucher_obj.reference134# # vals['reference'] = voucher_obj.reference
135## vals['tax_id'] = voucher_obj.tax_id.id135# # vals['tax_id'] = voucher_obj.tax_id.id
136# vals['amount'] = sale_obj.amount_total136# vals['amount'] = sale_obj.amount_total
137# vals['company_id'] = journal_obj.company_id.id137# vals['company_id'] = journal_obj.company_id.id
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)
@@ -153,9 +153,9 @@
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'})
154 user = self.pool.get('res.users').browse(cr, uid, uid)154 user = self.pool.get('res.users').browse(cr, uid, uid)
155 155
156 creditcard = acc_voucher_obj.cc_number# CREDIT CARD NUMBER156 creditcard = acc_voucher_obj.cc_number # CREDIT CARD NUMBER
157 expiration = acc_voucher_obj.cc_e_d_month + acc_voucher_obj.cc_e_d_year ################ EXPIRATION DATE MM + YY157 expiration = acc_voucher_obj.cc_e_d_month + acc_voucher_obj.cc_e_d_year ################ EXPIRATION DATE MM + YY
158 total = acc_voucher_obj.cc_order_amt ############## ORDER AMOUNT158 total = acc_voucher_obj.cc_order_amt ############## ORDER AMOUNT
159 159
160 if acc_voucher_obj.cc_save_card_details:160 if acc_voucher_obj.cc_save_card_details:
161 if not acc_voucher_obj.cc_bank:161 if not acc_voucher_obj.cc_bank:
@@ -164,10 +164,10 @@
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)]):
165 state_id = country_id = False165 state_id = country_id = False
166 if acc_voucher_obj.cc_state:166 if acc_voucher_obj.cc_state:
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)])
168 state_id = state_ids and state_ids[0] or False168 state_id = state_ids and state_ids[0] or False
169 if acc_voucher_obj.cc_country:169 if acc_voucher_obj.cc_country:
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)])
171 country_id = country_ids and country_ids[0] or False171 country_id = country_ids and country_ids[0] or False
172 part = acc_voucher_obj.partner_id.id172 part = acc_voucher_obj.partner_id.id
173 if acc_voucher_obj.partner_id.parent_id:173 if acc_voucher_obj.partner_id.parent_id:
@@ -181,7 +181,7 @@
181 'bank':acc_voucher_obj.cc_bank.id,181 'bank':acc_voucher_obj.cc_bank.id,
182 'cc_v':acc_voucher_obj.cc_v,182 'cc_v':acc_voucher_obj.cc_v,
183 'owner_name':acc_voucher_obj.cc_name,183 'owner_name':acc_voucher_obj.cc_name,
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),
185 'city': acc_voucher_obj.cc_city,185 'city': acc_voucher_obj.cc_city,
186 'zip': acc_voucher_obj.cc_zip,186 'zip': acc_voucher_obj.cc_zip,
187 'state_id': state_id,187 'state_id': state_id,
@@ -219,13 +219,13 @@
219219
220 if str(login).strip() == '' or login == None:220 if str(login).strip() == '' or login == None:
221 raise osv.except_osv(_('Error'), _("No login name provided"))221 raise osv.except_osv(_('Error'), _("No login name provided"))
222 #raise AuthnetAIMError('No login name provided')222 # raise AuthnetAIMError('No login name provided')
223 if str(transkey).strip() == '' or transkey == None:223 if str(transkey).strip() == '' or transkey == None:
224 raise osv.except_osv(_('Error'), _("No transaction key provided"))224 raise osv.except_osv(_('Error'), _("No transaction key provided"))
225 #raise AuthnetAIMError('No transaction key provided')225 # raise AuthnetAIMError('No transaction key provided')
226 if testmode != True and testmode != False:226 if testmode != True and testmode != False:
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. "))
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))
229229
230 parameters = {}230 parameters = {}
231 proxy = None231 proxy = None
@@ -247,24 +247,24 @@
247 parameters = voucher_obj.setParameter(parameters, 'x_login', login)247 parameters = voucher_obj.setParameter(parameters, 'x_login', login)
248 parameters = voucher_obj.setParameter(parameters, 'x_tran_key', transkey)248 parameters = voucher_obj.setParameter(parameters, 'x_tran_key', transkey)
249 249
250 if acc_voucher_obj.cc_charge and x_type !='CREDIT':250 if acc_voucher_obj.cc_charge and x_type != 'CREDIT':
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)
252252
253 #PreAuth is done, so sending x_trans_id for capture253 # PreAuth is done, so sending x_trans_id for capture
254 if x_type in ['PRIOR_AUTH_CAPTURE','CREDIT']:254 if x_type in ['PRIOR_AUTH_CAPTURE', 'CREDIT']:
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)
256 256
257 ########## setTransaction257 ########## setTransaction
258 if str(creditcard).strip() == '' or creditcard == None:258 if str(creditcard).strip() == '' or creditcard == None:
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()"))
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)
261 if str(expiration).strip() == '' or expiration == None:261 if str(expiration).strip() == '' or expiration == None:
262 raise osv.except_osv(_('Error'), _("No expiration number to setTransaction()"))262 raise osv.except_osv(_('Error'), _("No expiration number to setTransaction()"))
263 #raise AuthnetAIMError('No expiration number to setTransaction(): {0}').format(expiration)263 # raise AuthnetAIMError('No expiration number to setTransaction(): {0}').format(expiration)
264 if str(total).strip() == '' or total == None:264 if str(total).strip() == '' or total == None:
265 raise osv.except_osv(_('Error'), _("No total amount passed to setTransaction()"))265 raise osv.except_osv(_('Error'), _("No total amount passed to setTransaction()"))
266266
267 #raise AuthnetAIMError('No total amount passed to setTransaction(): {0}').format(total)267 # raise AuthnetAIMError('No total amount passed to setTransaction(): {0}').format(total)
268268
269 parameters = voucher_obj.setParameter(parameters, 'x_card_num', creditcard)269 parameters = voucher_obj.setParameter(parameters, 'x_card_num', creditcard)
270 parameters = voucher_obj.setParameter(parameters, 'x_exp_date', expiration)270 parameters = voucher_obj.setParameter(parameters, 'x_exp_date', expiration)
@@ -331,13 +331,13 @@
331 ret_dic['cc_trans_id'] = results[6]331 ret_dic['cc_trans_id'] = results[6]
332 ret_dic['cc_transaction'] = True332 ret_dic['cc_transaction'] = True
333 voucher_obj.write(cr, uid, ids, ret_dic)333 voucher_obj.write(cr, uid, ids, ret_dic)
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)
335 cr.commit()335 cr.commit()
336 if results[0] == '1':336 if results[0] == '1':
337 '''337 '''
338 Validating sales receipt338 Validating sales receipt
339 '''339 '''
340 #self.validate_sales_reciept(cr, uid, ids, context=context)340 # self.validate_sales_reciept(cr, uid, ids, context=context)
341 '''341 '''
342 Posting payment voucher342 Posting payment voucher
343 '''343 '''
@@ -348,11 +348,11 @@
348 elif x_type == 'CREDIT':348 elif x_type == 'CREDIT':
349 status = 'Refund: ' + str(results[3])349 status = 'Refund: ' + str(results[3])
350 ret_dic['cc_status'] = status350 ret_dic['cc_status'] = status
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)
352 if results[0] == '1':352 if results[0] == '1':
353 ret_dic['cc_transaction'] = False353 ret_dic['cc_transaction'] = False
354 #Domain : [('type','=','out_refund')]354 # Domain : [('type','=','out_refund')]
355 #Context: {'type':'out_refund', 'journal_type': 'sale_refund'}355 # Context: {'type':'out_refund', 'journal_type': 'sale_refund'}
356 refund_journal_id = False356 refund_journal_id = False
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)
358 if j_ids:358 if j_ids:
@@ -372,7 +372,7 @@
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,
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'])
374 inv_lines = []374 inv_lines = []
375 refund_lines = context.get('cc_refund',[])375 refund_lines = context.get('cc_refund', [])
376 for line in refund_lines:376 for line in refund_lines:
377 377
378 inv_line_vals = {378 inv_line_vals = {
@@ -388,104 +388,6 @@
388 388
389 invoice_id = invoice_obj.create(cr, uid, inv_vals, context=context)389 invoice_id = invoice_obj.create(cr, uid, inv_vals, context=context)
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)
391
392# ret = True
393# voucher_obj = self.pool.get('account.voucher')
394#
395#
396# refund_journal_id = False
397# if user.company_id.cc_refund_journal_id:
398# refund_journal_id = user.company_id.cc_refund_journal_id.id
399# else
400# j_ids = self.pool.get('account.journal').search(cr, uid, [('type','=','sale_refund')], context=context)
401# if j_ids:
402# refund_journal_id = j_ids[0]
403#
404# account_id=False
405# if refund_journal_id:
406# default_debit_account_id = self.pool.get('account.journal').browse(cr, uid, refund_journal_id,context=context).default_debit_account_id.id
407#
408#
409# vals1 = {
410#
411# 'name' : 'Refund : ' + (acc_voucher_obj.rel_sale_order_id and str(acc_voucher_obj.rel_sale_order_id.name) or ''),
412# 'account_id' : default_debit_account_id,
413# 'partner_id' : acc_voucher_obj.partner_id.id,
414# 'amount' : acc_voucher_obj.cc_order_amt,
415# 'currency_id' : user.company_id.currency_id.id,
416# 'origin':acc_voucher_obj.rel_sale_order_id and acc_voucher_obj.rel_sale_order_id.name or ''
417# }
418#
419#
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())
421#
422# vals.update(vals1)
423#
424# vals['journal_id'] = refund_journal_id
425# vals['type'] = 'sale'
426#
427#
428#
429#
430# voucher_id = voucher_obj.create(cr, uid, vals, context=context)
431#
432#
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:
434# self.pool.get('sale.order').write(cr, uid, [acc_voucher_obj.rel_sale_order_id.id],{'cc_ship_refund':True},context=context)
435#
436# refund_voucher=False
437# if 'cc_refund' not in context:
438# refund_voucher=True
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)
440#
441# for receipt in voucher_obj.browse(cr, uid, sales_receipt_ids, context):
442#
443# for line in receipt.line_ids:
444#
445# if line.amount:
446# vals = {
447# 'voucher_id': voucher_id,
448# 'name' : line.name,
449# 'account_id' : line.account_id.id,
450# 'partner_id' : line.partner_id.id,
451# 'amount' : line.amount,
452# 'type': line.type,
453#
454# }
455# line_id = self.pool.get('account.voucher.line').create(cr, uid, vals, context)
456# break
457# else:
458# for line in context['cc_refund']:
459# product=self.pool.get('product.product').browse(cr, uid, line['product_id'],context)
460#
461# vals = {
462# 'voucher_id': voucher_id,
463# 'name' : product.name,
464# 'account_id' : product.product_tmpl_id.property_account_income.id,
465# 'partner_id' : acc_voucher_obj.partner_id.id,
466# 'amount' : product.list_price * line['qty'],
467# 'type' : 'cr',
468# }
469# line_id = self.pool.get('account.voucher.line').create(cr, uid, vals, context)
470# if context.get('cc_ship_refund'):
471# vals = {
472# 'voucher_id': voucher_id,
473# 'name' : 'Shipping Charges of ' + acc_voucher_obj.rel_sale_order_id.name,
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,
475# 'partner_id' : acc_voucher_obj.partner_id.id,
476# 'amount' : context['cc_ship_refund'],
477# 'type' : 'cr',
478# }
479# line_id = self.pool.get('account.voucher.line').create(cr, uid, vals, context)
480# self.pool.get('sale.order').write(cr, uid, [acc_voucher_obj.rel_sale_order_id.id],{'cc_ship_refund':True},context=context)
481#
482# # if x_type == 'CAPTURE_ONLY':
483# status = "Capture: " + str(results[3])
484# ret_dic['cc_status'] = status
485# voucher_obj.write(cr, uid, ids, ret_dic)
486# if not refund_voucher:
487# wf_service = netsvc.LocalService('workflow')
488# wf_service.trg_validate(uid, 'account.voucher', voucher_id, 'proforma_voucher', cr)
489 391
490 else:392 else:
491 ret_dic['cc_transaction'] = True393 ret_dic['cc_transaction'] = True
@@ -505,7 +407,7 @@
505 '''407 '''
506 408
507 def check_transaction(self, cr, uid, ids, context=None):409 def check_transaction(self, cr, uid, ids, context=None):
508 transaction_record = self.browse( cr, uid, ids,context)410 transaction_record = self.browse(cr, uid, ids, context)
509 for record in transaction_record:411 for record in transaction_record:
510 if record.cc_p_authorize and record.cc_auth_code:412 if record.cc_p_authorize and record.cc_auth_code:
511 raise osv.except_osv(_('Error'), _("Already Authorized!"))413 raise osv.except_osv(_('Error'), _("Already Authorized!"))
@@ -550,7 +452,7 @@
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])
551 if sale_obj and sale_obj.order_line:453 if sale_obj and sale_obj.order_line:
552 for sale_line in sale_obj.order_line:454 for sale_line in sale_obj.order_line:
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 account455 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
554 cr_ids['amount'] = sale_line.price_subtotal456 cr_ids['amount'] = sale_line.price_subtotal
555 cr_ids['partner_id'] = sale_obj.partner_id.id457 cr_ids['partner_id'] = sale_obj.partner_id.id
556 cr_ids['name'] = sale_line.name458 cr_ids['name'] = sale_line.name
@@ -565,7 +467,7 @@
565 else:467 else:
566 vals['journal_id'] = False468 vals['journal_id'] = False
567 vals['partner_id'] = sale_obj.partner_id.id469 vals['partner_id'] = sale_obj.partner_id.id
568 #vals['date'] = sale_obj.date_order470 # vals['date'] = sale_obj.date_order
569 vals['rel_sale_order_id'] = ids[0]471 vals['rel_sale_order_id'] = ids[0]
570 vals['name'] = 'Auto generated Sales Receipt'472 vals['name'] = 'Auto generated Sales Receipt'
571 vals['type'] = 'sale'473 vals['type'] = 'sale'
@@ -588,7 +490,7 @@
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)
589 for o in self.browse(cr, uid, ids, context=context):491 for o in self.browse(cr, uid, ids, context=context):
590 if (o.order_policy == 'credit_card'):492 if (o.order_policy == 'credit_card'):
591 #self.create_sales_reciept(cr, uid, [o.id])493 # self.create_sales_reciept(cr, uid, [o.id])
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)
593 wf_service = netsvc.LocalService('workflow')495 wf_service = netsvc.LocalService('workflow')
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)
595497
=== modified file 'account_payment_ccapi_authdotnet/stock_return_picking.py'
--- account_payment_ccapi_authdotnet/stock_return_picking.py 2014-01-09 18:15:04 +0000
+++ account_payment_ccapi_authdotnet/stock_return_picking.py 2014-08-07 15:27:11 +0000
@@ -28,7 +28,7 @@
28 _inherit = 'stock.return.picking'28 _inherit = 'stock.return.picking'
29 _columns = { 29 _columns = {
30 'cc_ship_refund' : fields.boolean(string='Refund Shipcharge', required=True),30 'cc_ship_refund' : fields.boolean(string='Refund Shipcharge', required=True),
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),
32 }32 }
33 33
34 def default_get(self, cr, uid, fields, context=None):34 def default_get(self, cr, uid, fields, context=None):
@@ -79,7 +79,7 @@
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)
80 80
81 move_lines = data['product_return_moves']81 move_lines = data['product_return_moves']
82 #@ Moving the refund process to On Delivery process of related incoming shipment82 # @ Moving the refund process to On Delivery process of related incoming shipment
83 if data['invoice_state'] == 'cc_refund':83 if data['invoice_state'] == 'cc_refund':
84 amount = 0.0084 amount = 0.00
85 for move in move_lines:85 for move in move_lines:
@@ -136,11 +136,11 @@
136 amount = 0.00136 amount = 0.00
137 vch_lines = []137 vch_lines = []
138 Lines = pick.move_lines138 Lines = pick.move_lines
139 if pick.backorder_id.id and pick.state=='assigned':139 if pick.backorder_id.id and pick.state == 'assigned':
140 Lines = pick.backorder_id.move_lines140 Lines = pick.backorder_id.move_lines
141 for move in Lines:141 for move in Lines:
142 partial_data = partial_datas.get('move%s'%(move.id), {})142 partial_data = partial_datas.get('move%s' % (move.id), {})
143 new_qty = partial_data.get('product_qty',0.0)143 new_qty = partial_data.get('product_qty', 0.0)
144 line = {}144 line = {}
145 if IN:145 if IN:
146 line['product_id'] = move.product_id.id146 line['product_id'] = move.product_id.id
@@ -162,7 +162,7 @@
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:
163 rel_voucher = sale.rel_account_voucher_id or False163 rel_voucher = sale.rel_account_voucher_id or False
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:
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}
166 if 'trans_type' in rel_voucher._columns.keys():166 if 'trans_type' in rel_voucher._columns.keys():
167 vals_vouch.update({'trans_type': 'PriorAuthCapture'})167 vals_vouch.update({'trans_type': 'PriorAuthCapture'})
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)
@@ -176,4 +176,4 @@
176176
177# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:177# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
178178
179
180\ No newline at end of file179\ No newline at end of file
180
181181
=== modified file 'account_payment_creditcard/account_journal.py'
--- account_payment_creditcard/account_journal.py 2014-01-09 18:15:04 +0000
+++ account_payment_creditcard/account_journal.py 2014-08-07 15:27:11 +0000
@@ -36,8 +36,8 @@
36 _inherit = "res.partner"36 _inherit = "res.partner"
37 37
38 def write(self, cr, uid, ids, vals, context=None):38 def write(self, cr, uid, ids, vals, context=None):
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] :
40 if vals['bank_ids'][0][2].get('cc_number',False):40 if vals['bank_ids'][0][2].get('cc_number', False):
41 if ('XXXXXXXXX' in vals['bank_ids'][0][2]['cc_number']):41 if ('XXXXXXXXX' in vals['bank_ids'][0][2]['cc_number']):
42 if vals.get('cc_number'):42 if vals.get('cc_number'):
43 del vals['cc_number']43 del vals['cc_number']
@@ -52,7 +52,7 @@
52 _inherit = "res.partner.bank"52 _inherit = "res.partner.bank"
5353
54 _columns = {54 _columns = {
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.
56 'cc_e_d_month':fields.char('Expiration Date MM', size=32),56 'cc_e_d_month':fields.char('Expiration Date MM', size=32),
57 'cc_e_d_year':fields.char('Expiration Date YY', size=32),57 'cc_e_d_year':fields.char('Expiration Date YY', size=32),
58 'cc_v':fields.char('Card Code Verification', size=3),58 'cc_v':fields.char('Card Code Verification', size=3),
@@ -94,7 +94,7 @@
94 if context is None:94 if context is None:
95 context = {}95 context = {}
96 context.update({'cc_no':'no_mask'})96 context.update({'cc_no':'no_mask'})
97 if not isinstance(ids,list):97 if not isinstance(ids, list):
98 ids = [ids]98 ids = [ids]
99 for record in self.browse(cr, uid, ids, context=context):99 for record in self.browse(cr, uid, ids, context=context):
100 if vals.get('cc_number', False):100 if vals.get('cc_number', False):
@@ -159,4 +159,4 @@
159 159
160res_partner_bank()160res_partner_bank()
161161
162# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
163\ No newline at end of file162\ No newline at end of file
163# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
164164
=== modified file 'account_payment_creditcard/account_voucher.py'
--- account_payment_creditcard/account_voucher.py 2014-01-09 18:15:04 +0000
+++ account_payment_creditcard/account_voucher.py 2014-08-07 15:27:11 +0000
@@ -124,7 +124,7 @@
124 if context is None:124 if context is None:
125 context = {}125 context = {}
126 context.update({'cc_no':'no_mask'})126 context.update({'cc_no':'no_mask'})
127 if not isinstance(ids,list):127 if not isinstance(ids, list):
128 ids = [ids]128 ids = [ids]
129 for record in self.browse(cr, uid, ids, context=context):129 for record in self.browse(cr, uid, ids, context=context):
130 if vals.get('cc_number', False):130 if vals.get('cc_number', False):
@@ -222,7 +222,7 @@
222 'cc_zip':fields.char('Postal/Zip', size=32,),222 'cc_zip':fields.char('Postal/Zip', size=32,),
223 'cc_country':fields.char('Country', size=32,),223 'cc_country':fields.char('Country', size=32,),
224 'cc_order_date':fields.date('Order Date',),224 'cc_order_date':fields.date('Order Date',),
225 'cc_order_amt':fields.float('Order Amt',required=True),225 'cc_order_amt':fields.float('Order Amt', required=True),
226 'cc_number':fields.char('Credit Card Number', size=256),226 'cc_number':fields.char('Credit Card Number', size=256),
227 'cc_v':fields.char('Card Code Verification', size=3),227 'cc_v':fields.char('Card Code Verification', size=3),
228 'cc_e_d_month':fields.char('Expiration Date MM', size=32),228 'cc_e_d_month':fields.char('Expiration Date MM', size=32),
@@ -278,7 +278,7 @@
278 cc_allow_refunds = jorurnal_cc_allow = False278 cc_allow_refunds = jorurnal_cc_allow = False
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)
280 if journal_id and cardholder_details:280 if journal_id and cardholder_details:
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'])
282 jorurnal_cc_allow = journal_read['cc_allow_processing']282 jorurnal_cc_allow = journal_read['cc_allow_processing']
283 cc_allow_refunds = journal_read['cc_allow_refunds']283 cc_allow_refunds = journal_read['cc_allow_refunds']
284 res['value']['cc_name'] = cardholder_details['name']284 res['value']['cc_name'] = cardholder_details['name']
@@ -349,12 +349,12 @@
349 journal_pool = self.pool.get('account.journal')349 journal_pool = self.pool.get('account.journal')
350 line_pool = self.pool.get('account.voucher.line')350 line_pool = self.pool.get('account.voucher.line')
351351
352 #set default values352 # set default values
353 default = {353 default = {
354 'value': {'line_dr_ids': [] ,'line_cr_ids': [] ,'pre_line': False,},354 'value': {'line_dr_ids': [] , 'line_cr_ids': [] , 'pre_line': False, },
355 }355 }
356356
357 #drop existing lines357 # drop existing lines
358 line_ids = ids and line_pool.search(cr, uid, [('voucher_id', '=', ids[0])]) or False358 line_ids = ids and line_pool.search(cr, uid, [('voucher_id', '=', ids[0])]) or False
359 if line_ids:359 if line_ids:
360 line_pool.unlink(cr, uid, line_ids)360 line_pool.unlink(cr, uid, line_ids)
@@ -377,14 +377,14 @@
377 account_type = 'receivable'377 account_type = 'receivable'
378378
379 if not context.get('move_line_ids', False):379 if not context.get('move_line_ids', False):
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)
381 else:381 else:
382 ids = context['move_line_ids']382 ids = context['move_line_ids']
383 invoice_id = context.get('invoice_id', False)383 invoice_id = context.get('invoice_id', False)
384 company_currency = journal.company_id.currency_id.id384 company_currency = journal.company_id.currency_id.id
385 move_line_found = False385 move_line_found = False
386386
387 #order the lines by most old first387 # order the lines by most old first
388 ids.reverse()388 ids.reverse()
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)
390390
@@ -393,25 +393,25 @@
393 if context.get('sale_id'):393 if context.get('sale_id'):
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]
395 395
396 #compute the total debit/credit and look for a matching open amount or invoice396 # compute the total debit/credit and look for a matching open amount or invoice
397 for line in account_move_lines:397 for line in account_move_lines:
398 if _remove_noise_in_o2m():398 if _remove_noise_in_o2m():
399 continue399 continue
400400
401 if INV_IDS:401 if INV_IDS:
402 if line.invoice.id in INV_IDS:402 if line.invoice.id in INV_IDS:
403 #if the invoice linked to the voucher line is equal to the invoice_id in context403 # if the invoice linked to the voucher line is equal to the invoice_id in context
404 #then we assign the amount on that line, whatever the other voucher lines404 # then we assign the amount on that line, whatever the other voucher lines
405 move_line_found = line.id405 move_line_found = line.id
406 break406 break
407 elif currency_id == company_currency:407 elif currency_id == company_currency:
408 #otherwise treatments is the same but with other field names408 # otherwise treatments is the same but with other field names
409 if line.amount_residual == price:409 if line.amount_residual == price:
410 #if the amount residual is equal the amount voucher, we assign it to that voucher410 # if the amount residual is equal the amount voucher, we assign it to that voucher
411 #line, whatever the other voucher lines411 # line, whatever the other voucher lines
412 move_line_found = line.id412 move_line_found = line.id
413 break413 break
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)
415 total_credit += line.credit or 0.0415 total_credit += line.credit or 0.0
416 total_debit += line.debit or 0.0416 total_debit += line.debit or 0.0
417 elif currency_id == line.currency_id.id:417 elif currency_id == line.currency_id.id:
@@ -422,7 +422,7 @@
422 total_debit += line.debit and line.amount_currency or 0.0422 total_debit += line.debit and line.amount_currency or 0.0
423 423
424 424
425 #voucher line creation425 # voucher line creation
426 for line in account_move_lines:426 for line in account_move_lines:
427 if _remove_noise_in_o2m():427 if _remove_noise_in_o2m():
428 continue428 continue
@@ -430,7 +430,7 @@
430 amount_original = abs(line.amount_currency)430 amount_original = abs(line.amount_currency)
431 amount_unreconciled = abs(line.amount_residual_currency)431 amount_unreconciled = abs(line.amount_residual_currency)
432 else:432 else:
433 #always use the amount booked in the company currency as the basis of the conversion into the voucher currency433 # always use the amount booked in the company currency as the basis of the conversion into the voucher 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)434 amount_original = currency_pool.compute(cr, uid, company_currency, currency_id, line.credit or line.debit or 0.0, context=context_multi_currency)
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)
436 line_currency_id = line.currency_id and line.currency_id.id or company_currency436 line_currency_id = line.currency_id and line.currency_id.id or company_currency
@@ -446,8 +446,8 @@
446 'amount_unreconciled': amount_unreconciled,446 'amount_unreconciled': amount_unreconciled,
447 'currency_id': line_currency_id,447 'currency_id': line_currency_id,
448 }448 }
449 #in case a corresponding move_line hasn't been found, we now try to assign the voucher amount449 # in case a corresponding move_line hasn't been found, we now try to assign the voucher amount
450 #on existing invoices: we split voucher amount by most old first, but only for lines in the same currency450 # on existing invoices: we split voucher amount by most old first, but only for lines in the same currency
451 inv_ids = []451 inv_ids = []
452 REC = False452 REC = False
453 if line.invoice.id and context.get('sale_id'):453 if line.invoice.id and context.get('sale_id'):
454454
=== added directory 'base_nationalacct'
=== added file 'base_nationalacct/Change Log.txt'
--- base_nationalacct/Change Log.txt 1970-01-01 00:00:00 +0000
+++ base_nationalacct/Change Log.txt 2014-08-07 15:27:11 +0000
@@ -0,0 +1,15 @@
1===============================================================================
2 Version Change Log (base_jdc)
3===============================================================================
42.00 (2014-08-07) By Serpent Consulting Services Pvt Ltd.
5 * Code migration to v7
6
71.02 (2012-03-20) By Sinoj
8 * Code clean-up
9
10 1.01 (2011-01-13) By Sinoj
11 * Module is reviewed and comments added
12
13 1.0 (2010-11-23) By jabir
14 * Created "National Acct Parent" variable in partner and displayed it in tree and form view
15 * Displayed parent partner in partner form
016
=== added file 'base_nationalacct/__init__.py'
--- base_nationalacct/__init__.py 1970-01-01 00:00:00 +0000
+++ base_nationalacct/__init__.py 2014-08-07 15:27:11 +0000
@@ -0,0 +1,26 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011 NovaPoint Group LLC (<http://www.novapointgroup.com>)
6# Copyright (C) 2004-2010 OpenERP SA (<http://www.openerp.com>)
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>
20#
21##############################################################################
22
23from . import partner
24
25# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
26
027
=== added file 'base_nationalacct/__openerp__.py'
--- base_nationalacct/__openerp__.py 1970-01-01 00:00:00 +0000
+++ base_nationalacct/__openerp__.py 2014-08-07 15:27:11 +0000
@@ -0,0 +1,43 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011 NovaPoint Group LLC (<http://www.novapointgroup.com>)
6# Copyright (C) 2004-2010 OpenERP SA (<http://www.openerp.com>)
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>
20#
21##############################################################################
22
23
24{
25 'name': 'Base Modifications',
26 'version': '2.0',
27 'category': 'US Localisation/Account',
28 'description': """
29 This module implements changes to Partner and Company .
30 Adds new field National Acct Parent in Partner.
31 The parent company can process the invoice of child company if the account is national account
32 """,
33 'author': 'NovaPoint Group',
34 'website': 'http://www.novapointgroup.com',
35 'depends': ['account'],
36 'data': [
37 'partner_view.xml',
38 ],
39 'installable': True,
40 'auto_install': False,
41 'certificate': '',
42}
43# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
044
=== added file 'base_nationalacct/partner.py'
--- base_nationalacct/partner.py 1970-01-01 00:00:00 +0000
+++ base_nationalacct/partner.py 2014-08-07 15:27:11 +0000
@@ -0,0 +1,89 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011 NovaPoint Group LLC (<http://www.novapointgroup.com>)
6# Copyright (C) 2004-2010 OpenERP SA (<http://www.openerp.com>)
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>
20#
21##############################################################################
22
23from openerp.osv import fields, osv
24
25class res_partner(osv.Model):
26 _inherit = "res.partner"
27
28 #===========================================================================
29 # Overriding a function defined on account module.
30 # This is to include the payable and receivable from child partners if the
31 # account is a national account.
32 #===========================================================================
33 def _credit_debit_get(self, cr, uid, ids, field_names, arg, context=None):
34 """
35 calculating payable and receivable from account moves for the mentioned partners
36 """
37 query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
38 cr.execute("""
39 SELECT l.partner_id, a.type, SUM(l.debit-l.credit)
40 FROM account_move_line l
41 LEFT JOIN account_account a ON (l.account_id=a.id)
42 WHERE a.type IN ('receivable','payable')
43 AND l.partner_id IN %s
44 AND l.reconcile_id IS NULL
45 AND """ + query + """
46 GROUP BY l.partner_id, a.type
47 """,(tuple(ids), ))
48 maps = {'receivable': 'credit', 'payable': 'debit'}
49 res = {}
50 for id in ids:
51 res[id] = dict.fromkeys(field_names, 0)
52 for pid, type, val in cr.fetchall():
53 if val is None: val = 0
54 partner = self.browse(cr, uid, pid, context=context)
55 #Include the payable and receivable form child partner if the Partner is national account
56 if partner.nat_acc_parent:
57 res[pid][maps[type]] = (type == 'receivable') and val or -val
58 child_partner_ids = self.search(cr, uid, [('parent_id', 'child_of', [partner.id])], context=context)
59 if child_partner_ids:
60 child_partner_ids.remove(partner.id)
61 for val in self.read(cr, uid, child_partner_ids, ['credit', 'debit'], context=context):
62 res[pid][maps[type]] += val.get(maps[type], 0)
63 else:
64 res[pid][maps[type]] = (type == 'receivable') and val or -val
65
66 return res
67
68 def _credit_search(self, cr, uid, obj, name, args, context=None):
69 """
70 search function for the credit field
71 """
72 return self._asset_difference_search(cr, uid, obj, name, 'receivable', args, context=context)
73
74 def _debit_search(self, cr, uid, obj, name, args, context=None):
75 """
76 search function for the debit field
77 """
78 return self._asset_difference_search(cr, uid, obj, name, 'payable', args, context=context)
79
80 _columns = {
81 'credit': fields.function(_credit_debit_get, fnct_search=_credit_search, method=True, string='Total Receivable', multi='dc',
82 help="Total amount this customer owes you."),
83 'debit': fields.function(_credit_debit_get, fnct_search=_debit_search, method=True, string='Total Payable', multi='dc',
84 help="Total amount you have to pay to this supplier."),
85 'nat_acc_parent': fields.boolean('National Acct Parent', help='Designates this partner as the top level parent of a "National Account".'),
86 }
87
88
89# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
090
=== added file 'base_nationalacct/partner_view.xml'
--- base_nationalacct/partner_view.xml 1970-01-01 00:00:00 +0000
+++ base_nationalacct/partner_view.xml 2014-08-07 15:27:11 +0000
@@ -0,0 +1,36 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <!-- Partner Form -->
6
7 <record id="view_partner_form_base_nat" model="ir.ui.view">
8 <field name="name">res.partner.form.base.nat</field>
9 <field name="model">res.partner</field>
10 <field name="type">form</field>
11 <field name="inherit_id" ref="base.view_partner_form"/>
12 <field name="priority" eval="1"/>
13 <field name="arch" type="xml">
14 <xpath expr="//field[@name='date']" position="after" >
15 <field name="nat_acc_parent" />
16 </xpath>
17 </field>
18 </record>
19
20 <!-- Partner List-->
21
22 <record id="view_partner_tree_base_nat" model="ir.ui.view">
23 <field name="name">res.partner.tree.base.nat</field>
24 <field name="model">res.partner</field>
25 <field name="type">tree</field>
26 <field eval="8" name="priority"/>
27 <field name="inherit_id" ref="base.view_partner_tree"/>
28 <field name="arch" type="xml">
29 <xpath expr="//field[@name='user_id']" position="after">
30 <field name="nat_acc_parent"/>
31 </xpath>
32 </field>
33 </record>
34
35 </data>
36</openerp>

Subscribers

People subscribed via source and target branches