Showing posts with label create. Show all posts
Showing posts with label create. Show all posts

Monday, 20 March 2017

How i can create module openerp 7 / Odoo 8 ?

Hi,

Quick Start Guide

For Odoo v8: https://www.odoo.com/documentation/8.0/
1°-Start reading:

Quick start :

Technical_Memento_v0.7.3(En)
Technical_Memento_v 7 (FR)
Official doc : Modules OpenERP v7

2°-Sample module :

Example 1 : Basics of developing a simple module in OpenERP

Example 2 : How to create a module in OpenERP ?

Example 3: Custom Sample Module Development

Example 4:Module structure of OpenERP module

Example 5:Adding additional fields

3°- Videos

Create a module (through interface not with python code)

Tools / IDE OpenERP

1°-IDE : I suggest Eclipse IDE : Eclipse Classic

2°-Python : plugin PyDev for eclipse : Installing the Eclipse PyDev plugin

3°-XML : Editor integrated with eclipse

4°-Templates Openerp :Template for eclipse of openerp code snippets. This snippets are build to help rapid building openerp project with great ease.

For Python Snippets

For XML Snippets

5°-OpenERP in eclipse.

Debug your openERP+python code in eclipse

OpenERP development environment in Windows using Eclipse.

6°-OpenERP V7.0 installation on ubuntu 12.04 x64

How to install OpenERP V7.0 on Ubuntu 12.04 from launchpad repository?

Thursday, 16 March 2017

How to Create service in odoo10

On Ubuntu 16.04, this is how you create a service for Odoo10:

[Unit]
Description=Odoo
Documentation=http://www.odoo.com/
[Service]
# Ubuntu/Debian convention:
Type=simple
User=odoo
ExecStart=/opt/odoo10/odoo-bin -c /etc/odoo-server.conf
[Install]
WantedBy=default.target


You put this in /etc/systemd/system and I called my file odoo10.service so you can then do:

sudo systemctl start odoo10.service (starts service)
sudo systemctl stop odoo10.service (stops service)
sudo systemctl restart odoo10.service (restarts Service)
sudo systemctl status odoo10.service (status of service)
sudo systemctl enable odoo10.service (starts service at boot)
sudo systemctl disable odoo10.service (disables service at boot)

Wednesday, 15 March 2017

ValueError Expected singleton in Odoo

Expected Singleton:

Class methods required single invoking object (Single Browsable Record) to invoke the method and suppose it will call by multiple invoking objects (Browsable Recordsets) then method is not able to identify for which object it should process, therefore it will raise an error Expected Singleton.

New API decorator is used to define method calling pattern whether methods allows only single object or multiple objects to invoke this method.


For Example:


if self.location_id:     #face ValueError Expected singleton because self contains multiple recordset.

    ########

Need to change with following:

for warehouse in self:

    if warehouse.location_id:

        ########


@api.one

This decorator loops automatically on Records of RecordSet for you. Self is redefined as current record

Note:

Caution: the returned value is put in a list. This is not always supported by the web client, e.g. on button action
methods. In that case, you should use @api.multi to decorate your method, and probably call self.ensure_one() in
the method definition.

@api.multi

Self will be the current RecordSet without iteration. It is the default behavior (multiple browsable objects). Methods which returns non premitive type data(list, dictionary, function) must be decorated with @api.multi

@api.model

This decorator will convert old API calls to decorated function to new API signature. It allows to be polite when
migrating code. Self does not contain any record/recordset in methods which are decorated by this decorator.

So simply call like this

self.env['model_name'].method_name(arguments)

one2many, many2many, many2one field in openerp

In OpenERP/Odoo, we have one2many and many2many datatype field. For add, update, delete we have some trick to link with record, which are listed below.

1. (0, 0,  { values })    link to a new record that needs to be created with the given values dictionary

2. (1, ID, { values })    update the linked record with id = ID (write *values* on it)

3. (2, ID)                     remove and delete the linked record with id = ID (calls unlink on ID, that will delete the object completely, and the link to it as well)

4. (3, ID)                     cut the link to the linked record with id = ID (delete the relationship between the two objects but does not delete the target object itself)

5. (4, ID)                     link to existing record with id = ID (adds a relationship)

6. (5)                          unlink all (like using (3,ID) for all linked records)

7. (6, 0, [IDs])             replace the list of linked IDs (like using (5) then (4,ID) for each ID in the list of IDs)

Wednesday, 8 March 2017

How can create a new button in the header of the tree view after the "create button or 'import' "?

<t t-extend="ListView.buttons">

         <t t-jquery="button.oe_list_add" t-operation="after">

                 <t t-if="widget.model=='your.model'">

                         <button class="oe_button  oe_highlight" type="button"> New Buttton</button>

                </t>

         </t>

</t>