Hello guys,
I'm trying to create an extension to the membership module. (I have called it x_membership)
Now I need to inherit a write and create function from the membership module.
The problem is that this function inherits account_invoice_line. So after a lot of trying and experimenting, I inherited the account_invoice_line in my x_membership module. This works, but now whenever I create a subscription, the method gets called twice, once from my module x_membership and once from the default membership module.
So my question is: how can I override the membership modules' create function? This function is in the membership.py under class account_invoice_line(osv.osv): _inherit='account.invoice.line' def write(......): res=super(account_invoice_line, self).write(.....) .......
I don't know how to tell odoo to override that method, because at this point I copied the entire account_invoice class from membership. But this calls super account invoice. I need it to be membership_account_invoice, but I don't know what name/syntax to use for this to happen.
The following is a simple image to try and clarify my question.
http://i.imgur.com/xFUvPSJ.png
Thanks in advance, guys.
Sonny
@Ivan
I do want to call the parent's write method, but I don't want the membership module to also call the account_invoice_line's write method. Because now whenever I create a new membership, the write method gets called in membership and in x_membership, resulting in two added lines, while I only expect one line.
I'm not entirely sure if my x_membership module depends on membership. In __openerp__.py I have depends : ['membership'] though.
I'm fairly new too odoo and am not really experienced with the inheritance and dependancy-tree.
EDIT: I don't have enough karma, so I cannot comment to your comment :(
EDIT2: Is it possible to remove a line from the database? Since the membership module calls a create on membership.membership_line. And I only get one invoice, but two membership_lines. SO if I'm able to say remove the member_line created from the membership module before creating a new using x_membership, my error will be gone. Another workaround I was considering is to create a new table x_membership.membership_line and only show this one instead the membership.membership_lines data. But I'd like to have this as my last resort