Update and remove source

This commit is contained in:
oscar alvarez 2023-07-10 17:52:24 -05:00
parent 77910144c4
commit 7032168e68
4 changed files with 19 additions and 29 deletions

View file

@ -1 +1,2 @@
ALTER TABLE crm_opportunity_line RENAME time_ammount TO billing_frecuency; ALTER TABLE crm_opportunity_line RENAME time_ammount TO billing_frecuency;
ALTER TABLE crm_opportunity DROP COLUMN source;

View file

@ -180,17 +180,7 @@ class Opportunity(
states={ states={
'readonly': Eval('state').in_(['won', 'lost']) 'readonly': Eval('state').in_(['won', 'lost'])
}) })
source = fields.Selection([ lead_origin = fields.Many2One('crm.lead_origin', 'Lead Origin')
('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'])
})
total = fields.Function(fields.Float('Total'), 'get_total_opportunity') total = fields.Function(fields.Float('Total'), 'get_total_opportunity')
total_without_tax = fields.Function(fields.Float('Total'), total_without_tax = fields.Function(fields.Float('Total'),
'get_total_without_tax_opportunity') 'get_total_without_tax_opportunity')
@ -344,7 +334,7 @@ class Opportunity(
default.setdefault('sales', None) default.setdefault('sales', None)
default.setdefault('contracts', None) default.setdefault('contracts', None)
default.setdefault('converted_by') 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): def get_currency(self, name):
return self.company.currency.id return self.company.currency.id
@ -374,20 +364,19 @@ class Opportunity(
Date = Pool().get('ir.date') Date = Pool().get('ir.date')
today = Date.today() today = Date.today()
return { return {
'description':self.description, 'description': self.description,
'party':self.party, 'party': self.party,
# 'salesman':self.employee, # 'salesman':self.employee,
'payment_term':self.payment_term, 'payment_term': self.payment_term,
'company':self.company, 'company': self.company,
'currency':self.company.currency, 'currency': self.company.currency,
'comment':self.comment, 'comment': self.comment,
'reference':self.reference, 'reference': self.reference,
'contract_date':today, 'contract_date': today,
'origin':self, 'origin': self,
'state':'draft', 'state': 'draft',
} }
def _get_sale_opportunity(self): def _get_sale_opportunity(self):
''' '''
Return sale for an opportunity Return sale for an opportunity

View file

@ -1,5 +1,5 @@
[tryton] [tryton]
version=6.0.7 version=6.0.8
depends: depends:
party party
sale sale

View file

@ -2,12 +2,12 @@
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of <!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. --> this repository contains the full copyright notices and license terms. -->
<form col="6"> <form col="6">
<label name="party_contact"/>
<field name="party_contact"/>
<label name="party"/> <label name="party"/>
<field name="party"/> <field name="party"/>
<label name="contact"/> <label name="contact"/>
<field name="contact"/> <field name="contact"/>
<label name="party_contact"/>
<field name="party_contact"/>
<label name="number"/> <label name="number"/>
<field name="number"/> <field name="number"/>
<label name="address"/> <label name="address"/>
@ -16,8 +16,8 @@ this repository contains the full copyright notices and license terms. -->
<field name="agent"/> <field name="agent"/>
<label name="type"/> <label name="type"/>
<field name="type"/> <field name="type"/>
<label name="source"/> <label name="lead_origin"/>
<field name="source"/> <field name="lead_origin" widget="selection"/>
<label name="reference"/> <label name="reference"/>
<field name="reference"/> <field name="reference"/>
<label name="amount"/> <label name="amount"/>
@ -33,7 +33,7 @@ this repository contains the full copyright notices and license terms. -->
<notebook colspan="6"> <notebook colspan="6">
<page string="Opportunity" id="opportunity"> <page string="Opportunity" id="opportunity">
<label name="payment_term"/> <label name="payment_term"/>
<field name="payment_term"/> <field name="payment_term" widget="selection"/>
<label name="company"/> <label name="company"/>
<field name="company"/> <field name="company"/>
<label name="start_date"/> <label name="start_date"/>