Odoo13-CE: Module: sale.order: How to set default value for fiscal_position_id?

77 Views Asked by At

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)])
)
1

There are 1 best solutions below

0
Kenly On

The default fiscal position is set then updated when the Customer or the Delivery Address value is changed and that's why your code didn't work

You can set the fiscal position in the customer or the delivery address form and Odoo will set it automatically for you on the sale order.

if the fiscal position is not defined for the customer or for the delivery address Odoo will try to retrieve the fiscal position by region (customer or delivery address) and the Detect Automatically should be checked on the fiscal position.

For more details check the user documentation on Taxes/Fiscal Positions