diff --git a/easy_my_coop/controllers/main.py b/easy_my_coop/controllers/main.py index 9075758..452b6ed 100644 --- a/easy_my_coop/controllers/main.py +++ b/easy_my_coop/controllers/main.py @@ -151,6 +151,10 @@ class WebsiteSubscription(http.Controller): values["firstname"] = firstname values["birthdate"] = datetime.datetime.strptime(kwargs.get("birthdate"), "%d/%m/%Y").date() + if kwargs.get("share_product_id"): + product_id = kwargs.get("share_product_id") + product = request.env['product.template'].sudo().browse(int(product_id)).product_variant_ids[0] + values["share_product_id"] = product.id #check the subscription's amount company = request.website.company_id max_amount = company.subscription_maximum_amount diff --git a/easy_my_coop/models/product.py b/easy_my_coop/models/product.py index dca6dc3..055af68 100644 --- a/easy_my_coop/models/product.py +++ b/easy_my_coop/models/product.py @@ -16,7 +16,7 @@ class ProductTemplate(models.Model): @api.multi def get_web_share_products(self, is_company): if is_company == True: - ids = self.env['product.template'].search([('is_share','=',True), ('display_on_website','=',True),('by_company','=',True)]) + product_templates = self.env['product.template'].search([('is_share','=',True), ('display_on_website','=',True),('by_company','=',True)]) else: - ids = self.env['product.template'].search([('is_share','=',True), ('display_on_website','=',True),('by_individual','=',True)]) - return ids \ No newline at end of file + product_templates = self.env['product.template'].search([('is_share','=',True), ('display_on_website','=',True),('by_individual','=',True)]) + return product_templates