← Back to team overview

banking-addons-drivers team mailing list archive

Re: Attachements instead of dedicated models ?

 

On 17-12-14 10:45, Alexis de Lattre wrote:
>     Dear banking addons community friends,
>
> During a review of the PR https://github.com/OCA/bank-payment/pull/76,
> we started a discussion about the necessity of the models
> "banking.export.sdd" (in account_banking_sepa_direct_debit) and
> "banking.export.sepa" (in account_banking_sepa_credit_transfer) and
> other such models that store the file for the bank that is generated
> by the module. An alternative would be to use an attachement on the
> payment.order model to store the file for the bank. The advantage for
> using attachements:
> 1) it avoids a lot of code
> 2) when the user is on the form view of a payment order, we can
> immediately see if there is an attachement or not, and then he can
> access it without problems (with the current solution, he has to click
> on "More > SEPA Credit Transfer files" to see if there is a file
> attached or not)
>
> Maybe the current solution has some advantages, but I don't know them...
>
> When I initially developped the SEPA modules, I created the models
> banking.export.sdd and banking.export.sepa only because I followed the
> implementation of the existing modules of the banking addons (I
> remember I was already quite surprised of this implementation compared
> to using attachements)
>
> Pedro and Stéphane also support moving to attachements. Stefan, what
> is your opinion on this ?

The rationale is that you can run the wizard over multiple payment
orders. Can you easily link an attachment to multiple payment orders?
Your inherit strategy would work for that, of course.

Cheers,
Stefan.


>
> Of course, updating the code to use attachements is easy... but
> writing the migration script is less easy ! :)



>
> P.S. : If we decide to move to attachements, a possibility would be to
> have an object "payment.order.file" that has "_inherits =
> {'ir.attachment': 'attachment_id'}", like in the module
> base_delivery_carrier_label :
> https://github.com/OCA/carrier-delivery/blob/8.0/__unported__/base_delivery_carrier_label/stock.py#L437
>
> Such an implementation would have 2 advantages:
> 1) we can search on "payment.order.file" and we are sure to get bank
> files (because, if we search on ir.attachements, we may have some
> attachements that have been manually added by the user to the payment
> order and have nothing to do with a bank file).
> 2) we can add some fields on payment.order.file without "polluting"
> the model ir.attachements
>
> Regards,
>
> Alexis
>
>
>


-- 
Therp - Maatwerk in open ontwikkeling

Stefan Rijnhart - Ontwerp en implementatie

stefan@xxxxxxxx
tel +31 (0) 614478606
http://therp.nl
https://twitter.com/therp_stefan



Follow ups

References