odoo12 - 在動作中添加新菜單並進行邏輯操作(新增服務器動作)


在odoo12中,動作中新建菜單:

    <record id="MuseumTicketActionServer" model="ir.actions.server">
        <field name="name">生成對賬單</field>
        <field name="model_id" ref="model_fr_museum_ticket"/>
        <field name="binding_model_id" ref="model_fr_museum_ticket"/>
        <field name="state">code</field>
        <field name="code">
            if records:
               action = model.create_bill(env.context.get("active_ids"))
        </field>
    </record>

其中:

model_id:model_xxxx(model + 下划線 + 對應的模型名)

binding_model_id:同上

create_bill:就是對應的方法,點擊菜單會跳轉的到對應的函數里面(函數寫在之前定義的模型里面)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM