Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.



Yassine TEIMI
on 9/16/14, 10:43 AM 669 views

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.


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)


Asked: 9/16/14, 10:43 AM
Seen: 669 times
Last updated: 3/16/15, 8:10 AM