Dynamic filtering of production source location and destination location

Source: Internet
Author: User

In the implementation process, encountered a problem, I hope that production planners can not see in addition to the production of other internal location, but the lack can not affect the production staff in the normal receipt of the warehouse.

The first thought is to use rule to control access to the location, rule objects can not be mrp.production can only be stock.location, otherwise the restrictions on location_src_id and location_dest_id do not work.

can only be limited by the rule of stock.location, but the problem is that although the production can not see the other internal location, but not from other location, receive, send the item.

As a result, the Location control module which is linked with the permission group is opened, and the setting of the Management permission group can be specified in the location setting, and then the dynamic domain is used to filter the location dynamically in the location of the production single place.

  

then, in the production of overloaded fields_view_get methods, the dynamic filtering of the location is implemented:

1        ifNot context:context={}2res = super (qunar_mrp,self). Fields_view_get (cr,uid,view_id,view_type,context=context,toolbar=toolbar,submenu=submenu)3Doc = etree. XML (res['Arch'])4nodes = Doc.xpath ("//field[@name = ' location_src_id ')")5ids =self._get_default_location_ids (Cr,uid,context)6          forNodeinchnodes:7Node.Set('Domain',"[' usage ', ' = ', ' internal '), (' id ', ' in ',"+str (IDS) +")]")8 9Dnodes = Doc.xpath ("//field[@name = ' location_dest_id ')")Ten          forNodeinchDnodes: OneNode.Set('Domain',"[' usage ', ' = ', ' internal '), (' id ', ' in ',"+str (IDS) +")]") A  -res['Arch'] =etree.tostring (DOC) -         returnRes

the effect of the implementation is as follows:

  

Dynamic filtering of production source location and destination location

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.