test cron to table history
This commit is contained in:
parent
e054bf3ee4
commit
19d0e6e73d
|
@ -12,6 +12,7 @@ from . import opportunity
|
||||||
from . import party_validation
|
from . import party_validation
|
||||||
from . import exceptions
|
from . import exceptions
|
||||||
from . import contract
|
from . import contract
|
||||||
|
from . import ir
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
@ -37,7 +38,7 @@ def register():
|
||||||
opportunity.OpportunityKind,
|
opportunity.OpportunityKind,
|
||||||
opportunity.OpportunityKindConcept,
|
opportunity.OpportunityKindConcept,
|
||||||
opportunity.OpportunityCancelledReason,
|
opportunity.OpportunityCancelledReason,
|
||||||
|
ir.Cron,
|
||||||
# opportunity.PartyEvaluationConcept,
|
# opportunity.PartyEvaluationConcept,
|
||||||
# opportunity.PartyEvaluation,
|
# opportunity.PartyEvaluation,
|
||||||
# party_validation.Validation,
|
# party_validation.Validation,
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
from trytond.pool import Pool, PoolMeta
|
||||||
|
|
||||||
|
class Cron(metaclass=PoolMeta):
|
||||||
|
__name__ = 'ir.cron'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def __setup__(cls):
|
||||||
|
super().__setup__()
|
||||||
|
cls.method.selection.extend([
|
||||||
|
('crm.opportunity.validation.history|table_query_consult',
|
||||||
|
"Prueba")
|
||||||
|
])
|
|
@ -38,6 +38,7 @@ class ValidationTemplateAsk(ModelSQL, ModelView):
|
||||||
class ValidationAsk(ModelSQL, ModelView):
|
class ValidationAsk(ModelSQL, ModelView):
|
||||||
"Validation Ask"
|
"Validation Ask"
|
||||||
__name__ = "crm.opportunity.validation"
|
__name__ = "crm.opportunity.validation"
|
||||||
|
_history = True
|
||||||
opportunity = fields.Many2One('crm.opportunity',
|
opportunity = fields.Many2One('crm.opportunity',
|
||||||
'Opportunity', required=True)
|
'Opportunity', required=True)
|
||||||
party = fields.Many2One('party.party',
|
party = fields.Many2One('party.party',
|
||||||
|
@ -76,15 +77,42 @@ class ValidationAsk(ModelSQL, ModelView):
|
||||||
else:
|
else:
|
||||||
self.date_validation = None
|
self.date_validation = None
|
||||||
|
|
||||||
class ValidationHistoryAsk(ModelView, metaclass=PoolMeta):
|
class ValidationHistoryAsk(ModelView, ModelSQL):
|
||||||
"Validation History Ask"
|
"Validation History Ask"
|
||||||
__name__ = "crm.opportunity.validation._history"
|
__name__ = "crm.opportunity.validation.history"
|
||||||
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')
|
||||||
# sort=False, readonly=True
|
# sort=False, readonly=True
|
||||||
comment = fields.Text('Comments')
|
comment = fields.Text('Comments')
|
||||||
validated_by = fields.Many2One('res.user', 'User')
|
validated_by = fields.Many2One('res.user', 'User')
|
||||||
|
|
||||||
|
@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
|
||||||
|
)
|
||||||
|
print(opportunity,'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
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# class PartyValidationTraceability(ModelSQL, ModelView):
|
# class PartyValidationTraceability(ModelSQL, ModelView):
|
||||||
# ''' Model to save traceability of the Party Validation'''
|
# ''' Model to save traceability of the Party Validation'''
|
||||||
# 'Party Validation Traceability'
|
# 'Party Validation Traceability'
|
||||||
|
|
|
@ -95,7 +95,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<menuitem parent="party.menu_party_configuration" sequence="100"
|
<menuitem parent="party.menu_party_configuration" sequence="100"
|
||||||
action="act_validation_template_tree" string="Validation Template" id="menu_validation_template_tree"/>
|
action="act_validation_template_tree" string="Validation Template" id="menu_validation_template_tree"/>
|
||||||
|
|
||||||
<record model="ir.model.access" id="access_crm_validation_history">
|
<!-- <record model="ir.model.access" id="access_crm_validation_history">
|
||||||
<field name="model" search="[('model', '=', 'crm.opportunity.validation._history')]"/>
|
<field name="model" search="[('model', '=', 'crm.opportunity.validation._history')]"/>
|
||||||
<field name="perm_read" eval="True"/>
|
<field name="perm_read" eval="True"/>
|
||||||
<field name="perm_write" eval="True"/>
|
<field name="perm_write" eval="True"/>
|
||||||
|
@ -109,23 +109,23 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<field name="perm_write" eval="True"/>
|
<field name="perm_write" eval="True"/>
|
||||||
<field name="perm_create" eval="True"/>
|
<field name="perm_create" eval="True"/>
|
||||||
<field name="perm_delete" eval="True"/>
|
<field name="perm_delete" eval="True"/>
|
||||||
</record>
|
</record> -->
|
||||||
|
|
||||||
|
|
||||||
<record model="ir.ui.view" id="validation_history_view_tree">
|
<record model="ir.ui.view" id="validation_history_view_tree">
|
||||||
<field name="model">crm.opportunity.validation._history</field>
|
<field name="model">crm.opportunity.validation.history</field>
|
||||||
<field name="type">tree</field>
|
<field name="type">tree</field>
|
||||||
<field name="priority">10</field>
|
<field name="priority">10</field>
|
||||||
<field name="name">validation_history_tree</field>
|
<field name="name">validation_history_tree</field>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.ui.view" id="validation_history_view_form">
|
<record model="ir.ui.view" id="validation_history_view_form">
|
||||||
<field name="model">crm.opportunity.validation._history</field>
|
<field name="model">crm.opportunity.validation.history</field>
|
||||||
<field name="type">form</field>
|
<field name="type">form</field>
|
||||||
<field name="name">validation_history_form</field>
|
<field name="name">validation_history_form</field>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.action.act_window" id="act_validation_history_tree">
|
<record model="ir.action.act_window" id="act_validation_history_tree">
|
||||||
<field name="name">Validation Hystory</field>
|
<field name="name">Validation Hystory</field>
|
||||||
<field name="res_model">crm.opportunity.validation._history</field>
|
<field name="res_model">crm.opportunity.validation.history</field>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.action.act_window.view" id="act_validation_history_tree_view1">
|
<record model="ir.action.act_window.view" id="act_validation_history_tree_view1">
|
||||||
<field name="sequence" eval="1"/>
|
<field name="sequence" eval="1"/>
|
||||||
|
|
Loading…
Reference in New Issue