mirror of
https://bitbucket.org/presik/trytonpsk-crm.git
synced 2023-12-14 05:22:56 +01:00
Functionality tab Party Validation in state Analisys
This commit is contained in:
parent
53467e0d5b
commit
89ccbaa3de
16
locale/es.po
16
locale/es.po
|
@ -344,7 +344,7 @@ msgstr "Ventas"
|
||||||
|
|
||||||
msgctxt "field:crm.opportunity,source:"
|
msgctxt "field:crm.opportunity,source:"
|
||||||
msgid "Source"
|
msgid "Source"
|
||||||
msgstr "Original"
|
msgstr "Origen"
|
||||||
|
|
||||||
msgctxt "field:crm.opportunity,start_date:"
|
msgctxt "field:crm.opportunity,start_date:"
|
||||||
msgid "Start Date"
|
msgid "Start Date"
|
||||||
|
@ -801,11 +801,23 @@ msgctxt ""
|
||||||
msgid "Analysis"
|
msgid "Analysis"
|
||||||
msgstr "Analisis"
|
msgstr "Analisis"
|
||||||
|
|
||||||
|
#, fuzzy
|
||||||
|
msgctxt ""
|
||||||
|
"model:ir.action.act_window.domain,name:act_crm_opportunity_form_domain_cancelled"
|
||||||
|
msgid "Cancelled"
|
||||||
|
msgstr "Cancelado"
|
||||||
|
|
||||||
msgctxt ""
|
msgctxt ""
|
||||||
"model:ir.action.act_window.domain,name:act_crm_opportunity_form_domain_internal_validation"
|
"model:ir.action.act_window.domain,name:act_crm_opportunity_form_domain_internal_validation"
|
||||||
msgid "Internal Validation"
|
msgid "Internal Validation"
|
||||||
msgstr "Validación Interna"
|
msgstr "Validación Interna"
|
||||||
|
|
||||||
|
#, fuzzy
|
||||||
|
msgctxt ""
|
||||||
|
"model:ir.action.act_window.domain,name:act_crm_opportunity_form_domain_lost"
|
||||||
|
msgid "Lost"
|
||||||
|
msgstr "Perdido"
|
||||||
|
|
||||||
msgctxt ""
|
msgctxt ""
|
||||||
"model:ir.action.act_window.domain,name:act_crm_opportunity_form_domain_prospecting"
|
"model:ir.action.act_window.domain,name:act_crm_opportunity_form_domain_prospecting"
|
||||||
msgid "Prospecting"
|
msgid "Prospecting"
|
||||||
|
@ -2087,7 +2099,7 @@ msgstr "Teléfono"
|
||||||
|
|
||||||
msgctxt "selection:crm.opportunity,source:"
|
msgctxt "selection:crm.opportunity,source:"
|
||||||
msgid "Referred"
|
msgid "Referred"
|
||||||
msgstr ""
|
msgstr "Referido"
|
||||||
|
|
||||||
msgctxt "selection:crm.opportunity,source:"
|
msgctxt "selection:crm.opportunity,source:"
|
||||||
msgid "Salesman"
|
msgid "Salesman"
|
||||||
|
|
|
@ -168,6 +168,7 @@ class Opportunity(
|
||||||
], "Source", required=True, select=True)
|
], "Source", required=True, select=True)
|
||||||
# party_evaluations = fields.One2Many('crm.party_evaluation', 'opportunity', 'Party Evaluations')
|
# party_evaluations = fields.One2Many('crm.party_evaluation', 'opportunity', 'Party Evaluations')
|
||||||
party_validations = fields.One2Many('crm.validation.line', 'origin', 'Party Validations')
|
party_validations = fields.One2Many('crm.validation.line', 'origin', 'Party Validations')
|
||||||
|
is_prospect = fields.Function(fields.Boolean('Is Prospect'), 'get_is_prospect')
|
||||||
|
|
||||||
|
|
||||||
# del _states_start, _depends_start
|
# del _states_start, _depends_start
|
||||||
|
@ -239,11 +240,26 @@ class Opportunity(
|
||||||
'lost': {
|
'lost': {
|
||||||
'invisible': ~Eval('state').in_(['review', 'internal_validation']),
|
'invisible': ~Eval('state').in_(['review', 'internal_validation']),
|
||||||
},
|
},
|
||||||
# 'cancelled': {
|
'cancelled': {
|
||||||
# 'invisible': ~Eval('state').in_(['prospecting']),
|
'invisible': ~Eval('state').in_(['prospecting','quotation']),
|
||||||
# },
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@fields.depends('party')
|
||||||
|
def get_is_prospect(self,name=None):
|
||||||
|
res = True
|
||||||
|
if self.party:
|
||||||
|
Invoice = Pool().get('account.invoice')
|
||||||
|
invoices = Invoice.search([
|
||||||
|
('party','=',self.party.id),
|
||||||
|
('type','=','out'),
|
||||||
|
('state','!=','draft')
|
||||||
|
])
|
||||||
|
if len(invoices) > 0:
|
||||||
|
res = False
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_state():
|
def default_state():
|
||||||
return 'prospecting'
|
return 'prospecting'
|
||||||
|
@ -416,7 +432,45 @@ class Opportunity(
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
@Workflow.transition('analysis')
|
@Workflow.transition('analysis')
|
||||||
def analysis(cls, records):
|
def analysis(cls, records):
|
||||||
pass
|
cls.check_party(records)
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def check_party(cls,records):
|
||||||
|
ValidationTemplate = Pool().get('crm.validation_template')
|
||||||
|
ValidationLine = Pool().get('crm.validation.line')
|
||||||
|
def get_lines(template):
|
||||||
|
lines = []
|
||||||
|
for line in template.lines:
|
||||||
|
value = {
|
||||||
|
'origin':record.id,
|
||||||
|
'party':record.party.id,
|
||||||
|
'sequence':line.sequence,
|
||||||
|
'line_ask':line.ask
|
||||||
|
}
|
||||||
|
lines.append(value)
|
||||||
|
lines = ValidationLine.create(lines)
|
||||||
|
|
||||||
|
return lines
|
||||||
|
|
||||||
|
for record in records:
|
||||||
|
lines = None
|
||||||
|
if record.is_prospect:
|
||||||
|
template, = ValidationTemplate.search([
|
||||||
|
('type','=','prospect'),
|
||||||
|
])
|
||||||
|
lines = get_lines(template)
|
||||||
|
|
||||||
|
else:
|
||||||
|
template, = ValidationTemplate.search([
|
||||||
|
('type','=','client'),
|
||||||
|
])
|
||||||
|
lines = get_lines(template)
|
||||||
|
if lines:
|
||||||
|
# cls.write([record.id],{'party_validation':lines})
|
||||||
|
# record.party_validations = [('create',lines)]
|
||||||
|
record.party_validations = lines
|
||||||
|
record.save()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
|
@ -441,7 +495,9 @@ class Opportunity(
|
||||||
@Workflow.transition('quotation')
|
@Workflow.transition('quotation')
|
||||||
@set_employee('converted_by')
|
@set_employee('converted_by')
|
||||||
def quotation(cls, records):
|
def quotation(cls, records):
|
||||||
pass
|
# Analyze if party validation is true in all lines
|
||||||
|
cls.get_party_validation(records)
|
||||||
|
# cls.procces_opportunity(records)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_forecast(self):
|
def is_forecast(self):
|
||||||
|
@ -455,6 +511,19 @@ class Opportunity(
|
||||||
def accepted(cls, records):
|
def accepted(cls, records):
|
||||||
cls.procces_opportunity(records)
|
cls.procces_opportunity(records)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_party_validation(cls, records):
|
||||||
|
|
||||||
|
for opportunity in records:
|
||||||
|
# print(opportunity,'Opportunity')
|
||||||
|
# print(opportunity.party_validations,'validations')
|
||||||
|
if opportunity.type == 'contract':
|
||||||
|
pass
|
||||||
|
# cls.procces_opportunity(records)
|
||||||
|
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def procces_opportunity(cls, records):
|
def procces_opportunity(cls, records):
|
||||||
for opportunity in records:
|
for opportunity in records:
|
||||||
|
@ -479,15 +548,15 @@ class Opportunity(
|
||||||
'state': 'lost',
|
'state': 'lost',
|
||||||
})
|
})
|
||||||
|
|
||||||
# @classmethod
|
@classmethod
|
||||||
# @ModelView.button
|
@ModelView.button
|
||||||
# @Workflow.transition('cancelled')
|
@Workflow.transition('cancelled')
|
||||||
# def cancelled(cls, records):
|
def cancelled(cls, records):
|
||||||
# pass
|
pass
|
||||||
# Date = Pool().get('ir.date')
|
Date = Pool().get('ir.date')
|
||||||
# cls.write([o for o in records if o.is_forecast], {
|
cls.write([o for o in records if o.is_forecast], {
|
||||||
# 'end_date': Date.today(),
|
'end_date': Date.today(),
|
||||||
# })
|
})
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _sale_won_states():
|
def _sale_won_states():
|
||||||
|
|
|
@ -127,7 +127,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<field name="count" eval="True"/>
|
<field name="count" eval="True"/>
|
||||||
<field name="act_window" ref="act_crm_opportunity_form"/>
|
<field name="act_window" ref="act_crm_opportunity_form"/>
|
||||||
</record>
|
</record>
|
||||||
<!-- <record model="ir.action.act_window.domain"
|
<record model="ir.action.act_window.domain"
|
||||||
id="act_crm_opportunity_form_domain_cancelled">
|
id="act_crm_opportunity_form_domain_cancelled">
|
||||||
<field name="name">Cancelled</field>
|
<field name="name">Cancelled</field>
|
||||||
<field name="sequence" eval="50"/>
|
<field name="sequence" eval="50"/>
|
||||||
|
@ -144,7 +144,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
eval="[('state', '=', 'lost')]" pyson="1"/>
|
eval="[('state', '=', 'lost')]" pyson="1"/>
|
||||||
<field name="count" eval="True"/>
|
<field name="count" eval="True"/>
|
||||||
<field name="act_window" ref="act_crm_opportunity_form"/>
|
<field name="act_window" ref="act_crm_opportunity_form"/>
|
||||||
</record> -->
|
</record>
|
||||||
|
|
||||||
<record model="ir.action.act_window.domain"
|
<record model="ir.action.act_window.domain"
|
||||||
id="act_crm_opportunity_form_domain_all">
|
id="act_crm_opportunity_form_domain_all">
|
||||||
<field name="name">All</field>
|
<field name="name">All</field>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# 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.
|
||||||
from datetime import datetime
|
from datetime import datetime, date
|
||||||
from trytond.report import Report
|
from trytond.report import Report
|
||||||
from trytond.model import ModelView, ModelSQL, fields, Workflow
|
from trytond.model import ModelView, ModelSQL, fields, Workflow
|
||||||
from trytond.pyson import Eval, If, In, Get
|
from trytond.pyson import Eval, If, In, Get
|
||||||
|
@ -39,7 +39,7 @@ class ValidationLine(ModelSQL, ModelView):
|
||||||
party = fields.Many2One('party.party',
|
party = fields.Many2One('party.party',
|
||||||
'Party', required=True)
|
'Party', required=True)
|
||||||
sequence = fields.Integer('Sequence', required=True)
|
sequence = fields.Integer('Sequence', required=True)
|
||||||
date_validation = fields.Date('Date', required=True)
|
date_validation = fields.Date('Date')
|
||||||
line_ask = fields.Char('Ask', required=True, select=True)
|
line_ask = fields.Char('Ask', required=True, select=True)
|
||||||
response = fields.Boolean('Response')
|
response = fields.Boolean('Response')
|
||||||
comment = fields.Text('Comments')
|
comment = fields.Text('Comments')
|
||||||
|
@ -48,3 +48,11 @@ class ValidationLine(ModelSQL, ModelView):
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
super(ValidationLine, cls).__setup__()
|
super(ValidationLine, cls).__setup__()
|
||||||
cls._order.insert(0, ('sequence', 'ASC'))
|
cls._order.insert(0, ('sequence', 'ASC'))
|
||||||
|
|
||||||
|
@fields.depends('response')
|
||||||
|
def on_change_response(self):
|
||||||
|
if self.response:
|
||||||
|
self.date_validation = date.today()
|
||||||
|
else:
|
||||||
|
self.date_validation = None
|
||||||
|
|
||||||
|
|
7
view/inheritance_party_validation.xml
Normal file
7
view/inheritance_party_validation.xml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<data>
|
||||||
|
<xpath expr="/form/page[@name='party']" position="after">
|
||||||
|
<page string="Party Validation" name="party_validations">
|
||||||
|
<field name="party_validations" view_ids="crm.validation_line_view_tree,crm.validation_line_view_form" colspan="4"/>
|
||||||
|
</page>
|
||||||
|
</xpath>
|
||||||
|
</data>
|
|
@ -2,13 +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>
|
<form>
|
||||||
|
<label name="party" colspan="1"/>
|
||||||
<label name="party"/>
|
<field name="party" colspan="3"/>
|
||||||
<field name="party"/>
|
<!-- <label name="date_validation"/>
|
||||||
<label name="date_validation"/>
|
<field name="date_validation"/> -->
|
||||||
<field name="date_validation"/>
|
|
||||||
<label name="line_ask"/>
|
<label name="line_ask"/>
|
||||||
<field name="line_ask"/>
|
<field name="line_ask" />
|
||||||
<label name="response"/>
|
<label name="response"/>
|
||||||
<field name="response"/>
|
<field name="response"/>
|
||||||
<separator name="comment" colspan="4"/>
|
<separator name="comment" colspan="4"/>
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
this repository contains the full copyright notices and license terms. -->
|
this repository contains the full copyright notices and license terms. -->
|
||||||
<tree>
|
<tree>
|
||||||
|
|
||||||
<field name="origin"/>
|
<!-- <field name="origin"/>
|
||||||
<field name="party"/>
|
<field name="party"/> -->
|
||||||
<field name="date_validation"/>
|
<field name="line_ask" colspan="10"/>
|
||||||
<field name="line_ask"/>
|
<field name="response" colspan="2"/>
|
||||||
<field name="response"/>
|
|
||||||
<field name="comment" colspan="4"/>
|
<field name="comment" colspan="4"/>
|
||||||
|
<field name="date_validation" colspan="2"/>
|
||||||
|
|
||||||
</tree>
|
</tree>
|
||||||
|
|
Loading…
Reference in a new issue