Minor fix
This commit is contained in:
parent
6338992556
commit
dced7a4cad
|
@ -77,14 +77,12 @@ class Opportunity(
|
||||||
},
|
},
|
||||||
depends=['party', 'company'])
|
depends=['party', 'company'])
|
||||||
address = fields.Many2One('party.address', 'Address',
|
address = fields.Many2One('party.address', 'Address',
|
||||||
domain=[('party', '=', Eval('party'))],
|
domain=[('party', '=', Eval('party'))], depends=['party', 'state'],
|
||||||
select=True, depends=['party', 'state'],
|
|
||||||
states={
|
states={
|
||||||
'readonly': Eval('state').in_(['won', 'lost']),
|
'readonly': Eval('state').in_(['won', 'lost']),
|
||||||
# 'required': ~Eval('state').in_(['lead', 'lost', 'cancelled']),
|
# 'required': ~Eval('state').in_(['lead', 'lost', 'cancelled']),
|
||||||
})
|
})
|
||||||
company = fields.Many2One('company.company', 'Company', required=True,
|
company = fields.Many2One('company.company', 'Company', required=True,
|
||||||
select=True,
|
|
||||||
states={
|
states={
|
||||||
'readonly': _states_stop['readonly'] | Eval('party', True),
|
'readonly': _states_stop['readonly'] | Eval('party', True),
|
||||||
},
|
},
|
||||||
|
@ -112,7 +110,7 @@ class Opportunity(
|
||||||
},
|
},
|
||||||
depends=['state', 'company'],
|
depends=['state', 'company'],
|
||||||
domain=[('company', '=', Eval('company'))])
|
domain=[('company', '=', Eval('company'))])
|
||||||
start_date = fields.Date('Start Date', required=True, select=True,
|
start_date = fields.Date('Start Date', required=True,
|
||||||
states=_states_start, depends=_depends_start)
|
states=_states_start, depends=_depends_start)
|
||||||
end_date = fields.Date('End Date', states=_states_stop,
|
end_date = fields.Date('End Date', states=_states_stop,
|
||||||
depends=_depends_stop)
|
depends=_depends_stop)
|
||||||
|
@ -403,7 +401,7 @@ class Opportunity(
|
||||||
if self.lines:
|
if self.lines:
|
||||||
for line in self.lines:
|
for line in self.lines:
|
||||||
contract_lines.append(line.get_contract_line())
|
contract_lines.append(line.get_contract_line())
|
||||||
contract['product_lines'] = [('create',contract_lines)]
|
contract['product_lines'] = [('create', contract_lines)]
|
||||||
return contract
|
return contract
|
||||||
else:
|
else:
|
||||||
raise UserError("No hay lineas de producto")
|
raise UserError("No hay lineas de producto")
|
||||||
|
@ -423,8 +421,7 @@ class Opportunity(
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
@Workflow.transition('opportunity')
|
@Workflow.transition('opportunity')
|
||||||
def opportunity(cls, records):
|
def opportunity(cls, records):
|
||||||
print('entro pero se murio')
|
pass
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
|
@ -548,18 +545,17 @@ class Opportunity(
|
||||||
@Workflow.transition('lost')
|
@Workflow.transition('lost')
|
||||||
def lost(cls, records):
|
def lost(cls, records):
|
||||||
Date = Pool().get('ir.date')
|
Date = Pool().get('ir.date')
|
||||||
# if o.is_forecast
|
|
||||||
cls.write([o for o in records], {
|
cls.write([o for o in records], {
|
||||||
'end_date': Date.today(),
|
'end_date': Date.today(),
|
||||||
'state': 'lost',
|
'state': 'lost',
|
||||||
})
|
})
|
||||||
history = []
|
history = []
|
||||||
for record in records:
|
for record in records:
|
||||||
value = {
|
value = {
|
||||||
'opportunity':record.id,
|
'opportunity': record.id,
|
||||||
'validated_by':Transaction().user,
|
'validated_by': Transaction().user,
|
||||||
'create_date':date.today(),
|
'create_date': date.today(),
|
||||||
'action':'Cambio de estado a Perdido'
|
'action': 'Cambio de estado a Perdido'
|
||||||
}
|
}
|
||||||
history.append(value)
|
history.append(value)
|
||||||
|
|
||||||
|
@ -567,18 +563,17 @@ class Opportunity(
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
@Workflow.transition('cancelled')
|
@Workflow.transition('cancelled')
|
||||||
def cancelled(cls, records):
|
def cancelled(cls, records):
|
||||||
# pass
|
|
||||||
Date = Pool().get('ir.date')
|
Date = Pool().get('ir.date')
|
||||||
cls.write([o for o in records if o.cancelled_reason], {
|
cls.write([o for o in records if o.cancelled_reason], {
|
||||||
'end_date': Date.today(),
|
'end_date': Date.today(),
|
||||||
})
|
})
|
||||||
history = []
|
history = []
|
||||||
for record in records:
|
for record in records:
|
||||||
value = {
|
value = {
|
||||||
'opportunity':record.id,
|
'opportunity': record.id,
|
||||||
'validated_by':Transaction().user,
|
'validated_by': Transaction().user,
|
||||||
'create_date':date.today(),
|
'create_date': date.today(),
|
||||||
'action':'Cambio de estado a Anulado'
|
'action': 'Cambio de estado a Anulado'
|
||||||
}
|
}
|
||||||
history.append(value)
|
history.append(value)
|
||||||
|
|
||||||
|
@ -699,7 +694,8 @@ class OpportunityCancellReason(ModelSQL, ModelView):
|
||||||
class CrmOpportunityFollowUp(sequence_ordered(), ModelSQL, ModelView):
|
class CrmOpportunityFollowUp(sequence_ordered(), ModelSQL, ModelView):
|
||||||
'CRM Opportunity FollowUp'
|
'CRM Opportunity FollowUp'
|
||||||
__name__ = "crm.opportunity.follow_up"
|
__name__ = "crm.opportunity.follow_up"
|
||||||
opportunity = fields.Many2One('crm.opportunity', 'Opportunity', required=True )
|
opportunity = fields.Many2One('crm.opportunity', 'Opportunity',
|
||||||
|
required=True)
|
||||||
follow_date = fields.Date('Follow Date')
|
follow_date = fields.Date('Follow Date')
|
||||||
action = fields.Char('Action')
|
action = fields.Char('Action')
|
||||||
notes = fields.Text('Notes')
|
notes = fields.Text('Notes')
|
||||||
|
@ -741,11 +737,10 @@ class CrmOpportunityLine(sequence_ordered(), ModelSQL, ModelView):
|
||||||
'readonly': Eval('state').in_(['won', 'lost'])
|
'readonly': Eval('state').in_(['won', 'lost'])
|
||||||
})
|
})
|
||||||
opportunity = fields.Many2One('crm.opportunity', 'Opportunity',
|
opportunity = fields.Many2One('crm.opportunity', 'Opportunity',
|
||||||
ondelete='CASCADE', select=True, required=True,
|
ondelete='CASCADE', required=True, depends=_depends,
|
||||||
states={
|
states={
|
||||||
'readonly': _states['readonly'] & Bool(Eval('opportunity')),
|
'readonly': _states['readonly'] & Bool(Eval('opportunity')),
|
||||||
},
|
})
|
||||||
depends=_depends)
|
|
||||||
opportunity_state = fields.Function(
|
opportunity_state = fields.Function(
|
||||||
fields.Selection('get_opportunity_states', "Opportunity State"),
|
fields.Selection('get_opportunity_states', "Opportunity State"),
|
||||||
'on_change_with_opportunity_state')
|
'on_change_with_opportunity_state')
|
||||||
|
@ -915,19 +910,19 @@ class SaleOpportunityReportMixin:
|
||||||
lost = fields.Integer('Lost')
|
lost = fields.Integer('Lost')
|
||||||
company = fields.Many2One('company.company', 'Company')
|
company = fields.Many2One('company.company', 'Company')
|
||||||
currency = fields.Function(fields.Many2One('currency.currency',
|
currency = fields.Function(fields.Many2One('currency.currency',
|
||||||
'Currency'), 'get_currency')
|
'Currency'), 'get_currency')
|
||||||
currency_digits = fields.Function(fields.Integer('Currency Digits'),
|
currency_digits = fields.Function(fields.Integer('Currency Digits'),
|
||||||
'get_currency_digits')
|
'get_currency_digits')
|
||||||
amount = fields.Numeric('Amount', digits=(16, Eval('currency_digits', 2)),
|
amount = fields.Numeric('Amount', digits=(16, Eval('currency_digits', 2)),
|
||||||
depends=['currency_digits'])
|
depends=['currency_digits'])
|
||||||
converted_amount = fields.Numeric('Converted Amount',
|
converted_amount = fields.Numeric('Converted Amount',
|
||||||
digits=(16, Eval('currency_digits', 2)),
|
digits=(16, Eval('currency_digits', 2)),
|
||||||
depends=['currency_digits'])
|
depends=['currency_digits'])
|
||||||
conversion_amount_rate = fields.Function(fields.Float(
|
conversion_amount_rate = fields.Function(fields.Float(
|
||||||
'Conversion Amount Rate', digits=(1, 4)), 'get_conversion_amount_rate')
|
'Conversion Amount Rate', digits=(1, 4)), 'get_conversion_amount_rate')
|
||||||
won_amount = fields.Numeric('Won Amount',
|
won_amount = fields.Numeric('Won Amount',
|
||||||
digits=(16, Eval('currency_digits', 2)),
|
digits=(16, Eval('currency_digits', 2)),
|
||||||
depends=['currency_digits'])
|
depends=['currency_digits'])
|
||||||
winning_amount_rate = fields.Function(fields.Float(
|
winning_amount_rate = fields.Function(fields.Float(
|
||||||
'Winning Amount Rate', digits=(1, 4)), 'get_winning_amount_rate')
|
'Winning Amount Rate', digits=(1, 4)), 'get_winning_amount_rate')
|
||||||
|
|
||||||
|
|
3
party.py
3
party.py
|
@ -19,7 +19,8 @@ class Party(metaclass=PoolMeta):
|
||||||
# sales_count = fields.Integer('Sales Count')
|
# sales_count = fields.Integer('Sales Count')
|
||||||
# opportunities = fields.One2Many('crm.opportunity', 'party',
|
# opportunities = fields.One2Many('crm.opportunity', 'party',
|
||||||
# 'Opportunities', domain=[('party', '=', Eval('id'))])
|
# 'Opportunities', domain=[('party', '=', Eval('id'))])
|
||||||
party_validations = fields.One2Many('crm.opportunity.validation', 'party', 'Party Validations')
|
party_validations = fields.One2Many('crm.opportunity.validation', 'party',
|
||||||
|
'Party Validations')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
|
|
Loading…
Reference in New Issue