Apr 17, 2013

[SOLVED] openerp7 xmlrpclib.Fault: Fault could not serialize access due to concurrent update

hmm... today i wanna share about how to SOLVED openerp7 xmlrpclib.Fault: Fault could not serialize access due to concurrent update, its happen when you create serial inserting or other operation on loop,

on my case, its happen when i migrate hundreds of users and employee to openerp 7,.

the solution is, just make it slower, give 2 seconds in every loop before go through. You know that, the ORM level need time to process each inserting-data.

see on my works below:


Read more ...

Apr 16, 2013

[SOLVED] OpenERP7 No handler found, openerp.modules.module: Couldn't load module web

hi all, today i share just simple trick to solve OpenERP7 No handler found, openerp.modules.module: Couldn't load module web, well..  here's the steps : 

actually, its often happen when you are missing some files during loading. just simple to check it.

1. check the missing files :

  • shutdown the openerp server : /etc/init.d/openerp stop
  • run it manually : (on my case)  python /home/febru/workspace/openerp7/openerp-server --config=/home/febru/workspace/openerp7/install/openerp-server.conf --update=sale --debug
  • then you will see the missing files there.

2. restore the file
let say, you need to re-zip, don't forget to use "-r" , zip -r sale.zip sale

3. run it  : sudo /etc/init.d/openerp start

summary solution for this

error No handler found

is, checking by --debug option, then see the log, feels free to analyze your error logs here ... :)
Read more ...

Apr 10, 2013

[SOLVED] openerp 7 backup access DB denied

Hi all, just want to share a simple trick solution for

OpenERP 7 - Backup ACCESS DENIED


it happen when you want to backup your openerp 7 database, this issue related to  
https://lists.launchpad.net/openerp-india/msg23993.html

well, here's the simple solution :

1. login as postgres or other user (except root)
2. run openerp server, some error may happen, but just ignore it.
3. login to bakup-page (via web browser) and choose your db and fill the password.
4. go to console, put again your password then enter, you can check to your browser that everything running well.


Read more ...

Mar 7, 2013

OpenERP 7, hack fields.property insert property_account_income property_account_expense to product_template

OpenERP 7, hacking fields.property to insert property_account_income  and  property_account_expense to product_template.

just a little concept you should know is about "fields.property", it is a function, so you can not inserting as commonly you do with xml-rpc, because you can not casting an object into it.

its very different with many2many connection, such as taxes_id or supplier_taxes_id, to set your product has it, just try setup one product and you can use a simple sql as below :


select * product_taxes_rel (product_id, tax_id)

the output 

#1;1
#204;1

so you just need to run :

insert into product_taxes_rel(prod_id, tax_id) select id, '1' from product_template where id not in (1,204)

then 
select * from product_supplier_taxes_rel

the output 
#1;2
#204;2

you just need run : 

insert into product_supplier_taxes_rel(prod_id, tax_id) select id, '2' from product_template where id not in (1,204)


well, lets back to inserting property, to inserting those properties, you need try setup one product, then look out on your database, it seem as below :


select * from ir_property where name in ('property_account_income', 'property_account_expense')

the output 

27;1;"2013-02-05 14:27:05.3211";"2013-02-05 14:27:05.3211";1;"";;"property_account_expense";;"many2one";1;1940;"";"";"account.account,307";"product.template,1"
28;1;"2013-02-05 14:27:05.3211";"2013-02-05 14:27:05.3211";1;"";;"property_account_income";;"many2one";1;1938;"";"";"account.account,308";"product.template,1"



there are two ways to inserting
A. Direct SQL. 

  • you need to create simple hack_property.py
  • run it and cast the output to sql-file, just like python hack_property.py > sql-file.sql
  • run the sql


here is the example of hack_propery.py


import xmlrpclib




username = "username"

pwd = "password"
dbname = "yourdb"

sock_common = xmlrpclib.ServerProxy("http://localhost:8069/xmlrpc/common")
uid = sock_common.login(dbname, username, pwd)
sock = xmlrpclib.ServerProxy("http://localhost:8069/xmlrpc/object")

