Tryton - Issues



Author rvong
Recipients Artem, ced, pokoli, roffez
Date 2018-09-13.02:33:24
Please ignore my previous message, I should have dig a little deeper and provide more information before posting messages here. So, this time I would like to share what I have found.

The error states that object does not have the attribute "type" in the dictionary _values of the model. This happens because default values were not initialized. I noticed this should have been done with the call to "default_ask" function in the PayInvoice wizard class. I put logging in the function _execute from class Wizard and found that it was never called. This is because the payment was for the entire amount of the invoice hence it jumped from state "choice" to "pay".

Here is the log statement that I put on the _execution function:
        log.debug('Calling {}._execute, state_name: {}, class of state: {}'.format(
                type(self).__name__, state_name, type(state).__name__))

Here is the output:

Thu Sep 13 00:20:59 2018] DEBUG:trytond.wizard.wizard:Calling, state_name: start, class of state: StateView
Thu Sep 13 00:21:28 2018] DEBUG:trytond.wizard.wizard:Calling, state_name: choice, class of state: StateTransition
Thu Sep 13 00:21:28 2018] DEBUG:trytond.wizard.wizard:Calling, state_name: pay, class of state: StateTransition

I think a check must be put in the transition_pay function when the "ask" state was never used and therefore no default values.

I think the solution is change the statement:

 ... self.ask.type != 'writeoff' 

  ... getattr(self.ask, 'type'. '') != 'writeoff'...
Date User Action Args
2018-09-13 02:33:24rvongsetmessageid: <>
2018-09-13 02:33:24rvongsetrecipients: + ced, pokoli, roffez, Artem
2018-09-13 02:33:24rvonglinkissue7192 messages
2018-09-13 02:33:24rvongcreate

Showing 10 items. Show all history (warning: this could be VERY long)