Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
6396 มุมมอง

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...

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
เม.ย. 19
14831
3
ก.ค. 24
1510
2
ต.ค. 20
7499
5
มี.ค. 20
7643
2
ส.ค. 19
7670