results = sock.execute(dbname, uid, pwd, 'product.template', 'search', [])
for i in results:
    sql = """ insert into ir_property (create_uid, create_date, write_date, write_uid, name, type, company_id, fields_id, value_reference, res_id)    select '1', LOCALTIMESTAMP, LOCALTIMESTAMP,'1', 'property_account_expense', 'many2one', '1', '1940', 'account.account,307', 'product.template,"""
    sql = sql + str(i) + "';"
    print sql
    sql = """ insert into ir_property (create_uid, create_date, write_date, write_uid, name, type, company_id, fields_id, value_reference, res_id)    select '1', LOCALTIMESTAMP, LOCALTIMESTAMP,'1', 'property_account_income', 'many2one', '1', '1938', 'account.account,308', 'product.template,"""
    sql = sql + str(i) + "';"
    print sql



your sql-file should be like this : 


 insert into ir_property (create_uid, create_date, write_date, write_uid, name, type, company_id, fields_id, value_reference, res_id)    select '1', LOCALTIMESTAMP, LOCALTIMESTAMP,'1', 'property_account_expense', 'many2one', '1', '1940', 'account.account,307', 'product.template,1';
 insert into ir_property (create_uid, create_date, write_date, write_uid, name, type, company_id, fields_id, value_reference, res_id)    select '1', LOCALTIMESTAMP, LOCALTIMESTAMP,'1', 'property_account_income', 'many2one', '1', '1938', 'account.account,308', 'product.template,1';
 insert into ir_property (create_uid, create_date, write_date, write_uid, name, type, company_id, fields_id, value_reference, res_id)    select '1', LOCALTIMESTAMP, LOCALTIMESTAMP,'1', 'property_account_expense', 'many2one', '1', '1940', 'account.account,307', 'product.template,2';
 insert into ir_property (create_uid, create_date, write_date, write_uid, name, type, company_id, fields_id, value_reference, res_id)    select '1', LOCALTIMESTAMP, LOCALTIMESTAMP,'1', 'property_account_income', 'many2one', '1', '1938', 'account.account,308', 'product.template,2';



B. Pure xml-rpc 

in this step, you need to look the structure of fields.property, you need to copy this creation style


        prop = obj.pool.get('ir.property')
            return prop.create(cr, uid, {
                'name': propdef.name,
                'value': id_val,
                'res_id': obj._name+','+str(id),
                'company_id': cid,
                'fields_id': def_id,
                'type': self._type,
            }, context=context)

thats all, its already update thousands data of mine...  :D

after running those script, you will see that all of product are proper now..



Read more ...

Feb 26, 2013

[SOLVED] Openerp 7 Access Denied by record rules for operation: create, model: res.partner

Here's the solution for  openerp 7 Access Denied by record rules for operation: create, model: res.partner.


Previously error as below :


openerp.osv.orm: Access Denied by record rules for operation: create, uid: 12, model: res.partner
2013-02-07 06:11:30,381 10987 ERROR latestonair openerp.netsvc: Access Denied
The requested operation cannot be completed due to security restrictions. Please contact your system administrator.

(Document type: Partner, Operation: create)
Traceback (most recent call last):
  File "/livesource/openerp7/openerp/netsvc.py", line 289, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/livesource/openerp7/openerp/service/web_services.py", line 614, in dispatch
    res = fn(db, uid, *params)
  File "/livesource/openerp7/openerp/osv/osv.py", line 169, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/livesource/openerp7/openerp/osv/osv.py", line 125, in wrapper
    raise except_osv(inst.name, inst.value)
except_osv: (u'Access Denied', u'The requested operation cannot be completed due to security restrictions. Please contact your system administrator.


 
SOLUTION : then you need to go "Record Rules", search "res.partner Company", then add your user group in it. see on pic : 

Openerp 7 Access Denied by record rules for operation: create, model: res.partner

Read more ...