odooodoo-12

Error Document tyoe: Purchase Requisition, operation: read


I have this issue

(Tipo de documento: Purchase Requisition, Operación: read)

I can find why? here is my code

security.xml

<record id="group_grupos_requis" model="res.groups">
        <field name="name">Solo Requisiciones</field>
        <field name="category_id" ref="base.module_category_hidden"/>
    </record>

    <record id="group_grupos_requis_hide" model="res.groups">
        <field name="name">Puede Manipular Requisiciones</field>
        <field name="category_id" ref="base.module_category_hidden"/>
    </record>

    <record id="group_grupos_requis_aproval" model="res.groups">
        <field name="name">Puede Confirmar Requisiciones</field>
        <field name="category_id" ref="base.module_category_hidden"/>
    </record>

<record model="ir.rule" id="purchase_requisition_comp_rule">
        <field name="name">Purchase Requisition multi-company</field>
        <field name="model_id" ref="model_purchase_requisition"/>
        <field name="domain_force">[('message_follower_ids.partner_id', '=', user.partner_id.id)]</field>
        <field name="groups" eval="[(4,ref('purchase.group_grupos_requis'))]"/>
    </record>

    <record model="ir.rule" id="purchase_requisition_all_rule">
        <field name="name">Purchase Requisition Manager all</field>
        <field name="model_id" ref="model_purchase_requisition"/>
        <field name="domain_force">[(1,'=',1)]</field>
        <field name="groups" eval="[(4,ref('purchase.group_grupos_requis_hide')), (4,ref('purchase.group_grupos_requis_aproval'))]"/>
    </record>

    <record model="ir.rule" id="purchase_requisition_all_rule_line">
        <field name="name">Purchase Requisition Manager line all</field>
        <field name="model_id" ref="model_purchase_requisition_line"/>
        <field name="domain_force">[(1,'=',1)]</field>
        <field name="global" eval="True"/>
    </record>

    <record model="ir.rule" id="purchase_requisition_rh_rule">
        <field name="name">Purchase Requisition RH</field>
        <field name="model_id" ref="model_purchase_requisition"/>
        <field name="domain_force">[('solo_rh', '!=', False)]</field>
        <field name="groups" eval="[(4,ref('hr.group_hr_manager'))]"/>
    </record>

I tried to give in module mail_followers access rights for create but nothing, the issue is when i use the purchase_requisition_comp_rule rule with the others I can create a requisition, when a I use a user with this option cant create a requisition with a requisition line captured, but if I leave the line empty I can record it, then it let me add lines and save it, it very rare.


Solution

  • i just add this

    <record model="ir.rule" id="purchase_requisition_comp_rule">
            <field name="name">Purchase Requisition multi-company</field>
            <field name="model_id" ref="model_purchase_requisition"/>
            <field name="domain_force">['|', ('create_uid', '=', user.id), ('message_follower_ids.partner_id', '=', user.partner_id.id)]</field>
            <field name="groups" eval="[(4,ref('purchase.group_grupos_requis'))]"/>
        </record>