Validation History menu in Party Validations
This commit is contained in:
parent
19d0e6e73d
commit
12ae05fcae
|
@ -1311,7 +1311,7 @@ class OpportunityReport(CompanyReport):
|
|||
|
||||
class OpportunityOnlyReport(CompanyReport):
|
||||
__name__ = 'crm.opportunity_only'
|
||||
print("Hola")
|
||||
|
||||
|
||||
class OpportunityWithoutTaxReport(CompanyReport):
|
||||
__name__ = 'crm.opportunity_without_tax'
|
||||
|
|
|
@ -8,7 +8,8 @@ from trytond.pool import Pool, PoolMeta
|
|||
from trytond.transaction import Transaction
|
||||
from .exceptions import CrmConfigurationError
|
||||
from trytond.i18n import gettext
|
||||
|
||||
# from sql import Null, Literal
|
||||
# from sql.functions import CurrentTimestamp
|
||||
from trytond.modules.company.model import employee_field, set_employee
|
||||
|
||||
# STATES = {'readonly': (Eval('state') != 'draft')}
|
||||
|
@ -80,37 +81,69 @@ class ValidationAsk(ModelSQL, ModelView):
|
|||
class ValidationHistoryAsk(ModelView, ModelSQL):
|
||||
"Validation History Ask"
|
||||
__name__ = "crm.opportunity.validation.history"
|
||||
line_ask = fields.Char('Ask', required=True, select=True)
|
||||
# response = fields.Boolean('Response')
|
||||
#__id = fields.Integer('id')
|
||||
id = fields.Integer('id')
|
||||
company = fields.Many2One('company.company', 'Company')
|
||||
# id = fields.Integer('id', required=True)
|
||||
line_ask = fields.Char('Ask')
|
||||
response = fields.Char('Response')
|
||||
opportunity = fields.Integer('Opportunity')
|
||||
# sort=False, readonly=True
|
||||
comment = fields.Text('Comments')
|
||||
validated_by = fields.Many2One('res.user', 'User')
|
||||
validated_by = fields.Integer('Validated By')
|
||||
|
||||
|
||||
@classmethod
|
||||
def table_query_consult(cls):
|
||||
Opportunity = Pool().get('crm.opportunity.validation')
|
||||
print(Opportunity.__name__)
|
||||
print(Opportunity._history)
|
||||
opportunity = Opportunity.__table_history__()
|
||||
query = opportunity.select(
|
||||
opportunity.line_ask,
|
||||
opportunity.validated_by
|
||||
def table_query(cls):
|
||||
OpportunityHistory = Pool().get('crm.opportunity.validation')
|
||||
Opportunity = Pool().get('crm.opportunity')
|
||||
# print(OpportunityHistory.__name__)
|
||||
# print(Opportunity._history)
|
||||
opportunityhistory = OpportunityHistory.__table_history__()
|
||||
opportunity = Opportunity.__table__()
|
||||
query = opportunityhistory.join(opportunity,
|
||||
condition=opportunity.id==opportunityhistory.opportunity
|
||||
).select(
|
||||
#opportunityhistory.__id.as_('__id'),
|
||||
# opportunityhistory.__id__,
|
||||
opportunityhistory.id,
|
||||
opportunityhistory.create_uid,
|
||||
opportunityhistory.create_date,
|
||||
opportunityhistory.write_uid,
|
||||
opportunityhistory.write_date,
|
||||
# Literal(0).as_('create_uid'),
|
||||
# CurrentTimestamp().as_('create_date'),
|
||||
# cls.write_uid.sql_cast(Literal(Null)).as_('write_uid'),
|
||||
# cls.write_date.sql_cast(Literal(Null)).as_('write_date'),
|
||||
opportunity.company,
|
||||
opportunityhistory.line_ask,
|
||||
opportunityhistory.comment,
|
||||
# opportunity.date_validation,
|
||||
opportunityhistory.opportunity,
|
||||
opportunityhistory.validated_by,
|
||||
# opportunity.party,
|
||||
# opportunity.response,
|
||||
# opportunity.sequence,
|
||||
# opportunity.template,
|
||||
opportunityhistory.response,
|
||||
|
||||
)
|
||||
print(opportunity,'tabla')
|
||||
print(opportunityhistory,'tabla')
|
||||
cursor = Transaction().connection.cursor()
|
||||
cursor.execute(*query)
|
||||
result = cursor.fetchall()
|
||||
print(len(result),'result')
|
||||
|
||||
return opportunity.select(
|
||||
|
||||
# Max(opportunity.create_uid).as_('create_uid'),
|
||||
# Max(opportunity.create_date).as_('create_date'),
|
||||
# Max(opportunity.write_uid).as_('write_uid'),
|
||||
# Max(opportunity.write_date).as_('write_date'),
|
||||
opportunity.line_ask,
|
||||
opportunity.validated_by
|
||||
)
|
||||
print(query,'query')
|
||||
print(result,'result')
|
||||
return query
|
||||
# return opportunity.select(
|
||||
#
|
||||
# # Max(opportunity.create_uid).as_('create_uid'),
|
||||
# # Max(opportunity.create_date).as_('create_date'),
|
||||
# # Max(opportunity.write_uid).as_('write_uid'),
|
||||
# # Max(opportunity.write_date).as_('write_date'),
|
||||
# opportunity.line_ask,
|
||||
# opportunity.validated_by
|
||||
# )
|
||||
|
||||
|
||||
# class PartyValidationTraceability(ModelSQL, ModelView):
|
||||
|
|
|
@ -2,7 +2,23 @@
|
|||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<data>
|
||||
|
||||
<record model="ir.model.access" id="access_crm_validation_history">
|
||||
<field name="model" search="[('model', '=', 'crm.opportunity.validation.history')]"/>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="True"/>
|
||||
<field name="perm_create" eval="True"/>
|
||||
<field name="perm_delete" eval="True"/>
|
||||
</record>
|
||||
<record model="ir.model.access" id="access_crm_validation_history_sale">
|
||||
<field name="model" search="[('model', '=', 'crm.opportunity.validation.history')]"/>
|
||||
<field name="group" ref="sale.group_sale"/>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="True"/>
|
||||
<field name="perm_create" eval="True"/>
|
||||
<field name="perm_delete" eval="True"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="opportunity_validation_view_tree">
|
||||
<field name="model">crm.opportunity.validation</field>
|
||||
|
@ -95,23 +111,6 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<menuitem parent="party.menu_party_configuration" sequence="100"
|
||||
action="act_validation_template_tree" string="Validation Template" id="menu_validation_template_tree"/>
|
||||
|
||||
<!-- <record model="ir.model.access" id="access_crm_validation_history">
|
||||
<field name="model" search="[('model', '=', 'crm.opportunity.validation._history')]"/>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="True"/>
|
||||
<field name="perm_create" eval="True"/>
|
||||
<field name="perm_delete" eval="True"/>
|
||||
</record>
|
||||
<record model="ir.model.access" id="access_crm_validation_history_sale">
|
||||
<field name="model" search="[('model', '=', 'crm.opportunity')]"/>
|
||||
<field name="group" ref="sale.group_sale"/>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="True"/>
|
||||
<field name="perm_create" eval="True"/>
|
||||
<field name="perm_delete" eval="True"/>
|
||||
</record> -->
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="validation_history_view_tree">
|
||||
<field name="model">crm.opportunity.validation.history</field>
|
||||
<field name="type">tree</field>
|
||||
|
|
|
@ -4,6 +4,6 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<form>
|
||||
<label name="line_ask"/>
|
||||
<field name="line_ask"/>
|
||||
<label name="validated_by"/>
|
||||
<field name="validated_by"/>
|
||||
<!-- <label name="validated_by"/>
|
||||
<field name="validated_by"/> -->
|
||||
</form>
|
||||
|
|
|
@ -4,7 +4,11 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<tree>
|
||||
<!-- <field name="create_date" widget="date"/> -->
|
||||
<!-- <field name="create_date" widget="time"/> -->
|
||||
<field name="line_ask"/>
|
||||
|
||||
<field name="id"/>
|
||||
<field name="line_ask" expand="1"/>
|
||||
<field name="opportunity" expand="1"/>
|
||||
<field name="response" expand="1"/>
|
||||
<field name="comment" expand="1"/>
|
||||
<field name="validated_by"/>
|
||||
<!-- <field name="comment"/> -->
|
||||
</tree>
|
||||
|
|
Loading…
Reference in New Issue