Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
6401 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ

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

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả

Thank you so much , it really works...

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 4 19
14833
3
thg 7 24
1512
2
thg 10 20
7502
5
thg 3 20
7650
2
thg 8 19
7688