Odoo Help

0

Purchases: set access rights based on supplier location?

By
Lawrence
on 3/18/13, 1:55 PM 1,129 views

Hello,

I would like to set up two user groups for the Purchases module where the groups have access to different suppliers. One group will deal with all suppliers in Asia, while the other will deal with suppliers in Europe.

Is it possible to set up Record Rules to limit access based on the supplier address? If not, how would one go about setting up rules on a per-supplier basis?

Thanks, Lawrence

0
shashank verma
On 5/9/14, 2:52 AM

Hello

You can use rules in groups to limit your record which will be country specific.

Lets consider an example

1.create new group for supplier deal with country 'India'

following rule will be

object:purchase_order

Domain filter:

['|',('partner_id.country_id.name','=','india')]

2.create new group for supplier deal with country 'USA'

following rule will be

object:purchase_order

Domain filter:

['|',('partner_id.country_id.name','=','USA')]

0
Stone
On 5/8/14, 11:42 PM

hi, u may inherit res.country & res.users add in a new field maybe called it as "is_asia", so that each country will have identification belongs to which continent. Then u can inherit purchase order object's search function to add in continent filter.

class purchase_order(osv.osv):
    _inherit = "purchase.order"

    def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
        is_asia = self.pool.get('res.users').browse(cr, uid, uid).is_asia
        partner_ids = self.pool.get('res.partners').search(cr, uid, [('is_asia','=',is_asia)])
        args += [('partner_id','in',partner_ids)]
        return super(purchase_order, self).search(cr, uid, args, offset, limit, order, context, count)
purchase_order()

hope it works

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)

Stats

Asked: 3/18/13, 1:55 PM
Seen: 1129 times
Last updated: 3/16/15, 8:10 AM