From 2cd17d513496b86f0ecdfb33cb24867b6b495d87 Mon Sep 17 00:00:00 2001 From: Steve Campbell Date: Mon, 10 Jun 2019 17:00:11 -0700 Subject: [PATCH] [IMP] fieldservice: Add notes on location (PM #596) (#231) --- fieldservice/__manifest__.py | 1 + fieldservice/models/fsm_location.py | 10 ++++++++++ fieldservice/views/fsm_location.xml | 8 +++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/fieldservice/__manifest__.py b/fieldservice/__manifest__.py index 8b6f1a2d94..d6b0e6fba7 100644 --- a/fieldservice/__manifest__.py +++ b/fieldservice/__manifest__.py @@ -14,6 +14,7 @@ 'web_timeline', 'resource', 'contacts', + 'partner_fax' ], 'data': [ 'data/ir_sequence.xml', diff --git a/fieldservice/models/fsm_location.py b/fieldservice/models/fsm_location.py index ce582e8726..dacaf4f823 100644 --- a/fieldservice/models/fsm_location.py +++ b/fieldservice/models/fsm_location.py @@ -344,6 +344,16 @@ def _check_location_recursion(self): raise ValidationError(_('You cannot create recursive location.')) return True + @api.onchange('country_id') + def _onchange_country_id(self): + if self.country_id and self.country_id != self.state_id.country_id: + self.state_id = False + + @api.onchange('state_id') + def _onchange_state(self): + if self.state_id.country_id: + self.country_id = self.state_id.country_id + class FSMPerson(models.Model): _inherit = 'fsm.person' diff --git a/fieldservice/views/fsm_location.xml b/fieldservice/views/fsm_location.xml index 2ce8082320..e9c9a96318 100644 --- a/fieldservice/views/fsm_location.xml +++ b/fieldservice/views/fsm_location.xml @@ -74,6 +74,9 @@ + + +