Skip to content

Commit d9a0c82

Browse files
authored
Merge pull request #584 from OpenSPP/515-add-validation-in-import-group-for-farmer-registry
minor fix on base import
2 parents 0f09168 + a05385d commit d9a0c82

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

spp_farmer_registry_base/models/base_import.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@ def execute_import(self, fields, columns, options, dryrun=False):
1515
if "is_group" in fields:
1616
with_is_group = True
1717
if "default_is_group" in self.env.context:
18-
with_is_group = True
18+
if self.env.context["default_is_group"]:
19+
with_is_group = True
20+
if "default_kind" in self.env.context:
21+
if self.env.context["default_kind"] == self.env.ref("spp_farmer_registry_base.kind_farm").id:
22+
with_is_group = True
23+
else:
24+
with_is_group = False
25+
1926
if with_is_group and not ("farmer_given_name" in fields and "farmer_family_name" in fields):
2027
raise ValidationError(_("farmer_given_name and farmer_family_name must be present in the excel file."))
2128

0 commit comments

Comments
 (0)