El miércoles, 25 de abril de 2018, 5:55:53 (UTC-3), Sergi Almacellas Abellana 
escribió:
> El 23/04/18 a les 17:17, Francisco Maria Moyano Casco ha escrit:
> > El lunes, 23 de abril de 2018, 4:25:03 (UTC-3), Sergi Almacellas Abellana 
> > escribió:
> >> El 22/04/18 a les 00:12, Francisco Maria Moyano Casco ha escrit:
> >>> Hi,
> >>>   I am trying to put a default cost and list price, but had no success.
> >>>
> >>>   The code am working on is the next one: 
> >>>  
> >>> ............
> >>>    @staticmethod
> >>>    def default_list_price():
> >>>        return 1.0
> >>> ..............
> >>>
> >>>    I know that both fields are Property fields, and that is why my code 
> >>> doesn't work.
> >>>
> >>>    I am inventoring all my assets, and I need to have some defaults 
> >>> values on the product.template
> >>>
> >>>    Regards.
> >>>        Francisco
> >>>
> >> Property fields have their default on the Property table. You should
> >> create a record with the field and not related to any record and this
> >> will be used as default value.
> >>
> > Sorry for bothering again. Is there any example on any module I could use?
> > I understand your reply, but I am not sure how to use it.
> You should create a record on the ir.property model. There is an example
> on the product module:
> 
> http://hg.tryton.org/modules/product/file/4.2/configuration.xml#l32
> 
> Just adapt the field search and the value. For the value make sure to
> use , as prefix which is required by design.

Thank you so much Sergi! That really works. Sorry for spend so much time for 
thank you.

The solution was

<data noupdate="1">
        <record model="ir.property" id="property_cost_price">
            <field name="field"
                search="[('model.model', '=', 'product.template'),
                         ('name', '=', 'cost_price')]"/>
            <field name="value">,0</field>
        </record>
</data>

Same for sale_price

One more time, thank you!
 Francisco

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/d60de57e-e010-4064-b8c6-09a7062a4786%40googlegroups.com.

Reply via email to