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