Active Developer mode in Odoo v10 by Single Click.

 

Step : 1
Download Chrome Extension From Odoo Debug Mode Extension link.

Step : 2
Open Setting page in Chrome.
Chrome > Settings

Step : 3
than go to Extension Tab that placed on above the Setting.

Step :4
in Extension page simply Drag & Drop the File that you download.

After that u can see the Odoo Debug Mode Icon next to the Search bar in your Chrome Browser.

Link for Download : Odoo Debug Mode Extension

Create wizard in Odoo v10

Step 1 : First create one .py file. e.g message.py file was created or whatever                                    name you like.

Step 2 : Make entry of message.py file in __init__.py file.

 

from odoo import tools, api, fields, models, _
class open_wizard(models.TransientModel):
_name = ‘open.wizard’

name = fields.Char(string=’Name’)
gender = fields.Selection([(‘male’, ‘Male’), (‘female’, ‘Female’)])
mobile = fields.Char(‘Mobile’)
description = fields.Text(‘Description’)

@api.multi
def button_save(self):
return True

Note : Here ‘models.TransientModel’ use because it temporary store value after some time it will automatically delete.

‘def button_save()’ function will save all your data that you enter in wizard.

Step 3 : Now create one .xml file. e.g message.xml was created .

Step 4 : Make entry of message.xml file in __openerp__.py file.

<?xml version="1.0" encoding="utf-8"?>
<odoo>
 <record id="view_open_wizard_form" model="ir.ui.view">
 <field name="name">Personal Information</field>
 <field name="model">open.wizard</field>
 <field name="type">form</field>
 <field name="arch" type="xml">
 <form string="Personal Information">
    <group>
     <group>
       <field name="name"/>
       <field name="gender"/>
     </group>
     <group>
       <field name="mobile"/>
       <field name="description"/>
     </group>
    </group>
    <footer>
     <button name="button_save" string="Save" type="object" class="oe_highlight"/>
       or
     <button special="cancel" string="Cancel" class="oe_link" default_focus="1"/>
   </footer>
 </form>
 </field>
 </record>

 <record id="action_open_wizard" model="ir.actions.act_window">
 <field name="name">Open Wizard</field>
 <field name="res_model">open.wizard</field>
 <field name="view_type">form</field>
 <field name="view_mode">form</field>
 <field name="target">new</field>
 </record>
</odoo>
    
Step 5 : Use this id=”action_open_wizard” to call your wizard in any where inside button.
<button name="%(action_open_wizard)d" string="Edit Notes" type="action"/>

.

Method and Decorator

 

New decorators are just mapper around the new API. The decorator are mandatory as webclient and HTTP controller are not compliant with new API.

api namespace decorators will detect signature using variable name and decide to match old signature or not.

@api.returns

The @api.returns guaranties to returned value. It will return a RecordSet of specified model based on original returned value. If an old API function calls a new API function it will automatically convert it into a list of ids.

@api.returns('sale.order')
def sale_test(self):
    ...
    return x  #RecordSet

@api.one

The @api.one loops automatically on Records of RecordSet for you. Self is redefined as current record:

@api.one
def test(self):
    self.name = 'plks'

@api.multi

In @api.multi Self will be the current RecordSet without iteration. It is the default behavior:

@api.multi
def test(self):
    len(self)

@api.model

The @api.model will convert old API calls to decorated function to new API signature. It allows to be polite when migrating code.

@api.model
def test(self):
    pass

@api.constrains

The @api.constrains will ensure that decorated function will be called on create, write, unlink operation. If a constraint is met the function should raise a openerp.exceptions. Warning with appropriate message.

@api.depends

The @api.depends will trigger the call to the decorated function if any of the fields specified in the decorator is altered by ORM or changed in the form:

@api.depends('name', 'aan_other_fieldge')
def afun(self):
    pass

@api.onchange

The @api.onchange will trigger the call to the decorated function if any of the fields specified in the decorator is changed in the form:

@api.onchange('name')
def onchange_name(self):
   if self.name == 'plks':
      self.age = 22