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)])
)
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
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
|
3051 | |||
|
1
февр. 22
|
3128 | |||
|
1
янв. 22
|
3473 | |||
|
2
июл. 23
|
5393 | |||
|
|
1
окт. 22
|
3403 |
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.