From dac73d0a31ef14a318086d73ef2586b05c7171fc Mon Sep 17 00:00:00 2001 From: houssine Date: Mon, 18 Dec 2017 15:26:27 +0100 Subject: [PATCH] [IMP] add a field source for the subscription request to track the source of the creation --- easy_my_coop/controllers/main.py | 2 ++ easy_my_coop/models/coop.py | 4 +++- easy_my_coop/view/subscription_request_view.xml | 5 ++++- .../wizard/create_subscription_from_partner.py | 16 +++++++++++++--- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/easy_my_coop/controllers/main.py b/easy_my_coop/controllers/main.py index 452b6ed..8eb6ad7 100644 --- a/easy_my_coop/controllers/main.py +++ b/easy_my_coop/controllers/main.py @@ -150,11 +150,13 @@ class WebsiteSubscription(http.Controller): values["lastname"] = lastname values["firstname"] = firstname values["birthdate"] = datetime.datetime.strptime(kwargs.get("birthdate"), "%d/%m/%Y").date() + values["source"] = "website" 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/coop.py b/easy_my_coop/models/coop.py index 9065905..1fc5a68 100644 --- a/easy_my_coop/models/coop.py +++ b/easy_my_coop/models/coop.py @@ -156,7 +156,9 @@ class subscription_request(models.Model): operation_request_id = fields.Many2one('operation.request', string="Operation Request") is_operation = fields.Boolean(string="Is Operation request") capital_release_request = fields.One2many('account.invoice','subscription_request', string='Subscription request') - + source = fields.Selection([('website','Website'), + ('crm','CRM'), + ('manual','Manual')], string="Source", default="website") _order = "id desc" def _prepare_invoice_line(self, product, partner, qty): diff --git a/easy_my_coop/view/subscription_request_view.xml b/easy_my_coop/view/subscription_request_view.xml index 5c2525d..4b8c59f 100644 --- a/easy_my_coop/view/subscription_request_view.xml +++ b/easy_my_coop/view/subscription_request_view.xml @@ -63,6 +63,7 @@ + @@ -110,6 +111,7 @@ subscription.request form [('is_company','=',False),('is_operation','=',False)] + {'default_source':'manual'} @@ -131,6 +133,7 @@ +