I'd like to extend the function when registering a payment for a vendor invoice. Normally, the Vendor Reference (account_invoice.reference) is given to account_payment.communication. I want to write a module where I inherit from account_payment the moment the Vendor Reference is acquired from the invoice and add the invoice number to it.
Whichevery way I try to inherit from account.payment and the classes and functions from Odoo, I get a traceback the moment I click on "Validate" in the pop up after clicking on "Register Payment".
My code so far (since I think this is not that much):
# -*- coding: utf-8 -*-
from openerp import api, fields, models
class enhance_memo(models.Model):
_inherit = 'account.payment'
@api.model
def default_get(self, values):
record = super(enhance_memo,self).default_get(values)
record['communication'] = [invoice['reference'], invoice['number']]
return record
I already created another module, which extens the refund function, so I'm more than confused that I struggle with this one.
Any help, from links to tutorials to code examples would be really nice.