Skip to Content
Menu
This question has been flagged
1 Reply
9863 Views
Author Best Answer

We can set default values in two ways:

1. Form Interface

First Activate Developer Mode. For activating developer mode: go to user context menu(upper right corner) & click on About OpenERP.

Here you can find Option Active the Developer Mode click on that URL, this will reload the Web and Now you will active debug mode.

For eg: For product we have product types as stockable, consumable, service. If we have to set product type as stockable product. follow the below steps.

Go to Product list view and on top of Kanban VIew of Product you will find Debug View# option.

Then Click on Create new Product and in Product Type Select the Stockble product and Now gotoDebug View# and you will find Set Defaults Option and select your default and Save it.

2. Python code

class product_template(osv.osv):
    _name = "product.template"
    _description = "Product Template"

    _columns = {

'type': fields.selection([('consu', 'Consumable'),('service','Service')], 'Product Type', required=True, help="Consumable are product where you don't manage stock, a service is a non-material product provided by a company or an individual."),

}

 _defaults = {       
        'type' : 'consu',
    }

 

Thus we can set default values in OpenERP.

Avatar
Discard

Regarding this last option with python code... are you proposing here to modify the product module? (I say this because I don't see an inherit in the code).