Merge lp:~openerp-dev/openobject-addons/7.0-lunch-api into lp:openobject-addons/7.0

Proposed by Arnaud Pineux (OpenERP)
Status: Merged
Merged at revision: 9374
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-lunch-api
Merge into: lp:openobject-addons/7.0
Diff against target: 148 lines (+60/-32)
2 files modified
lunch/lunch.py (+10/-0)
lunch/lunch_view.xml (+50/-32)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-lunch-api
Reviewer Review Type Date Requested Status
Martin Trigaux (OpenERP) (community) Approve
Ajay Patel (OpenERP) (community) Needs Fixing
Arnaud Pineux (OpenERP) (community) Needs Resubmitting
qdp (OpenERP) Needs Information
Review via email: mp+141742@code.launchpad.net

Description of the change

Remove the create "Button" only for the "Your Lunch Account" menu

API

To post a comment you must log in.
Revision history for this message
qdp (OpenERP) (qdp) wrote :

and? i don't think that a 148 lines diff can be resumed to this single point... Can you be more descriptive on your changes, please?

Thanks

Revision history for this message
qdp (OpenERP) (qdp) :
review: Needs Information
Revision history for this message
Arnaud Pineux (OpenERP) (api-openerp) wrote :

name_get has been added to show
"Lunch Order 4" on the breadcrum instead of "lunch.order,4"

New view have been change because we need to hide the create button for a specif menu based on "cashmove" object.
If I hide the create button on the previous "cashmove" view, the button will disappear on every menu. As it is not what we want, I create a copy of the previous view and just hide the button on this one.

review: Needs Resubmitting
Revision history for this message
Ajay Patel (OpenERP) (ajay-openerp) wrote :

Hello Arnaud Pineux

Seems ok.
Can you fix intendation for following lines : 70,89,97,105 ?

Thanks,
Amit

review: Needs Fixing
Revision history for this message
Martin Trigaux (OpenERP) (mat-openerp) wrote :

I have fixed the indentation and merged this into 7.0

revno: 9374 [merge]
revision-id: <email address hidden>

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lunch/lunch.py'
2--- lunch/lunch.py 2012-12-26 10:55:40 +0000
3+++ lunch/lunch.py 2013-01-03 12:32:22 +0000
4@@ -35,6 +35,16 @@
5 _description = 'Lunch Order'
6 _order = 'date desc'
7
8+ def name_get(self, cr, uid, ids, context=None):
9+ if not ids:
10+ return []
11+ res = []
12+ for elmt in self.browse(cr, uid, ids, context=context):
13+ name = _("Lunch Order")
14+ name = name + ' ' + str(elmt.id)
15+ res.append((elmt.id, name))
16+ return res
17+
18 def _price_get(self, cr, uid, ids, name, arg, context=None):
19 """
20 get and sum the order lines' price
21
22=== modified file 'lunch/lunch_view.xml'
23--- lunch/lunch_view.xml 2012-12-21 16:48:08 +0000
24+++ lunch/lunch_view.xml 2013-01-03 12:32:22 +0000
25@@ -83,6 +83,39 @@
26 </field>
27 </record>
28
29+ <!--view for cashmove-->
30+ <record model="ir.ui.view" id="casmove_tree_view">
31+ <field name="name">cashmove tree</field>
32+ <field name="model">lunch.cashmove</field>
33+ <field name="arch" type="xml">
34+ <tree string="cashmove tree">
35+ <field name="date"/>
36+ <field name="user_id"/>
37+ <field name="description"/>
38+ <field name="amount" sum="Total"/>
39+ </tree>
40+ </field>
41+ </record>
42+
43+ <record model="ir.ui.view" id="casmove_form_view">
44+ <field name="name">cashmove form</field>
45+ <field name="model">lunch.cashmove</field>
46+ <field name="arch" type="xml">
47+ <form string="cashmove form" version="7.0">
48+ <sheet>
49+ <group>
50+ <field name="user_id"/>
51+ <field name="date"/>
52+ <field name="amount"/>
53+ </group>
54+ <label for='description'/>
55+ <field name="description"/>
56+ </sheet>
57+ </form>
58+ </field>
59+ </record>
60+
61+
62 <!--Action for Your Orders-->
63 <record model="ir.actions.act_window" id="action_lunch_order_form">
64 <field name="name">New Order</field>
65@@ -109,6 +142,19 @@
66 </field>
67 </record>
68 <menuitem name="Previous Orders" parent="menu_lunch_title" id="menu_lunch_order_tree" action="action_lunch_order_tree" sequence="2"/>
69+
70+ <record model="ir.ui.view" id="casmove_tree">
71+ <field name="name">cashmove tree</field>
72+ <field name="model">lunch.cashmove</field>
73+ <field name="arch" type="xml">
74+ <tree string="cashmove tree" version="7.0" create='false'>
75+ <field name="date"/>
76+ <field name="user_id"/>
77+ <field name="description"/>
78+ <field name="amount" sum="Total"/>
79+ </tree>
80+ </field>
81+ </record>
82
83 <!--Action for Lunch cashmoves-->
84 <record model="ir.actions.act_window" id="action_lunch_cashmove_form">
85@@ -117,6 +163,7 @@
86 <field name="view_mode">tree</field>
87 <field name="search_view_id" ref="view_lunch_employee_payment_filter"/>
88 <field name="context">{"search_default_is_mine":1}</field>
89+ <field name="view_id" ref="casmove_tree"/>
90 <field name="help" type="html">
91 <p>
92 Here you can see your cash moves.<br/>A cash moves can be either an expense or a payment.
93@@ -173,6 +220,7 @@
94 <field name="view_mode">tree,form</field>
95 <field name="search_view_id" ref="view_lunch_cashmove_filter"/>
96 <field name="context">{"search_default_group_by_user":1}</field>
97+ <field name="view_id" ref="casmove_tree_view"/>
98 <field name="help" type="html">
99 <p class="oe_view_nocontent_create">
100 Click to create a new payment.
101@@ -194,6 +242,7 @@
102 <field name="view_mode">tree,form</field>
103 <field name="search_view_id" ref="view_lunch_employee_payment_filter"/>
104 <field name="context">{"search_default_is_payment":1}</field>
105+ <field name="view_id" ref="casmove_tree_view"/>
106 <field name="help" type="html">
107 <p class="oe_view_nocontent_create">
108 Click to create a payment.
109@@ -385,38 +434,7 @@
110 </field>
111 </record>
112
113- <!--view for cashmove-->
114- <record model="ir.ui.view" id="casmove_tree_view">
115- <field name="name">cashmove tree</field>
116- <field name="model">lunch.cashmove</field>
117- <field name="arch" type="xml">
118- <tree string="cashmove tree">
119- <field name="date"/>
120- <field name="user_id"/>
121- <field name="description"/>
122- <field name="amount" sum="Total"/>
123- </tree>
124- </field>
125- </record>
126-
127- <record model="ir.ui.view" id="casmove_form_view">
128- <field name="name">cashmove form</field>
129- <field name="model">lunch.cashmove</field>
130- <field name="arch" type="xml">
131- <form string="cashmove form" version="7.0">
132- <sheet>
133- <group>
134- <field name="user_id"/>
135- <field name="date"/>
136- <field name="amount"/>
137- </group>
138- <label for='description'/>
139- <field name="description"/>
140- </sheet>
141- </form>
142- </field>
143- </record>
144-
145+
146 <!--view for alerts-->
147 <record model="ir.ui.view" id="alert_tree_view">
148 <field name="name">alert tree</field>