On Sun, Feb 19, 2017 at 9:40 AM, Cédric Krier <cedric.kr...@b2ck.com> wrote:

> On 2017-02-19 06:00, Vincent Bastos wrote:
> > For this module there is a function which automatically applies a charge
> > based on certain conditions. So I guess the right way of implementing
> this
> > is actually to create a product record in XML in the module already.
>
> I do not recommend to create product (or any non standardized data) via
> XML because this removes the possibility to the user to customize it.
>
> I guess you have a model that defines the condition to apply the charge
> so on this model you can link to a product. There you could have any
> sort of validation to ensure the product is correctly configured.
>
> I suggest you to look at the module sale_shipment_cost which does
> probably something similar to yours.


I tried this module, but it's not what I am trying to achieve. In my module
I have a function which automatically sends parties invoices by email
or/and post depending on what the party has selected. The module is setup
to automatically charge a party a fee if they have selected to receive an
invoice by post.

At the moment the way I am solving this is by using a couple of fields on
the configuration of the module:

    lease_postage_notice_fee_amount = fields.Numeric(
        'Postage Notice Fee Amount',
        digits=(16, Eval('currency_digits', 2)),
        depends=['currency_digits']
    )
    lease_postage_notice_fee_account = fields.Many2One(
            'account.account', 'Postage Notice Fee Account',
            required=False
    )

When the module creates the invoice it checks on the party if they have
selected to receive by post and adds an invoice line to reflect this.

PS I tested the module sale_shipment_cost and the field "Sale Shipment Cost
Method" on the sale configuration is set to "On Order", but I noticed in
the code that the function default_sale_shipment_cost returns 'shipment'.
Can you explain why this is?

-- 
*Vincent Bastos*
*Lava Lab Software*

-- 
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/CACLX58Da-HYwNy3GRRkVr4fOrDPPGNraiUGu058nR1HdX0qykQ%40mail.gmail.com.

Reply via email to