Validation History by ask in the view form by each opportunity ask.

This commit is contained in:
Danny Barajas 2022-03-24 16:50:05 -05:00
parent 12ae05fcae
commit 2c14a27b0b
2 changed files with 18 additions and 2 deletions

View File

@ -61,6 +61,7 @@ class ValidationAsk(ModelSQL, ModelView):
# validated_by = employee_field("Validated By")
validated_by = fields.Many2One('res.user', 'User')
blocked = fields.Boolean('Blocked', readonly=True)
history = fields.Function(fields.Text('history'), 'get_history')
@classmethod
def __setup__(cls):
@ -70,6 +71,18 @@ class ValidationAsk(ModelSQL, ModelView):
def get_user(self, name):
return self.create_uid.rec_name
def get_history(self, name):
# return 'Historial'
list_ids = [self.id,]
show_list_as_str = 'Fecha | Pregunta | Usuario' + '\n'
OpportunityHistory = Pool().get('crm.opportunity.validation')
HistoryByAsk = OpportunityHistory.history_revisions(list_ids)
for record in HistoryByAsk:
# print(record,'rec')
show_list_as_str += str(record) + '\n'
return str(show_list_as_str)
# return str(HistoryByAsk)
@fields.depends('response')
def on_change_response(self):
if self.response:

View File

@ -12,7 +12,10 @@ this repository contains the full copyright notices and license terms. -->
<field name="response"/>
<separator name="comment" colspan="4"/>
<field name="comment" colspan="4"/>
<notebook colspan="4">
<page string="History" id="history">
<field name="history" colspan="4"/>
</page>
</notebook>
</form>