Sunday 8 December 2019

V13 : Record Rule Domain Changes not applied


Sometimes the record rule not working correctly even we wrote correct the record rule. There are many reason but one of the reason is records saved in cache.

In this cases you have to clear the cache.

Problem :
Let's take one example suppose on user I have field product category and I want to show these product categories Manufacturing order to user.



Record Rule:

[('product_id.categ_id','in',[g.id for g in user.x_studio_product_category])]



Solution:
----------

in mrp.production ass search_read method and clear the cache

    @api.model
    def search_read(self, domain=None, fields=None, offset=0, limit=None, order=None):
        self.clear_caches()
        res = super(MrpProduction, self).search_read(domain, fields, offset, limit, order)
        return res

Video:



Contact for any Odoo Services

..Enjoy..

Tuesday 3 December 2019

Remove 'CREATE AND EDIT' from One2many and/or many2one



Remove 'CREATE AND EDIT'  from One2many and/or many2one :

In Tree view:


<tree string="Journal Items" create="false" edit="false" delete="false">


In Kanban View:


<kanban class="o_kanban_mobile" create="false" delete="false">

Options:

- create="false" => This will not allow to create record on the fly

- edit="false" => no option to edit the record

- delete="false" => do not allow the user to delete the record

- limit="10" => This will limit the records in tree view pager