From 7032168e6804f186698e1b0843746445ae5926c2 Mon Sep 17 00:00:00 2001 From: oscar alvarez Date: Mon, 10 Jul 2023 17:52:24 -0500 Subject: [PATCH] Update and remove source --- PATCH.sql | 1 + opportunity.py | 35 ++++++++++++----------------------- tryton.cfg | 2 +- view/opportunity_form.xml | 10 +++++----- 4 files changed, 19 insertions(+), 29 deletions(-) diff --git a/PATCH.sql b/PATCH.sql index 38102ba..012eb12 100644 --- a/PATCH.sql +++ b/PATCH.sql @@ -1 +1,2 @@ ALTER TABLE crm_opportunity_line RENAME time_ammount TO billing_frecuency; +ALTER TABLE crm_opportunity DROP COLUMN source; diff --git a/opportunity.py b/opportunity.py index 0c2f87a..da53d8a 100644 --- a/opportunity.py +++ b/opportunity.py @@ -180,17 +180,7 @@ class Opportunity( states={ 'readonly': Eval('state').in_(['won', 'lost']) }) - source = fields.Selection([ - ('website', 'Website'), - ('phone', 'Phone'), - ('email', 'Email'), - ('whatsapp', 'WhatsApp'), - ('salesman', 'Salesman'), - ('referred', 'Referred'), - ], "Source", required=True, select=True, - states={ - 'readonly': Eval('state').in_(['converted', 'won', 'lost']) - }) + lead_origin = fields.Many2One('crm.lead_origin', 'Lead Origin') total = fields.Function(fields.Float('Total'), 'get_total_opportunity') total_without_tax = fields.Function(fields.Float('Total'), 'get_total_without_tax_opportunity') @@ -344,7 +334,7 @@ class Opportunity( default.setdefault('sales', None) default.setdefault('contracts', None) default.setdefault('converted_by') - return super(CrmOpportunity, cls).copy(opportunities, default=default) + return super(Opportunity, cls).copy(opportunities, default=default) def get_currency(self, name): return self.company.currency.id @@ -374,20 +364,19 @@ class Opportunity( Date = Pool().get('ir.date') today = Date.today() return { - 'description':self.description, - 'party':self.party, + 'description': self.description, + 'party': self.party, # 'salesman':self.employee, - 'payment_term':self.payment_term, - 'company':self.company, - 'currency':self.company.currency, - 'comment':self.comment, - 'reference':self.reference, - 'contract_date':today, - 'origin':self, - 'state':'draft', + 'payment_term': self.payment_term, + 'company': self.company, + 'currency': self.company.currency, + 'comment': self.comment, + 'reference': self.reference, + 'contract_date': today, + 'origin': self, + 'state': 'draft', } - def _get_sale_opportunity(self): ''' Return sale for an opportunity diff --git a/tryton.cfg b/tryton.cfg index caa5765..6545af4 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=6.0.7 +version=6.0.8 depends: party sale diff --git a/view/opportunity_form.xml b/view/opportunity_form.xml index 604fa38..fcfdea6 100644 --- a/view/opportunity_form.xml +++ b/view/opportunity_form.xml @@ -2,12 +2,12 @@
+