odoo-8

Topics related to odoo-8:

Getting started with odoo-8

This section provides an overview of what odoo-8 is, and why a developer might want to use it.

It should also mention any large subjects within odoo-8, and link out to the related topics. Since the Documentation for odoo-8 is new, you may need to create initial versions of those related topics.

How to activate OpenERP Developer Mode

Add CSS and Javascript files to Odoo module

If you are not sure about which option is suitable for you, then try the first option (backend) as it is used in most cases and nearly in all cases if you have not installed the "website" module. Odoo differentiates between "backend" and "frontend" assets because the public website provided by the "website" module uses different styling and JS code than internal pages meant to be used for ERP tasks, i.e. "frontend" is associated with the public website and "backend" is associated with internal pages for ERP (meaning of "frontend" and "backend" are Odoo specific here, but they are both "frontend" in more general sense).

You can not only choose and use one of the options, but also use any combination of them (two of them or all of them) in the same module. Factor a backend, a frontend and a common JS/CSS code into separated files to better adhere to DRY and have suitable code in the public website and in the internal pages.

Do not forget to add "web" (when using option 1) or "website" (when using option 2) to the dependency list in the __openerp__.py manifest.

What are the ORM Methods and details?

Create method: Create new record with specified value. Takes a number of field values, and returns a recordset containing the record created

def create(self,vals):
    return super(class_name, self).create(vals)

Write Method: Update records with given ids with the given field values.Takes a number of field values, writes them to all the records in its recordset. Does not return anything

def write(self,vals):
    return super(class_name, self).write(vals)

Search method: Search for records based on a search domain.Takes a search domain, returns a recordset of matching records. Can return a subset of matching records (offset and limit parameters) and be ordered (order parameter)

self.search([('customer','=',True)])
self.env['res.partner'].search(['partner','=',True])

Browse method: Fetch records as objects allowing to use dot notation to browse fields and relations.Takes a database id or a list of ids and returns a recordset, useful when record ids are obtained from outside Odoo (e.g. round-trip through external system) or when calling methods in the old API.

self.browse([7,8,9])
self.env['res.partner'].browse([7,8,9])

Exists methods: Returns a new recordset containing only the records which exist in the database. Can be used to check whether a record (e.g. obtained externally) still exists.

records = records.exists()

ref method: Environment method returning the record matching a provided external id

self.env.ref('base.group_public')

ensure_one method: checks that the recordset is a singleton (only contains a single record), raises an error otherwise

records.ensure_one()

Custom widgets for fields

'depends': ['web',....]

RPC using Odoo v8 API (Call Python function from JavaScript)

Configure Email - Office 365 in Odoo

Fields used in Odoo 8

Odoo and ORM: Odoo uses ORM(Object Relational Mapping) technique to interact with database. ORM will help to create a virtual object database that can be used within from the Python. In ORM technique each model is represented by a class that subclasses Models.model.

Models.model is the main super class for regular database persisted Odoo models. Odoo models are created by inheriting from this class.

Example:

class Employee(Models.model):
    _name = 'module.employee'

    #Rest of the code goes here

Here _name is a structural attribute, which tells the system about the name of the database table to be created.

Each model has a number of class variables, each of which represents a database field in the model. Each field is represented by an instance of a openerp.fields.Field class. Fields in Odoo are listed below..

1 Boolean Field

ex: flag = fields.Boolean()

2 Char Field

ex: flag = fields.Char()

3 Text

ex: flag = fields.Text()

4 Html

ex: flag = fields.Html()

5 Integer

ex: flag = fields.Integer()

6 Float

ex: flag = fields.Float()

7 Date

ex: flag = fields.Date()

8 Datetime

ex: flag = fields.Datetime()

9 Selection

ex: flag = fields.Selection()

10 Many2one

ex: flag = fields.Many2one()

11 One2many

ex: flag = fields.One2many()

12 Many2many

ex: flag = fields.Many2many()

Create Automated Functions For Model