Skip to content

Instantly share code, notes, and snippets.

@vcloud9ray
Last active August 25, 2017 17:20
Show Gist options
  • Save vcloud9ray/8bb47341c7c858292b223dfa3fd6a080 to your computer and use it in GitHub Desktop.
Save vcloud9ray/8bb47341c7c858292b223dfa3fd6a080 to your computer and use it in GitHub Desktop.
Odoo. ORM. res.partner. Set fiscal position to Tax Exempt when Country is not United States
@api.onchange('country_id')
def _onchange_country(self):
usa_country_id = self.env['res.country'].search([('name','=','United States')]).id
tax_exempt_fiscal_position = self.env['account.fiscal.position'].search([('name', '=', 'Tax Exempt')])
for record in self:
if record.country_id.id != usa_country_id :
record.property_account_position_id = tax_exempt_fiscal_position
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment