Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Fast Payment method from Quotation

By
Logicious
on 12/14/15, 6:07 AM 505 views

Hello,

       I have one problem , from sales i need to create one button to create invoice and register the payment. with in one click.

i got one solution to do quotation to Invoice by one click, but now i need to add the invoice to register payment method into it.

"""""""" this is my code , give me one hand to do this

for sale in self:

# Process order

sale.action_button_confirm()

inv_id = sale.action_invoice_create()

if inv_id:

inv = self.env['account.invoice'].browse(inv_id)

inv.signal_workflow('invoice_open')

voc = self.env

self.signal_workflow(cr, uid, ids, 'proforma_voucher')

for picking in sale.picking_ids:

picking.force_assign()

picking.action_done()


***********************

it can able to create invoice within one click, but i need to complete all process including payment  into it.

actually it is in odoo 9 coding, i already done this , but it is in v8, so u can refer this,

pks
on 12/14/15, 9:09 AM
0
pks
On 12/14/15, 9:09 AM

invoice_obj.write(cr,uid,invoice_id,{'state':'open'})

invoice_datas = invoice_obj.browse(cr, uid, invoice_id)

move_id = invoice_datas.move_id.id

print"Single Invoice",move_id

date=datetime.datetime.now()

data = voucher_obj.onchange_partner_id(cr, uid, [],data_partner.id, invoice_datas.journal_id.id ,0.0, False, 'receipt', date, context)['value']

journal_ids = journal_obj.search(cr, uid, [('type','in',['cash','bank'])])

statement_vals = {

'reference': invoice_datas.number,

'journal_id': journal_ids[0],

'amount': invoice_datas.amount_total,

'date' : date,

'partner_id': data_partner.id,

'account_id': invoice_datas.account_id.id,

'type': 'receipt',

'company_id':1,

}

if data.get('payment_rate_currency_id'):

statement_vals['payment_rate_currency_id'] = data['payment_rate_currency_id']

if data.get('paid_amount_in_company_currency'):

statement_vals['paid_amount_in_company_currency'] = data['paid_amount_in_company_currency']

if data.get('writeoff_amount'):

statement_vals['writeoff_amount'] =data['writeoff_amount']

if data.get('pre_line'):

statement_vals['pre_line'] = data['pre_line']

if data.get('payment_rate'):

statement_vals['payment_rate'] = data['payment_rate']

statement_id = voucher_obj.create(cr, uid, statement_vals, context)

print'+++++++++++++++++++++',data.get('line_cr_ids')

for line_cr in data.get('line_cr_ids'):

line_cr.update({'voucher_id':statement_id})

if line_cr['name']==invoice_datas.number:

line_cr['amount']=line_cr['amount_original']

line_cr['reconcile']=True

line_cr_id=voucher_line_obj.create(cr,uid,line_cr)

for line_dr in data.get('line_dr_ids'):

line_dr.update({'voucher_id':statement_id})

line_dr_id=voucher_line_obj.create(cr,uid,line_dr)

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/14/15, 6:07 AM
Seen: 505 times
Last updated: 12/14/15, 9:09 AM