-
Notifications
You must be signed in to change notification settings - Fork 16
Create A Documents(records) on Any Model(Object).
Jigar edited this page May 16, 2015
·
1 revision
##Create New Document(record) in Odoo on any Model/Object.
Documents(Records) of a Model are created using create(). The method will create a single record and return its database identifier (Id).
create() method takes a mapping of fields and values like (Associative Array, Map, Symbol table, or Dictionary). When creating new document, for a field which has a default value and is not set through the mapping argument, the default value will be used it any default value is set by framework.
##To Create New Document 👍
id = odoo.Create('res.partner', {'name': "Odoo"})Below are equivalent code
####Equivalent Regular Python Code :
id = models.execute_kw(db, uid, password, 'res.partner', 'create', [{
'name': "New Partner",
}])####Equivalent PHP Code :
$id = $models->execute_kw($db, $uid, $password,
'res.partner', 'create',
array(array('name'=>"New Partner")));####Equivalent Ruby Code :
id = models.execute_kw(db, uid, password, 'res.partner', 'create', [{
name: "New Partner",
}])####Equivalent Java Code :
final Integer id = (Integer)models.execute("execute_kw", asList(
db, uid, password,
"res.partner", "create",
asList(new HashMap() {{ put("name", "New Partner"); }})
));