Hi everyone.
In odoo 8 I'm trying to inherit the account.invoice module (extension type of inheritance) in order to add new button on sales invoice form to print my customized invoice. However the problem now is, that I'm getting the error
AttributeError: 'int' object has no attribute 'id' when trying to upgrade my module.
My module definition looks like this:
# -*- coding: utf-8 -*-
from openerp import models, fields, api
class Inv(models.Model):
_inherit = 'account.invoice'
_name = 'my.inv'
name = fields.Char(string="Title", required=True)
description = fields.Text()
#comment = fields.Text()
@api.one
def print_invoice_my(self):
assert len(self) == 1, 'This option should only be used for a single id at a time.'
#self.sent = True
return self.env['report'].get_action(self, 'my.report_invoice_my')
In __openerp.py__ checked I have:
'depends': ['base','account'],
Can you please suggest what am I doing wrong, thanks regards.
Have you put your button in the inherit view of account.invoice ?
Yes I did, just like in this post https://www.odoo.com/forum/help-1/question/how-to-connect-button-with-function-96285