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

I tried this piece of code but it does not work:

fiscal_position_id = fields.Many2one(
'account.fiscal.position', string='Fiscal Position',
default=lambda self: self.env['account.fiscal.position'].search([('id','=',2)])
)


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

Hello Erik Vojtas,

For set default value in fiscal_position_id may be below code will helpful for you.
First create the record in data file for account.fiscal.position after that give the xml_ID into the default function

def _get_default_fiscal_position_id(self):
return self.env.ref('XML_ID', raise_if_not_found=False).id

fiscal_position_id = fields.Many2one('account.fiscal.position', string='Fiscal Position', default=_get_default_fiscal_position_id)





Module: sale.order: How to set default value for fiscal_position_id
https://www.odoo.com

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwar



الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
يونيو 22
2407
1
فبراير 22
2448
1
يناير 22
2776
2
يوليو 23
4509
1
أكتوبر 22
2768