This question has been flagged
2 Replies
2978 Views

Hi everyone,


I have a new table with differents fields.

Inside the Customer View ( Sale), OpenERP users can create a new record.

However, I would like to fill automatically the two first fields:

- One is the name of the customer

- The other one is the date


Is it possible to do it? If yes, how?


Many thanks for your help,


Selverine

Avatar
Discard
Best Answer

You can set the default value of field in ODOO just traverse this path :

In side Setting-> Technical  ->Actions-

  1. User-defined Defaults

http://prntscr.com/atmt83

Avatar
Discard
Best Answer

Hello Selverine

use defaults in field declaration like

def _selectCustomer(self):

     Customer_id = Customer id you want to set default

     return Customer_id

order_date = fields.Datetime('Order Date', default=fields.datetime.now())

customer_id = fields.Many2one('res.partner', 'Customer', default=_selectCustomer) 

Avatar
Discard