[MERGE] [IMP] lunch: better name_get and avoid seeing twice the create button on the cashmove view
bzr revid: mat@openerp.com-20130821144900-86hcgrwd43mavo5y
This commit is contained in:
commit
11d50f0afc
|
@ -35,6 +35,16 @@ class lunch_order(osv.Model):
|
|||
_description = 'Lunch Order'
|
||||
_order = 'date desc'
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
if not ids:
|
||||
return []
|
||||
res = []
|
||||
for elmt in self.browse(cr, uid, ids, context=context):
|
||||
name = _("Lunch Order")
|
||||
name = name + ' ' + str(elmt.id)
|
||||
res.append((elmt.id, name))
|
||||
return res
|
||||
|
||||
def _price_get(self, cr, uid, ids, name, arg, context=None):
|
||||
"""
|
||||
get and sum the order lines' price
|
||||
|
|
|
@ -84,6 +84,39 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!--view for cashmove-->
|
||||
<record model="ir.ui.view" id="casmove_tree_view">
|
||||
<field name="name">cashmove tree</field>
|
||||
<field name="model">lunch.cashmove</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="cashmove tree">
|
||||
<field name="date"/>
|
||||
<field name="user_id"/>
|
||||
<field name="description"/>
|
||||
<field name="amount" sum="Total"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="casmove_form_view">
|
||||
<field name="name">cashmove form</field>
|
||||
<field name="model">lunch.cashmove</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="cashmove form" version="7.0">
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="user_id"/>
|
||||
<field name="date"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
<label for='description'/>
|
||||
<field name="description"/>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!--Action for Your Orders-->
|
||||
<record model="ir.actions.act_window" id="action_lunch_order_form">
|
||||
<field name="name">New Order</field>
|
||||
|
@ -110,6 +143,19 @@
|
|||
</field>
|
||||
</record>
|
||||
<menuitem name="Previous Orders" parent="menu_lunch_title" id="menu_lunch_order_tree" action="action_lunch_order_tree" sequence="2"/>
|
||||
|
||||
<record model="ir.ui.view" id="casmove_tree">
|
||||
<field name="name">cashmove tree</field>
|
||||
<field name="model">lunch.cashmove</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="cashmove tree" version="7.0" create='false'>
|
||||
<field name="date"/>
|
||||
<field name="user_id"/>
|
||||
<field name="description"/>
|
||||
<field name="amount" sum="Total"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--Action for Lunch cashmoves-->
|
||||
<record model="ir.actions.act_window" id="action_lunch_cashmove_form">
|
||||
|
@ -118,6 +164,7 @@
|
|||
<field name="view_mode">tree</field>
|
||||
<field name="search_view_id" ref="view_lunch_employee_payment_filter"/>
|
||||
<field name="context">{"search_default_is_mine_group":1}</field>
|
||||
<field name="view_id" ref="casmove_tree"/>
|
||||
<field name="help" type="html">
|
||||
<p>
|
||||
Here you can see your cash moves.<br/>A cash moves can be either an expense or a payment.
|
||||
|
@ -174,6 +221,7 @@
|
|||
<field name="view_mode">tree,form</field>
|
||||
<field name="search_view_id" ref="view_lunch_cashmove_filter"/>
|
||||
<field name="context">{"search_default_group_by_user":1}</field>
|
||||
<field name="view_id" ref="casmove_tree_view"/>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a new payment.
|
||||
|
@ -195,6 +243,7 @@
|
|||
<field name="view_mode">tree,form</field>
|
||||
<field name="search_view_id" ref="view_lunch_employee_payment_filter"/>
|
||||
<field name="context">{"search_default_is_payment":1}</field>
|
||||
<field name="view_id" ref="casmove_tree_view"/>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a payment.
|
||||
|
@ -386,38 +435,7 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!--view for cashmove-->
|
||||
<record model="ir.ui.view" id="casmove_tree_view">
|
||||
<field name="name">cashmove tree</field>
|
||||
<field name="model">lunch.cashmove</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="cashmove tree">
|
||||
<field name="date"/>
|
||||
<field name="user_id"/>
|
||||
<field name="description"/>
|
||||
<field name="amount" sum="Total"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="casmove_form_view">
|
||||
<field name="name">cashmove form</field>
|
||||
<field name="model">lunch.cashmove</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="cashmove form" version="7.0">
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="user_id"/>
|
||||
<field name="date"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
<label for='description'/>
|
||||
<field name="description"/>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!--view for alerts-->
|
||||
<record model="ir.ui.view" id="alert_tree_view">
|
||||
<field name="name">alert tree</field>
|
||||
|
|
Loading…
Reference in New Issue