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

Is it possible to define the inheritance order of models without changing dependencies or renaming of modules? Other question: How is the order calculated?

Example:

# module A
class test_module(Model):
    _name = 'test.module'

    def test_function(self, par):
        print('A')

# module B
class test_module(Model):
    _inherit = 'test.module'

    def test_function(self, par):
        print('B')

# module C
class test_module(Model):
    _inherit = 'test.module'

    def test_function(self, par):
        print('C')

Module B depends on A and Module C depends also on A. When using this definition then "C" is printed but I want "B" printed. I don't want to set C as a dependency of B and I don't want to change

الصورة الرمزية
إهمال

This is just a hunch that I have not tested myself. Uninstall both modules B and C, then install C first before B. AFAIK, there is no deterministic way to sequence dependency in the case like this. You need to tweak the way BaseModel do inheritance.

المنشورات ذات الصلة الردود أدوات العرض النشاط
5
أكتوبر 20
7237
1
أغسطس 15
10018
2
يونيو 20
4833
1
يونيو 16
3401
1
يونيو 15
1182