Skip to Content
Menu
This question has been flagged
1 Reply
2526 Views

I've created a new model witch inherits Model account.payment and created a new state "approved" (after posted).

The current function to create a payment, checks if state == 'posted' and I need to change this to state == 'approved'.
So I copied the function default_get(self, default_fields) to overwrite this base functionality.

But the first line is: 
rec = super(account_payment, self).default_get(default_fields)
This mains that the default_get function of account.payment is called, and the state is again checked if state == 'posted' and so it raises and error.

Is it possible to directly call the default_get function from the original /odoo-server/odoo/models.py file?
And so bypass this function from account.payment?

Avatar
Discard
Best Answer

Hi,

Try this,

class AccountPayment(models.Model):
_inherit = "account.payment"

@api.model
def default_get(self, fields):
payment = models.Model.default_get(self, fields)
# do xyz
return payment

Thanks

Avatar
Discard
Author

Thanks, that did the trick