Showing posts with label odoo. Show all posts
Showing posts with label odoo. Show all posts

How to merge delivery order In OpenERP


Hello,

Here I would like to share with you that how to merge delivery orders in OpenERP 7.0.
it will check following condition while merging a delivery orders

1. Delivery order should be in same state
2. Delivery order should be in same invoice state
3. Delivery order should be in same customer




Thanks,
Mayur Maheshwari







How to Install Odoo (formerly OpenERP) from github

Hello,

As all know that OpenERP have changed  brand to odoo where you find e-commerce apps , website builder , crm , sales ,purchase accounting and so many apps 

I would like to share with you about  how to Install Odoo ( (formerly OpenERP) from github on Ubuntu system which is first stap to intract with Odoo


Install Odoo ( (formerly OpenERP) from github

Odoo Github Link : https://github.com/odoo/odoo

1. You need to install first gi on you ubuntu system for that open you terminal and type following commend

 a) Update apt source list
   
sudo apt-get update

 b) install update package

sudo apt-get upgrade

c) now install git 

 sudo apt-get install git

2. Install Python packages  which required for Odoo installation

sudo apt-get install graphviz ghostscript postgresql-client \
python-dateutil python-feedparser python-matplotlib \
python-ldap python-libxslt1 python-lxml python-mako \
python-openid python-psycopg2 python-pybabel python-pychart \
python-pydot python-pyparsing python-reportlab python-simplejson \
python-tz python-vatnumber python-vobject python-webdav \
python-werkzeug python-xlwt python-yaml python-imaging


sudo apt-get install gcc python-dev mc bzr python-setuptools python-babel \
python-feedparser python-reportlab-accel python-zsi python-openssl \
python-egenix-mxdatetime python-jinja2 python-unittest2 python-mock \
python-docutils lptools make python-psutil python-paramiko poppler-utils \
python-pdftools antiword postgresql


3. Install PostgreSQL database 

sudo apt-get install postgresql

4. Create database user for Odoo

sudo -u postgres createuser -s odoo

5. Download Odoo from Github to your system

a). make directory in home 
     sudo mkdir home/workplace

b).move to  directory
    cd home/workplace

c) Download odoo from Github

sudo git clone https://github.com/odoo/odoo.git

6. Once finish a download need to run odoo server  

a). go to oddo path

   cd home/workplace/odoo

b). run a odoo server

./openerp-server


7.To check odoo installation is perfectly work  on your system  so for that  just open your browser type 
http://localhost:8069, 


Odoo Login screen
Odoo Login screen

Hope that was helpful.

If I just made your day a little better then thank me with a coffee or maybe a  pizza


Thanks,

Mayur Maheshwari
Skype: mayur_maheshwari1



How to create Qweb report in odoo

Hello All,

         I would like to share with you how to create a Qweb report in odoo [OpenERP].let we go stap by stap to create Qweb report in odoo [OpenERP].

What is Qweb Report ??

Qweb Report is the newest version of the Odoo reporting Format and its uses the bootstrap css classes and Qweb Template Engine for Make Quick Report Design in Odoo.

About Bootstrap :

Bootstrap is a free collection of tools for creating websites and web applications.It contains HTML and CSS-based design templates for typography, forms, buttons, navigation and other interface components, as well as optional JavaScript extensions

Expressions used in Odoo report templates :

There are some magic variables used in the report rendering. The main ones are the following:
docs
        records for the current report
doc_ids
        list of ids for the docs records
doc_model
       model for the docs records
time
       a reference to time from the Python standard library

translate_doc 
 
a function to translate a part of a report. It must be used as follow:
<t t-foreach="doc_ids" t-as="doc_id">
<t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', account.report_invoice_document')"/>
</t>
user
     res.user record for the user printing the report
res_company
      record the current user‘s company

Custom Report

A generic report use the default rendering context, containing the magic variables as explained before. If you want a new rendering context containing anything you want to process your data Odoo AbstractModel, a custom module is needed. These reports are called “particular report”.

