Odoo Help

Welcome!

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.

0

Purchases: set access rights based on supplier location?

By
Lawrence
on 3/18/13, 1:55 PM 1,016 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

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

0 follower(s)

Stats

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