Purpose: 1/ In the lunch app, previous orders list: the products are not displayed. It is written X Records but you don't see the products name. Therefore the information is useless. 2/ It is dangerous to be able to delete a previous order that has been received (it changes the lunch account amount) What is done: In Previous Orders list : - The view should be based on the sales orders lines. In that case, each line = 1 product. - add a note column (between product and status) - add a user column (between status and total) - Rename Total into Price - If order.line status = ordered or received, it shouldn't be possible to delete it. An ir.rule has been added to achieve this. - An additional group access right check is made in the actions 'confirm' 'cancel' and 'order' because they can be called in batch under the Action button.
46 lines
2.4 KiB
XML
46 lines
2.4 KiB
XML
<?xml version="1.0" ?>
|
|
<odoo>
|
|
<record model="ir.module.category" id="module_lunch_category">
|
|
<field name="name">Lunch</field>
|
|
<field name="description">Helps you handle your lunch needs, if you are a manager you will be able to create new products, cashmoves and to confirm or cancel orders.</field>
|
|
<field name="sequence">16</field>
|
|
</record>
|
|
<record id="group_lunch_user" model="res.groups">
|
|
<field name="name">User</field>
|
|
<field name="category_id" ref="module_lunch_category"/>
|
|
</record>
|
|
<record id="group_lunch_manager" model="res.groups">
|
|
<field name="name">Manager</field>
|
|
<field name="implied_ids" eval="[(4, ref('group_lunch_user'))]"/>
|
|
<field name="category_id" ref="module_lunch_category"/>
|
|
<field name="users" eval="[(4, ref('base.user_root'))]"/>
|
|
</record>
|
|
|
|
<record id="base.default_user" model="res.users">
|
|
<field name="groups_id" eval="[(4,ref('lunch.group_lunch_manager'))]"/>
|
|
</record>
|
|
|
|
<record id="lunch_mind_your_own_food_money" model="ir.rule">
|
|
<field name="name">lunch.cashmove: do not see other people's cashmove</field>
|
|
<field name="model_id" ref="model_lunch_cashmove"/>
|
|
<field name="groups" eval="[(4, ref('group_lunch_user'))]"/>
|
|
<field name="domain_force">[('user_id', '=', user.id)]</field>
|
|
</record>
|
|
<record id="lunch_mind_other_food_money" model="ir.rule">
|
|
<field name="name">lunch.cashmove: do see other people's cashmove</field>
|
|
<field name="model_id" ref="model_lunch_cashmove"/>
|
|
<field name="groups" eval="[(4, ref('group_lunch_manager'))]"/>
|
|
<field name="domain_force">[(1, '=', 1)]</field>
|
|
</record>
|
|
<record id="lunch_order_line_rule_delete" model="ir.rule">
|
|
<field name="name">lunch.order.line: Only new and cancelled order lines deleted.</field>
|
|
<field name="model_id" ref="lunch.model_lunch_order_line"/>
|
|
<field name="domain_force">[('state', 'in', ('new', 'cancelled'))]</field>
|
|
<field name="perm_read" eval="0"/>
|
|
<field name="perm_write" eval="0"/>
|
|
<field name="perm_create" eval="0"/>
|
|
<field name="perm_unlink" eval="1" />
|
|
<field name="groups" eval="[(4,ref('lunch.group_lunch_user'))]"/>
|
|
</record>
|
|
</odoo>
|