On Sunday, January 29, 2017 at 3:35:08 AM UTC+5, Cédric Krier wrote: > > On 2017-01-27 08:32, Khurram Shahzad wrote: > > Dear All, > > > > I am trying to add a record rule to user for restricting him to see one > > stock location only. The rule is: > > > > [["location.id","=",2]] > > It is not clear on what is the rule applied. > Could you give more information? >
I have created stock locations for every Ward in the hospital. The Stock Manager of the ward will save an internal shipment for the medicine required in the ward. Then, the Warehouse Manger will issue the medicine. Now, while creating Internal Shipment, I want the Stock Manager of ward should not be able to set the 'To' location other than the location created for his ward. To implement this, since I know the ID (that in database is 2) of the Stock Location of ward, I decided to create a Record Rule on Stock Location model which is failing. > > But, when I click on 'Internal shipments' which use stock locations, it > > gives following error: > > KeyError: u 'location' > > > > Probably, the name 'location' used to refer the model 'stock.location' > is > > not correct. Can anybody guide me what is the correct name for referring > to > > 'stock.location'. > > Without the full traceback, it is difficult to understand what is > happening. > > But on a general side, record rules are very hard to setup correctly > because in contrary of other access rights, they are deeply enforced in > the all ORM instead of being only on the border (see issue4081). This > has to stay until issue4080 is solved. > > > https://bugs.tryton.org/issue4081 > https://bugs.tryton.org/issue4080 > > > -- You received this message because you are subscribed to the Google Groups "tryton" group. To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/f2ebf011-5214-46a1-91e7-44968a0d558d%40googlegroups.com.
