跳至內容
選單
此問題已被標幟
1 回覆
6428 瀏覽次數

Hello ,

    I'm trying to make a module that do some specific operation when an invoice is created.So I need to override the 

    create invoice button and create and view invoice button.

    i.e when any of the buttons clicked , I want to check wether a specific type of product is in the order line or not.

    How to do this?

頭像
捨棄

override odoo functions: https://goo.gl/4BkizH

最佳答案

Hi,

You can override a function using the super function.

Suppose if a button is calling a function named 'xyz' in the model 'sale.order', you can override the function 'xyz' like this,


class SaleOrder(models.Model):
_inherit = 'sale.order'

def xyz(self):
res = super(SaleOrder, self).xyz()
# do the necessary operations here
return res


Thanks

頭像
捨棄
作者

Thank you so much , it really works...

相關帖文 回覆 瀏覽次數 活動
1
4月 19
14836
3
7月 24
1542
2
10月 20
7507
5
3月 20
7669
2
8月 19
7700