Re: [tryton-dev] How to add to the configuration wizard when a new module is installed

2017-03-02 Thread Vincent Bastos


On Saturday, February 18, 2017 at 10:20:07 PM UTC+10, Cédric Krier wrote:
>
> On 2017-02-17 22:42, Vincent Bastos wrote: 
> > Hi, 
> > 
> > I am unable to figure out how modules are able to "append" to the 
> > configuration wizard when a new module is installed. 
> > 
> > I have created a configuration.py file and configuration.xml file with a 
> > form, but this does not come up when I install my module. 
> > 
> > I thought that Tryton automatically added configuration files to the 
> > wizard, but I was unable to find this in the code. 
>
> Explicit is better than implicit. 
> You have to create an entry in ir.module.config_wizard.item 
>

I suppose I also have to create Configuration class that extends a Wizard?

-- 
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/b9ec2a2b-b685-4d3f-b71d-95ba42ac19f7%40googlegroups.com.


Re: [tryton-dev] Force an account on a product in a configuration form

2017-03-02 Thread Vincent Bastos
On Sun, Feb 19, 2017 at 9:40 AM, Cédric Krier  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.