For a particular report, you have to write an Odoo Model containing a render_html method. Classically, this method returns a call to the original QWeb render with a custom rendering context.


from openerp import api, models

class ParticularReport(models.AbstractModel):
_name = 'report.<<module.reportname>>'
@api.multi
def render_html(self, data=None):
report_obj = self.env['report']
report = report_obj._get_report_from_name('<<module.reportname>>')
docargs = {
'doc_ids': ids,
'doc_model': report.model,
'docs': self.env[report.model].browse(ids),
}
return report_obj.render('<<module.reportname>>', docargs)



Create Report  in Qweb odoo [OpenERP]

Steps to create in Following Ways ::

STEP 1 ::

Create View File For Rendring the Qweb in Odoo
the view file it self uses the the Bootstrap classes for designing the Qweb Report.

Create custom module in odoo and then  Navigate

YOUR MODULE NAME/View/yourview_file.xml

And also add the Entry of xml in the __openerp__.py file

STEP 2 ::

Create Python class for report in report Dir

import time
from openerp.report import report_sxw
from openerp.osv import osv

class your_class_name(report_sxw.rml_parse):

def get_lines(self, user,objects):
lines=[]
for obj in objects:
if user.id==obj.user_id.id:
lines.append(obj)
return lines

What ever function Which You want to access in the Qweb Template which are define in the class

We must have to add the Entry in it constructor like this

def __init__(self, cr, uid, name, context):
super(your_class_name, self).__init__(cr, uid, name, context)
self.net_total=0.0
self.localcontext.update({
'time': time,
'get_lines': self.get_lines,

Add the Entry For the report class which is inherited the osv.AbstractModel object

class report_your_class_name(osv.AbstractModel):
_name = 'report.Your_Module_name.report_reportname'
_inherit = 'report.abstract_report'
_template = 'Your_Module_name.report_reportname'
_wrapped_report_class =your_class_name

Navigate :

YOUR MODULE NAME/report/reportclass.py

And also add the Entry in the __init__.py file


STEP 3 ::

Add the Menu Action for Print The Report
YOUR MODULE NAME/report_file.xml

<report
id="action_report_report_id"
string="String to Display in Menu"
model="your_model"
report_type="qweb-pdf"
name="your_module_name.report_your_reportid"
file="your_module_name.report_yourreportid"
/>
And also add the Entry of xml in the __openerp__.py file


Special function ::

Hear In odoo use the special widget for print the currency symbol,
add the company address,partner address and many more

like this..

<div class="row">
<div class="col-xs-5 col-xs-offset-7">
<address t-field="o.partner_id"
t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}' />
<span t-field="o.partner_id.vat"/>
</div>
</div>
hear t-field-options attribute use the widget to print the partner detail in Odoo
like name,address,street,country etc... 

Same things for the currency symbol

<td class="text-right">
<span t-field="o.amount_untaxed" t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
</td>


Thanks,
Mayur Maheshwari (OpenERP/odoo)
Skype: mayur_maheshwari1


How to run query on database from pgAdmin and terminal - OpenERP (Odoo)

Hello,

I would like to share how to run query on database from pgAdmin and terminal. - OpenERP (Odoo) .This was too easy to do but this post is specially for beginner in query.





Hope that was helpful.


If I just made your day a little better then thank me with a coffee or maybe a  pizza

How to add an image icon to OpenERP custom module In OpenERP

Hello

I would like to share with you that How to add an image icon to OpenERP Custom module In OpenERP.

when you develop a custom module make a following directory in your custom module in OpenERP.

Custom_module:

           __init__.py
           __openerp__.py
           custom_module.py
           custom_module_view.xml
           static
                    src
                         img
                               icon.png

You need to save your icon as 'icon.png' and place it under 
custom_module/static/src/img/icon.png

 exmple :
 hr_custom/static/src/img/icon.png

Openerp will automatically select the icon from the static/src/img path

custom module icon
custom module icon






Thanks,

Mayur Maheshwari