I'm working on a override for the account.view_move_form view
This view has context on the partner_id field to alter the search mode based on whether the current invoice is a vendor or a customer invoice.
I would like to extend this context such that if the user creates a new partner starting from the view_move_form, the category_id is set to a different value depending on whether the current invoice is a vendor or a customer invoice.
I'm not managed to do so. Here's what I have so far:
my.move.form
account.move
{
'res_partner_search_mode':
(context.get('default_type', 'entry') in ('out_invoice', 'out_refund', 'out_receipt') and 'customer') or
(context.get('default_type', 'entry') in ('in_invoice', 'in_refund', 'in_receipt') and 'supplier') or False,
'default_category_id': (context.get('default_type', 'entry') in ('out_invoice', 'out_refund', 'out_receipt') and [1]) or [2] }
I have basically added another key to the context dictionary named 'default_category_id' and tried to mimic the condition used in res_partner_search_mode to set a different default based on the type of invoice.
This is not working. Regardless of the invoice type, I'm always seeing [2] as default value when creating a new partner.
I have tried this in odoo 13 and 15, but it fails in both versions.
What should I change to make this work ?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- إدارة علاقات العملاء
- e-Commerce
- المحاسبة
- المخزون
- PoS
- Project
- MRP
لقد تم الإبلاغ عن هذا السؤال
3514
أدوات العرض
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!
أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!
تسجيلالمنشورات ذات الصلة | الردود | أدوات العرض | النشاط | |
---|---|---|---|---|
|
1
يونيو 22
|
6083 | ||
|
1
أبريل 23
|
135 | ||
|
1
فبراير 23
|
3604 | ||
|
1
يناير 22
|
6287 | ||
|
3
أبريل 24
|
9482 |
Hmm, I had marked the snippet as a code block, but for some reason all the xml tags have been stripped. Is there a way to add an xml snippet that avoids this ?