Search This Blog

Thursday 22 November 2012

ACCESSING DATA FROM SERVER USING XMLRPC [OPENERP, PYTHON]

 Simple demo.py file for accessing data from server using xml rpc.



import xmlrpclib
import base64
import csv

server = '127.0.0.1'   (server IP address)
port = '8080'             (server port Number)
username = 'username'
password = 'pwd'
dbname = 'test61'     (Database Name from which you access the data)

url = 'http://' + server + ':' + port

common = xmlrpclib.ServerProxy(url + '/xmlrpc/common')

uid = common.login(dbname, username, password)

object = xmlrpclib.ServerProxy(url + '/xmlrpc/object')

so_ids = object.execute(dbname, uid, password, 'sale.order','search',[])

print "sale order ids ::::::::",so_ids

Password contain atleast alpha,symbol & digit [Python]]

This program is check that password must contain , alpha,number & digits

   test = "anilasdfasdfl234234234@@@@"
   new = tuple(test)
   data = list(new)
   is_symb =False
   is_digit = False
   is_alpha = False

   for d in data :
      if d.isdigit():
          is_digit = True
      if d.isalpha():
          is_alpha = True
      if not d.isdigit() and not d.isalpha():
          is_symb = True
          break

  if is_symb == True and is_digit == True and is_alpha == True:
      print "password matched::::"
  else :
      print "password dosen't match..."
       

Monday 17 September 2012

Use of 'attrs' property of field in OpenERP

Attrs property of field in OpenERP

If you want to change the access and visibility of field at run time at that time you can use 'attr' property of fields

The 'attrs' property has mainly three attributes here is the examples.

Eg.

In .py File

    class account_invoice(osv.osv)
           
            _name=''account.invoice"

            _columns = {
                                 'type':fields.selection([('retail','Retail'),('tax','Tax'),('labour',Labour)],"Invoice Type"),
                                  'frieght':field.float('Frieght'),
             }
    account_invoice()

In .xml File


<field name="frieght" attrs="{"invisible":'['|'('type','=','retail')]}"/>
- The field will be invisible if type equal to retail.

<field name="frieght" attrs="{"readonly":'['|'('type','=','tax')]}"/>
- The field will be readonly if type equal tax

<field name="frieght" attrs="{"required":'['|'('type','=','retail')]}"/>
-The field will become required if type equal labour.




Sunday 16 September 2012

Using 'Child_of' operator In 'Parent-Child Relationship In Search view of Openerp module

If You Want to Search the All child Record Related to that text which had Written on Search Box..

follow the Following Step..

1)  That module must have a parent field in that form view When ever you crating Record for Any objects..

for eg.

If you want to search all semester which are belong /child to that semester which you had wrote in search menu..


module

class standard_standard(osv.osv)

name = 'standard.standard'

columns = {
                  'name':fields('sem',char=64),
                  parent_id.fields.many2one('standard.standard',"Parent Semester"),
}

standard_standard()




You have used that moudle as semster in you student profile

standard_id =fields.many2one ('standard.standard',Semester)



Now only one thing you have to set on you search view

<field name="standard_id" operator="child_of" />

Thats It.

Now you can easily get  you all record belong to that parent which had selected at creation of record.

Thank you






Monday 21 May 2012

Get starting With Java

Get Started With java....

I am suggesting you one book that is "The Head First Java"  This is very best book for the beginner.

This book will  Give you very best Basic knowledge of java & also Entertain you.

Click Here Dowload







Get Start With Python

Hey Friends.....

First of all You should study the book

--> byte of python
 Download this Book from the Below link

Download Byte of Python