diff --git a/joint_buying_product/models/res_partner.py b/joint_buying_product/models/res_partner.py index 37a8deb2..c6f2dc0e 100644 --- a/joint_buying_product/models/res_partner.py +++ b/joint_buying_product/models/res_partner.py @@ -97,8 +97,10 @@ def _compute_joint_buying_grouped_order_qty(self): @api.constrains("joint_buying_use_category", "joint_buying_frequency_ids") def _check_joint_buying_use_category(self): - for partner in self.filtered(lambda x: not x.joint_buying_use_category): - if partner.mapped("joint_buying_frequency_ids.category_ids"): + for partner in self.filtered(lambda x: x.is_joint_buying): + if not partner.joint_buying_use_category and partner.mapped( + "joint_buying_frequency_ids.category_ids" + ): raise ValidationError( _( "You can not uncheck 'Use Order Categories'"