New reports and add one transition

This commit is contained in:
Danny Barajas 2022-03-03 17:39:05 -05:00
parent 58ed308d18
commit e8cf177c24
10 changed files with 158013 additions and 88 deletions

View File

@ -61,4 +61,7 @@ def register():
customer_service.MonitoringReport,
survey.SurveyReport,
opportunity.OpportunityReport,
opportunity.OpportunityOnlyReport,
opportunity.OpportunityWithoutTaxReport,
opportunity.OpportunityLargeReport,
module='crm', type_='report')

View File

@ -262,6 +262,7 @@ msgctxt "field:crm.opportunity,amount:"
msgid "Amount"
msgstr "Valor Estimado"
#, fuzzy
msgctxt "field:crm.opportunity,cancelled_reason:"
msgid "Cancelled Reason Concept"
msgstr "Motivo de la Anulación"
@ -318,7 +319,6 @@ msgctxt "field:crm.opportunity,is_prospect:"
msgid "Is Prospect"
msgstr ""
#, fuzzy
msgctxt "field:crm.opportunity,kind_opportunity:"
msgid "Kind Opportunity"
msgstr "Tipo de Oportunidad "
@ -374,7 +374,7 @@ msgstr "Frecuencia de Facturación"
#, fuzzy
msgctxt "field:crm.opportunity,total:"
msgid "Total"
msgstr "Total"
msgstr " Total Linea"
msgctxt "field:crm.opportunity,traceability:"
msgid "Opportunity Traceability"
@ -398,7 +398,7 @@ msgstr "Descripción"
msgctxt "field:crm.opportunity.line,opportunity:"
msgid "Opportunity"
msgstr "Oporunidad"
msgstr "Oportunidad"
msgctxt "field:crm.opportunity.line,opportunity_state:"
msgid "Opportunity State"
@ -715,7 +715,7 @@ msgstr "Motivo de Anulación"
msgctxt "model:crm.opportunity_kind_concept,name:"
msgid "Opportunity Kind Concept"
msgstr "Clase"
msgstr "Tipo de Oportunidad"
msgctxt "model:crm.opportunity_traceability,name:"
msgid "Model to save traceability of the opportunity"
@ -826,8 +826,20 @@ msgid "Monitoring"
msgstr "Seguimiento"
msgctxt "model:ir.action,name:report_opportunity"
msgid "Oportunidad"
msgstr "Propuesta Corta"
msgctxt "model:ir.action,name:report_opportunity_large_format"
msgid "Quotation Large Format"
msgstr "Propuesta Larga"
msgctxt "model:ir.action,name:report_opportunity_only"
msgid "Opportunity"
msgstr "Oportunidad"
msgstr "Cotización con Impuestos"
msgctxt "model:ir.action,name:report_opportunity_without_tax"
msgid "Only Quotation Without Tax"
msgstr "Cotización sin impuestos"
msgctxt "model:ir.action,name:report_survey"
msgid "Survey"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -54,13 +54,14 @@ class Opportunity(
_rec_name = 'number'
_states_start = {
'readonly': Eval('state') != 'lead',
'readonly': ~Eval('state').in_(['prospecting', 'quote_revision', 'review'])
}
_depends_start = ['state']
_states_stop = {
'readonly': Eval('state').in_(
['quote_revision', 'accepted', 'quote_approbation', 'customer_approbation', 'lost', 'cancelled']),
['cancelled']),
}
# 'quote_revision', 'accepted', 'quote_approbation', 'customer_approbation', 'lost',
_depends_stop = ['state']
number = fields.Char('Number', readonly=True, required=True, select=True)
@ -84,8 +85,8 @@ class Opportunity(
party = fields.Many2One(
'party.party', "Party", select=True,
states={
'readonly': ~Eval('state').in_(['prospecting', 'analysis', 'quote_revision', 'review']),
'required': ~Eval('state').in_(['lead', 'lost', 'cancelled']),
'readonly': ~Eval('state').in_(['prospecting', 'quote_revision', 'review']),
# 'required': ~Eval('state').in_(['lead', 'lost', 'cancelled']),
},
context={
'company': Eval('company', -1),
@ -99,11 +100,18 @@ class Opportunity(
search_context={
'related_party': Eval('party'),
},
states={
'readonly': ~Eval('state').in_(['prospecting', 'quote_revision', 'review']),
# 'required': ~Eval('state').in_(['lead', 'lost', 'cancelled']),
},
depends=['party', 'company'])
address = fields.Many2One('party.address', 'Address',
domain=[('party', '=', Eval('party'))],
select=True, depends=['party', 'state'],
states=_states_stop)
states={
'readonly': ~Eval('state').in_(['prospecting', 'quote_revision', 'review']),
# 'required': ~Eval('state').in_(['lead', 'lost', 'cancelled']),
})
company = fields.Many2One('company.company', 'Company', required=True,
select=True,
states={
@ -119,7 +127,10 @@ class Opportunity(
currency_digits = fields.Function(fields.Integer('Currency Digits'),
'get_currency_digits')
amount = fields.Numeric('Amount', digits=(16, Eval('currency_digits', 2)),
states=_states_stop, depends=_depends_stop +
states={
'readonly': ~Eval('state').in_(['prospecting', 'quote_revision', 'review']),
# 'required': ~Eval('state').in_(['lead', 'lost', 'cancelled']),
}, depends=_depends_stop +
['currency_digits'],
help='Estimated revenue amount.')
time_ammount = fields.Selection([
@ -133,15 +144,13 @@ class Opportunity(
payment_term = fields.Many2One('account.invoice.payment_term',
'Payment Term', states={
'readonly': In(Eval('state'),
['converted', 'lost', 'cancelled']),
},
'readonly': ~Eval('state').in_(['prospecting', 'quote_revision', 'review'])
},
depends=['state'])
employee = fields.Many2One('company.employee', 'Employee',
states={
'readonly': _states_stop['readonly'],
'required': ~Eval('state').in_(['lead', 'lost', 'cancelled']),
},
states={
'readonly': ~Eval('state').in_(['prospecting', 'quote_revision', 'review'])
},
depends=['state', 'company'],
domain=[('company', '=', Eval('company'))])
start_date = fields.Date('Start Date', required=True, select=True,
@ -149,21 +158,26 @@ class Opportunity(
end_date = fields.Date('End Date', select=True,
states=_states_stop, depends=_depends_stop)
description = fields.Char('Description',
states=_states_stop, depends=_depends_stop)
states={
'readonly': ~Eval('state').in_(['prospecting', 'quote_revision', 'review']),
# 'required': ~Eval('state').in_(['lead', 'lost', 'cancelled']),
})
comment = fields.Text('Comment', states=_states_stop,
depends=_depends_stop)
lines = fields.One2Many('crm.opportunity.line', 'opportunity', 'Lines',
states=_states_stop, depends=_depends_stop)
states={
'readonly': ~Eval('state').in_(['prospecting', 'quote_revision', 'review']),
# 'required': ~Eval('state').in_(['lead', 'lost', 'cancelled']),
})
conversion_probability = fields.Float('Conversion Probability',
digits=(1, 4), required=True,
domain=[
('conversion_probability', '>=', 0),
('conversion_probability', '<=', 1),
],
states={
'readonly': ~Eval('state').in_(
['opportunity', 'lead', 'converted']),
},
states={
'readonly': ~Eval('state').in_(['prospecting', 'quote_revision', 'review'])
},
depends=['state'], help="Percentage between 0 and 100.")
lost_reason = fields.Text('Reason for loss', states={
'invisible': Eval('state') != 'lost',
@ -255,8 +269,9 @@ class Opportunity(
('quote_approbation', 'quotation'),
('quote_approbation', 'quote_revision'),
('quote_approbation', 'customer_approbation'),
('quote_revision', 'quotation'),
('quote_revision', 'quote_approbation'),
('quote_revision', 'cancelled'),
('customer_approbation', 'quote_revision'),
('customer_approbation', 'accepted'),
('customer_approbation', 'lost'),
# ('quote_approbation', 'quotation'),
@ -1116,6 +1131,14 @@ class SaleOpportunityMonthly(SaleOpportunityReportMixin, ModelSQL, ModelView):
class OpportunityReport(CompanyReport):
__name__ = 'crm.opportunity'
class OpportunityOnlyReport(CompanyReport):
__name__ = 'crm.opportunity_only'
class OpportunityWithoutTaxReport(CompanyReport):
__name__ = 'crm.opportunity_without_tax'
class OpportunityLargeReport(CompanyReport):
__name__ = 'crm.opportunity_large_format'
class SaleOpportunityEmployeeMonthly(
SaleOpportunityReportMixin, ModelSQL, ModelView):

View File

@ -301,7 +301,7 @@ this repository contains the full copyright notices and license terms. -->
</record>
<record model="ir.action.report" id="report_opportunity">
<field name="name">Opportunity</field>
<field name="name">Quotation Short Format</field>
<field name="model">crm.opportunity</field>
<field name="report_name">crm.opportunity</field>
<field name="report">crm/opportunity.fodt</field>
@ -312,6 +312,42 @@ this repository contains the full copyright notices and license terms. -->
<field name="action" ref="report_opportunity"/>
</record>
<record model="ir.action.report" id="report_opportunity_only">
<field name="name">Only Quotation with Tax</field>
<field name="model">crm.opportunity</field>
<field name="report_name">crm.opportunity_only</field>
<field name="report">crm/opportunity_only.fodt</field>
</record>
<record model="ir.action.keyword" id="report_opportunity_only_keyword">
<field name="keyword">form_print</field>
<field name="model">crm.opportunity,-1</field>
<field name="action" ref="report_opportunity_only"/>
</record>
<record model="ir.action.report" id="report_opportunity_without_tax">
<field name="name">Only Quotation Without Tax</field>
<field name="model">crm.opportunity</field>
<field name="report_name">crm.opportunity_without_tax</field>
<field name="report">crm/opportunity_without_tax.fodt</field>
</record>
<record model="ir.action.keyword" id="report_opportunity_without_tax_keyword">
<field name="keyword">form_print</field>
<field name="model">crm.opportunity,-1</field>
<field name="action" ref="report_opportunity_without_tax"/>
</record>
<record model="ir.action.report" id="report_opportunity_large_format">
<field name="name">Quotation Large Format</field>
<field name="model">crm.opportunity</field>
<field name="report_name">crm.opportunity_large_format</field>
<field name="report">crm/opportunity_large_format.fodt</field>
</record>
<record model="ir.action.keyword" id="report_opportunity_large_format_keyword">
<field name="keyword">form_print</field>
<field name="model">crm.opportunity,-1</field>
<field name="action" ref="report_opportunity_large_format"/>
</record>
<record model="ir.ui.view" id="opportunity_traceability_view_tree">

30719
opportunity_bk (copy).fodt Normal file

File diff suppressed because it is too large Load Diff

32847
opportunity_large_format.fodt Normal file

File diff suppressed because it is too large Load Diff

30719
opportunity_only.fodt Normal file

File diff suppressed because it is too large Load Diff

30719
opportunity_without_tax.fodt Normal file

File diff suppressed because it is too large Load Diff