Friday, January 8, 2010

Base, Fields, Search

AIM : To be able to search the functional field(function,related,property) on multilingual environment.


Changes:

As everybody knows that context plays a vital role in translations,we needed the translated values to be searched for functional fields.

1. bin/osv/fields.py

class function(_column)  --> def search(self, cr, uid, obj, name, args) has a new argument context.

Which appears now as def search(self, cr, uid, obj, name, args, context=None).

This context will help the search method to translate the keyword.

Example:
Follow these steps:
1. Install a minimal profile with demo data.
2. Load French language.
3. Switch to French environment(i.e.,User/Preferences to be set to fr_FR.
4. Go to Partners. (Belgium appears as belgique[translated value]) .
5. If we search belgiq, we won't find any records.
6. Reason : The keyword 'belgiq' was directly compared with DB values. It has to be the comparision between keyword and DISPLAYED value(we were in fr environment).
7. Pass context to your method  and have a try. (fnct_search=Method  would appear in your class definition of _columns.)
    account/account_move_line.py  has fnct_search=_invoice_search.
    so, def _invoice_search(self, cursor, user, obj, name, args) is now
          def _invoice_search(self, cursor, user, obj, name, args, context).

Programmers are requested to update the corresponding fnct_search methods with context argument appended to the method.


Thanks,
Regards,

Jay Vora,
E-Mail : jvo@tinyerp.com
(Not miles, just an e-mail away...)


Monday, October 5, 2009

Base, Ir_model_data , _update


AIM : To Use the context of screen/action to the record which is getting imported (the context passed by client).

Change:

1. _update() of ir_model_data class has a new arguement context in its signature.

def _update(self,cr, uid, model, module, values, xml_id=False, store=True, noupdate=False, mode='init', res_id=False):

Will appear as

def _update(self,cr, uid, model, module, values, xml_id=False, store=True, noupdate=False, mode='init', res_id=False, context=None):

This context will be passed to OpenERP methods create(),browse(),read(),write() used withing _update().
Context is very important factor that comes into picture specially during translation.



GTK,win_import,import_csv

AIM : To pass the local context of screen/action to the record which is getting imported.

Change:

1. __init__() of Win_import class has a new arguement local_context in its signature.

def __init__(self, model, fields, preload = [], parent=None):

will appear as:
def __init__(self, model, fields, preload = [], parent=None, local_context=None):

2. The import_csv() of win_import.py has a new arguement context in its signature.

def import_csv(csv_data, f, model, fields):

will appear as:
def import_csv(csv_data, f, model, fields, context=None):

Thanks,
Regards,

Er. Jay Vora,
Sr. Application Engineer.
Tiny ERP Pvt. Ltd.

Ahmedabad,Gujarat,India.

M : 91- 9879354457
E-Mail : jvo@tinyerp.com
(Not miles, just an e-mail away...)


Wednesday, July 8, 2009

New blog for api change.

Api change in purchase,purchase.order,inv_line_create

def inv_line_create(self, a, ol):

Replaced By

def inv_line_create(self, cr, uid, a, ol):

required cr,uid for pooling other objects in this method for implementing anglo-saxon accounting.

Tuesday, June 9, 2009

stock, stock.move, onchange_lot_id

def onchange_lot_id(self, cr, uid, context=None, prodlot_id=False,
product_qty=False, loc_id=False, context=None):

replaced by:

def onchange_lot_id(self, cr, uid, ids, prodlot_id=False, product_qty=False,
loc_id=False, context=None):

It was a bug introduced recently (not present in previous versions, I
think), the call in the view was correct.

--
Fabien

Monday, June 8, 2009

sale, sale.order, _product_id_change

The sale order method in version 5.0.1 as an extra parameter, flag=True.
This may cause problem in your module if you override the
_product_id_change method, without overriding the view.

--
Fabien Pinckaers