This question has been flagged
5 Replies
7098 Views

I did the following: 

First I created the function:


def invoiceRegisterPayment(self,register_payment_row):       
    confirm_result = self.ODOO_OBJECT.execute_kw(
        self.DATA,
        self.UID,
        self.PASS,
        'account.payment',
        'action_validate_invoice_payment',
        register_payment_row)       
    return confirm_result
Then I passed the following parameters:
    register_payment_row = [
        [payment_id],
        {
            "active_id":invoice_id,
            "active_ids":[invoice_id],
            "active_model": "account.invoice",
            "default_invoice_ids":[[4,invoice_id,None]],
            "journal_type":"sale",
            "lang":"en_US",
            "search_disable_custom_filters": True,
            "type": "out_invoice",
            "tz": False,
            "uid": 2
        } ]

But it shows the following error: "This method should only be called to process a single invoice's payment."

This is the print of register_payment_row:

[[67], {'active_id': 119, 'active_ids': [119], 'active_model': 'account.invoice', 'default_invoice_ids': [4, 119, None], 'journal_type': 'sale', 'lang': 'en_US', 'search_disable_custom_filters': True, 'type': 'out_invoice', 'tz': False, 'uid': 2}]
Avatar
Discard
Best Answer

Hello

your passing multiple invoices that's why the error

'default_invoice_ids': [4, 119, None]
you have to pass only one invoice_id then it will work
Try with this 'default_invoice_ids': [invoice_id]
Avatar
Discard

I tried the code below and it is still show

register_payment_row = [

[452],

{

"active_id":333,

"active_ids":[333],

"active_model": "account.invoice",

"default_invoice_ids": [333],

"journal_type":"sale",

"lang":"en_US",

"search_disable_custom_filters": True,

"type": "out_invoice",

"tz": False,

"uid": 1

} ]

Best Answer

It's worked:

'invoice_ids' should be like that: 'invoice_ids': [[4, invoice_id, None]]

Avatar
Discard
Best Answer

I tried the code below and it is still show



"This method should only be called to process a single invoice's payment"



register_payment_row = [


[452],


{


"active_id":333,


"active_ids":[333],


"active_model": "account.invoice",


"default_invoice_ids": [333],


"journal_type":"sale",


"lang":"en_US",


"search_disable_custom_filters": True,


"type": "out_invoice",


"tz": False,


"uid": 1


} ]

Avatar
Discard
Best Answer

I'm getting this error:

RPCError: local variable 'sequence_code' referenced before assignment

any help?

Avatar
Discard