mirror of
https://bitbucket.org/presik/trytonpsk-crm.git
synced 2023-12-14 05:22:56 +01:00
Show Error Message when Party Validation is incomplete.
This commit is contained in:
parent
7f96240a1c
commit
3dabb41677
|
@ -9,11 +9,13 @@ from . import survey
|
|||
from . import activity
|
||||
from . import opportunity
|
||||
from . import party_validation
|
||||
from . import exceptions
|
||||
# from . import contract
|
||||
|
||||
|
||||
def register():
|
||||
Pool.register(
|
||||
# exceptions.IncompletePartyValidation,
|
||||
survey.SurveyGroup,
|
||||
survey.SurveyTemplate,
|
||||
survey.SurveyTemplateLine,
|
||||
|
|
|
@ -11,3 +11,6 @@ class CrmConfigurationError(UserError):
|
|||
|
||||
class CustomerServiceError(ValidationError):
|
||||
pass
|
||||
|
||||
class IncompletePartyValidation(UserError):
|
||||
pass
|
||||
|
|
|
@ -19,5 +19,12 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="text">The numbered service "%s" can not be deleted.</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.message" id="title_msg_incomplete_party_validation">
|
||||
<field name="text">It's not possible to go to the Quotation status</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_incomplete_party_validation">
|
||||
<field name="text">All the concepts of the third party analysis are not validated.</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
|
@ -15,6 +15,9 @@ from trytond.model.exceptions import AccessError
|
|||
from trytond.pyson import Eval, In, If, Get, Bool
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
# Manage errors
|
||||
from trytond.exceptions import UserError
|
||||
from exceptions import IncompletePartyValidation
|
||||
|
||||
from trytond.ir.attachment import AttachmentCopyMixin
|
||||
from trytond.ir.note import NoteCopyMixin
|
||||
|
@ -166,7 +169,6 @@ class Opportunity(
|
|||
('salesman', 'Salesman'),
|
||||
('referred', 'Referred'),
|
||||
], "Source", required=True, select=True)
|
||||
# party_evaluations = fields.One2Many('crm.party_evaluation', 'opportunity', 'Party Evaluations')
|
||||
party_validations = fields.One2Many('crm.validation.line', 'origin', 'Party Validations')
|
||||
is_prospect = fields.Function(fields.Boolean('Is Prospect'), 'get_is_prospect')
|
||||
is_approved = fields.Function(fields.Boolean('Is Approved'), 'get_is_approved')
|
||||
|
@ -261,16 +263,12 @@ class Opportunity(
|
|||
|
||||
# @fields.depends('party')
|
||||
def get_is_approved(self,name=None):
|
||||
res = False
|
||||
res = True
|
||||
if self.party_validations:
|
||||
print('true')
|
||||
Validation = Pool().get('crm.party_validation')
|
||||
validation = Validation.search([
|
||||
('oppportunity','=',self.opportunity.id)
|
||||
])
|
||||
print(validation,'validation')
|
||||
if len(validation) > 0:
|
||||
res = False
|
||||
for validation in self.party_validations:
|
||||
print(validation.response,'response')
|
||||
res=res and validation.response
|
||||
print(res,'res')
|
||||
return res
|
||||
|
||||
|
||||
|
@ -530,8 +528,12 @@ class Opportunity(
|
|||
def get_party_validation(cls, records):
|
||||
for opportunity in records:
|
||||
if opportunity.is_approved:
|
||||
pass
|
||||
|
||||
print(opportunity.is_approved,'is approved')
|
||||
else:
|
||||
print('No estan validados los campos')
|
||||
raise IncompletePartyValidation(gettext('crm.title_msg_incomplete_party_validation'),
|
||||
gettext('crm.msg_incomplete_party_validation'))
|
||||
# raise UserError("No es posible pasar al estado de Cotización", "Todos los conceptos del anállisis del tercero no estan validados.")
|
||||
|
||||
@classmethod
|
||||
def procces_opportunity(cls, records):
|
||||
|
|
Loading…
Reference in a new issue