Tutorial Openerp Basic Code

  • Home
  • About
  • Template
  • Design
  • Blogger
  • Tips Tricks
Home » openerp » source code » Fields Introduction on Openerp

Fields Introduction on Openerp

Here’s the header of the initialization method of the class any field defined in OpenERP inherits (as you can see in server/bin/osv/fields.py):
def __init__(self, string='unknown', required=False, readonly=False,
             domain=None, context="", states=None, priority=0, change_default=False, size=None,
             ondelete="set null", translate=False, select=False, **args) :
There are a common set of optional parameters that are available to most field types:
change_default:Whether or not the user can define default values on other fields depending on the value of this field. Those default values need to be defined in the ir.values table.
help:A description of how the field should be used: longer and more descriptive than string. It will appear in a tooltip when the mouse hovers over the field.
ondelete:How to handle deletions in a related record. Allowable values are: ‘restrict’, ‘no action’, ‘cascade’, ‘set null’, and ‘set default’.
priority:Not used?
readonly:True if the user cannot edit this field, otherwise False.
required:True if this field must have a value before the object can be saved, otherwise False.
size:The size of the field in the database: number characters or digits.
states:Lets you override other parameters for specific states of this object. Accepts a dictionary with the state names as keys and a list of name/value tuples as the values. For example: states={‘posted’:[(‘readonly’,True)]}
string:The field name as it should appear in a label or column header. Strings containing non-ASCII characters must use python unicode objects. For example: ‘tested’: fields.boolean(u’Testé’)
translate:True if the content of this field should be translated, otherwise False.
                            There are also some optional parameters that are specific to some field types:
context:
Define a variable’s value visible in the view’s context or an on-change function. Used when searching child table of one2many relationship?
domain:
Domain restriction on a relational field.
Default value: [].
Example: domain=[(‘field’,’=’,value)])
invisible:
Hide the field’s value in forms. For example, a password.
on_change:
Default value for the on_change attribute in the view. This will launch a function on the server when the field changes in the client. For example, on_change=”onchange_shop_id(shop_id)”.
relation:
Used when a field is an id reference to another table. This is the name of the table to look in. Most commonly used with related and function field types.
select:
Default value for the select attribute in the view. 1 means basic search, and 2 means advanced search.
f
Share
t
Tweet
g+
Share
?
Unknown
18.02

Belum ada komentar untuk "Fields Introduction on Openerp"

Posting Komentar

Posting Lebih Baru Posting Lama Beranda
Langganan: Posting Komentar (Atom)
Find Us :

Entri Populer

  • Functional Fields On Openerp
    A functional field is a field whose value is calculated by a function (rather than being stored in the database). Parameters: fnct, ar...
  • Relational Types on Openerp
    one2one: A one2one field expresses a one:to:one relation between two objects. It is deprecated. Use many2one instead. Syntax: fields ...
  • Basic Type Fields On Openerp
    boolean: A boolean (true, false). Syntax: fields.boolean('Field Name' [, Optional Parameters]), integer: An integer. S...
  • Create Menu on Openerp
    Menus are records in the ir.ui.menu table. In order to create a new menu entry, you can directly create a record using the record tag. ...
  • Predefined fields in Openerp
    _auto Determines whether a corresponding PostgreSQL table must be generated automatically from the object. Setting _auto to False can be u...
  • Fields Introduction on Openerp
    Here’s the header of the initialization method of the class any field defined in OpenERP inherits (as you can see in server/bin/osv/fields.p...

Mengenai Saya

Unknown
Lihat profil lengkapku
Diberdayakan oleh Blogger.
Copyright 2013 Tutorial Openerp Basic Code - All Rights Reserved
Design by Download software Articel and game free