diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-07-19 10:25:42 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-07-19 10:25:42 +0700 |
| commit | 6178dd2ae746746ebfdcf68246d13950a45fadf4 (patch) | |
| tree | c27ceef72b5788ef817dc591efbc6fa2f5ce51f7 | |
| parent | 555fb9de25e73348297b1af42dcb80bdfdc33113 (diff) | |
<iman> update onchange api category_id
| -rw-r--r-- | indoteknik_custom/models/website_categories_management.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/indoteknik_custom/models/website_categories_management.py b/indoteknik_custom/models/website_categories_management.py index 7d3d1dee..f7b321c0 100644 --- a/indoteknik_custom/models/website_categories_management.py +++ b/indoteknik_custom/models/website_categories_management.py @@ -16,7 +16,8 @@ class WebsiteCategoriesManagement(models.Model): @api.onchange('category_id') def _onchange_category_id(self): domain = {} - self.category_id2 = [(5, 0, 0)] + if self.category_id != self._origin.category_id: # Check if the category_id has changed + self.category_id2 = [(5, 0, 0)] # Clear the category_id2 field if category_id has changed if self.category_id: domain['category_id2'] = [('parent_frontend_id', '=', self.category_id.id)] else: |
