Fix create function in farmer registry base
Fix the create function in the file spp_farmer_registry_base/models/farm.py since it breaks the function of res.partner model to create multiple records in one function. below is the sample code that will produce an error
self.env["res.partner"].create([{"name": "Test 1"}, {"name": "Test 2"}])
This is a major bug that will break other modules as well if this module is installed.
below is the create function that needs to fix
@api.model_create_multi
def create(self, vals):
farm = super().create(vals)
if farm.is_group:
self.create_update_farmer(farm)
elif not farm.is_group and farm.is_registrant:
self.update_farmer(farm)
return farm
Estimate Dev Time:
Optimistic: 4 hours Pessimistic: 12 hours
@anthonymarkQA and @reichie020212 , can you two test this together? primarily for @reichie020212 to check that the issue no longer exists and for @anthonymarkQA to verify that everything still working as expected
@celinenilla @anthonymarkQA , Done testing the PR in my local and it is working as expected.
in the 1st screenshot, the fix is not yet deployed in my local that's why you can see that the error is showing. In the 2nd screenshot I already deployed the fix the error is not showing anymore
Additional tests: QA passed
Should not generate error when running the scheduled action manually in the farmer registry instance with the PR fix- pass
Should generate error when running the scheduled action manually on a farmer registry isntance without the PR fix - pass