تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
6441 أدوات العرض

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
أبريل 19
14839
3
يوليو 24
1558
2
أكتوبر 20
7512
5
مارس 20
7682
2
أغسطس 19
7707