Community mailing list archives

community@mail.odoo.com

Re: DEFINE DEFAULT USER SHOP

by
Suzanne Jean-Sébastien
- 09/17/2014 03:38:17
HI,

You must overload the 'shop_id' in the dict _default.

_default = {
    'shop_id': _get_default_shop,
}

because is the _default the value of shop_id is the function pointer of the main _get_default_shop method. you must change this function pointer too. 

2014-09-16 16:54 GMT+02:00 Yassine Teimi <yteimi01@gmail.com>:

Hi all, 

When a user log on, I want that when he creates a sale order, he gets the default shop affected to him.

For that I created a field named x_usr on sale.shop, type many2one, relation : res.users.

on the sales module, I updated the sale.py file, exactly the get_default_shop method like this :

def _get_default_shop(self, cr, uid, context=None):
        shop_ids = self.pool.get('sale.shop').search(cr, uid, [('x_usr','=',uid)], context=context)
        if not shop_ids:
            raise osv.except_osv(_('Error!'), _('There is no default shop for the current user\'s company!'))
        return shop_ids

But there is no change, I restarted the openerp server, and updated modules list, but with no success. 

Any suggestions please.


--


Yassine TEIMI

Ingénieur SI technico-fonctionnel

TEL : 06-27333078

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--
Jean-Sébastien SUZANNE
jssuzanne@anybox.fr
06 51 35 50 50