Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
3095 Näkymät

In odoo 13 i could set a invoice paided using this code:


Payment = self.env['account.payment'].with_context(default_invoice_ids=[(4, invoice['id'], False)])
payment = Payment.create({
                       'date': date,
                       'payment_method_id': 1,
                       'payment_type': 'inbound',
                       'partner_type': 'customer',
                       'partner_id': invoice['partner_id'][0],
                       'amount': invoice['amount_total'],
                       'journal_id': 12,
                       'company_id': 1,
                       'currency_id': 1,
                       'payment_difference_handling': 'open',
                       'communication': invoice['name'],
                       })
                   payment.action_post()


but in odoo the best i get is this:

Payment = self.env['account.payment'].with_context(default_invoice_ids=[(4, invoice['id'], False)])
payment = Payment.create({
                       'date': date,
                       'payment_method_id': 1,
                       'payment_type': 'inbound',
                       'partner_type': 'customer',
                       'partner_id': invoice['partner_id'][0],
                       'amount': invoice['amount_total'],
                       'journal_id': 12,
                       'company_id': 1,
                       'currency_id': 1,
                       'ref': i['name']
                       })
                   payment.action_post()


with is creating a payment but do not link the invoice to it.

Avatar
Hylkää

did you got solution for this?

Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
1
toukok. 22
3882
0
marrask. 21
21
1
tammik. 23
2242
1
elok. 22
1918
2
tammik. 22
4440