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

Hi , I wanna Extend

accountReportsWidget 

to add a new function but iam not making it work, can somebody help ?

الصورة الرمزية
إهمال
أفضل إجابة

in order to extend the accountReportsWidget class and add a new function, you will need to create a new module and include the following steps:

  1. Create a new folder in your Odoo addons directory, and name it according to your module.

  2. Create a new file called __init__.py in your module's folder.

  3. Create another file called models.py in your module's folder.

  4. In the models.py file, you will need to import the accountReportsWidget class and create a new class that inherits from it. Here's an example:

from odoo import api, fields, models

class ExtendedAccountReportsWidget(models.AbstractModel):
    _inherit = 'account.reports.widget'

    # Your new function here
    def your_new_function(self):
        # Your code here
  1. Add your new class to the __init__.py file so it can be used by Odoo:
from . import models
  1. Update the __manifest__.py file to include the new class in the models key:
'models': ['extended_account_reports_widget'],
  1. Add the dependency of the account_reports_widget on your module in the manifest.py file
'depends': ['account_reports_widget'],
  1. After that, you should install the module and check if it's working properly.

It's worth noting that you should test your customizations in a test environment before applying it to a production environment. Also, make sure that the class you are trying to extend is properly defined and that it's compatible with your version of Odoo.

الصورة الرمزية
إهمال
الكاتب

Thank you , but accountReportsWidget is a js class not python one

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
أكتوبر 23
1726
0
أكتوبر 20
3187
0
يونيو 16
3265
2
مايو 25
859
0
نوفمبر 24
900