← Back to team overview

banking-addons-drivers team mailing list archive

Fields communication and communication2

 

Dear banking-addons community friends,

In the account_payment module of the addons, there are 2 "communication" fields on the payment line : - 'communication': fields.char('Communication', size=64, required=True, help="Used as the message between ordering customer and current company. Depicts 'What do you want to say to the recipient about this order ?'"), - 'communication2': fields.char('Communication 2', size=64, help='The successor message of Communication.'),

There is a field "state" which gives the choice between 2 communications types : Free (default) or Structured : 'state': fields.selection([('normal','Free'), ('structured','Structured')], 'Communication Type', required=True),

At the end of the account_payment/account_payment.py file, there is this piece of oce :

    def fields_get(self, cr, uid, fields=None, context=None):
res = super(payment_line, self).fields_get(cr, uid, fields, context)
        if 'communication2' in res:
            res['communication2'].setdefault('states', {})
res['communication2']['states']['structured'] = [('readonly', True)] res['communication2']['states']['normal'] = [('readonly', False)]
        return res

As a consequence :
- the field "communication" is usable when the communication type is "structured"
- the field "communication2" is usable when the commnication type is "free"
By the way, this is not explained at all in the "help" message of the communication fields !

Currently, in the code of the SEPA modules, I only use the field "communication" (without taking into account the communication type) and I ignore the field communication2. This is a problem because, when the communication is "Free", the user cannot modify the field "communication", so he can't modify the value that will be used in the SEPA XML file.

I see 2 options :

1) We think that the behavior of the module account_payment is good i.e. "communication" is used for structured and "communication2" is used for "free".
=> in the banking-addons, we should :
- update the help messages of the 2 communication fields to explain their respective use case (and maybe also the label of the fields) - modify the code of the SEPA modules to use communication2 when type = Free and use communication when type = Structured.

2) We think that the behavior of the module account_payment is a mess, and we prefer to have a single "communication" field, that is used by the 2 types.
=> in the banking-addons, we should :
- hide the field communication2
- neutralize the method fields_get() to avoid the readonly switch
- maybe also inherit the creating of the payment line from the wizard to have the right value in the field communication.

I would love to have your opinion on this. Once we reach an agreement, I can take care of updating the code.

Regards,

--
Alexis de Lattre



Follow ups