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

Hi,


how can I create a new group in form tree on a related field ?

in a form tree, I have "filters", "group" and "favorites", how can I add a custom group on related field  ?

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

my field's definition is :

asset_cat = fields.Many2many(related='asset_id.category_ids', store =True)

what's wrong ?

أفضل إجابة

To don't get the error when using store=True you need to add the relation argument to the field definition, using of course the same model name as the original category_ids field, for example:

##updated

asset_cat = fields.Many2many(related='asset_id.category_ids', store =True, relation='account.asset.category', column1='asset_id', column2='categ_id')
الصورة الرمزية
إهمال
الكاتب

now I have this bug

Traceback (most recent call last):

File "C:\Program Files (x86)\Odoo 10.0\server\odoo\modules\registry.py", line 78, in new

File "C:\Program Files (x86)\Odoo 10.0\server\odoo\modules\loading.py", line 335, in load_modules

File "C:\Program Files (x86)\Odoo 10.0\server\odoo\modules\loading.py", line 237, in load_marked_modules

File "C:\Program Files (x86)\Odoo 10.0\server\odoo\modules\loading.py", line 136, in load_module_graph

File "C:\Program Files (x86)\Odoo 10.0\server\odoo\modules\registry.py", line 315, in init_models

File "C:\Program Files (x86)\Odoo 10.0\server\odoo\models.py", line 2361, in _auto_init

File "C:\Program Files (x86)\Odoo 10.0\server\odoo\fields.py", line 2308, in check_schema

File "C:\Program Files (x86)\Odoo 10.0\server\odoo\sql_db.py", line 141, in wrapper

File "C:\Program Files (x86)\Odoo 10.0\server\odoo\sql_db.py", line 218, in execute

ProgrammingError: ERREUR: la colonne ¶® None ¶¯ apparaÇ©t deux fois sur une contrainte unique

LINE 1: ..."None" INTEGER NOT NULL, "None" INTEGER NOT NULL, UNIQUE("No...

Sorry but I don't understand french yet, :), that seems to be that it will need more args for the column on the relation table, I will update the answer

الكاتب

haha sorry, it's mean

The None column appears twice on the unique constraint

try the update

الكاتب أفضل إجابة

I used "store= True" but now I can't access to my database.

so, I delete "store= True" to reaccess database. 

any other solution for filter with related field please ?

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
مارس 15
10149
0
مارس 25
6316
2
مايو 17
8449
0
مايو 15
5929
1
يوليو 25
965