Merge lp:~openerp-dev/openobject-addons/addons-convert_training-room_intra_ysa into lp:~openobject-training/openobject-addons/training
- addons-convert_training-room_intra_ysa
- Merge into training
Proposed by
Yogesh (SerpentCS)
Status: | Merged |
---|---|
Merged at revision: | 2137 |
Proposed branch: | lp:~openerp-dev/openobject-addons/addons-convert_training-room_intra_ysa |
Merge into: | lp:~openobject-training/openobject-addons/training |
Diff against target: |
1210 lines (+277/-299) 12 files modified
training/training_email_view.xml (+2/-2) training/training_holiday_view.xml (+1/-1) training/training_view.xml (+46/-41) training_intra/report/detail_offer_intra.py (+2/-0) training_intra/training_intra.py (+48/-126) training_intra/training_intra_view.xml (+129/-98) training_room/__init__.py (+3/-1) training_room/__openerp__.py (+2/-2) training_room/training_room.py (+17/-10) training_room/training_room_view.xml (+20/-17) training_room/wizard/__init__.py (+3/-1) training_room/wizard/training_create_session_wizard.py (+4/-0) |
To merge this branch: | bzr merge lp:~openerp-dev/openobject-addons/addons-convert_training-room_intra_ysa |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Bhumika Shrimali | Needs Fixing | ||
Review via email: mp+53756@code.launchpad.net |
Commit message
Description of the change
training_room, training_intra:- convert into v6 and fix problem. training:- add button icon.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'training/training_email_view.xml' |
2 | --- training/training_email_view.xml 2011-03-14 10:48:46 +0000 |
3 | +++ training/training_email_view.xml 2011-03-17 09:08:29 +0000 |
4 | @@ -234,7 +234,7 @@ |
5 | <field name="search_view_id" ref="training_email_layout_search"/> |
6 | </record> |
7 | |
8 | - <menuitem parent="training_config_mi" id="training_email_all_emails_mi" name="Emails" sequence='50'/> |
9 | + <menuitem parent="training_config_mi" id="training_email_all_emails_mi" name="Emails" sequence='2'/> |
10 | <menuitem parent="training_email_all_emails_mi" id="training_email_all_mi" |
11 | action="training_email_all_act" sequence='1'/> |
12 | <menuitem parent="training_email_all_emails_mi" id="training_email_stylegroup_mi" |
13 | @@ -258,7 +258,7 @@ |
14 | <separator string="Message" colspan="4" /> |
15 | <field name="message" colspan="4" nolabel="1" /> |
16 | <separator colspan="4" /> |
17 | - <button name="action_send" string="Send Email" type="object" colspan="4" /> |
18 | + <button name="action_send" string="Send Email" type="object" colspan="4" icon="gtk-execute"/> |
19 | </form> |
20 | </field> |
21 | </record> |
22 | |
23 | === modified file 'training/training_holiday_view.xml' |
24 | --- training/training_holiday_view.xml 2011-03-14 10:48:46 +0000 |
25 | +++ training/training_holiday_view.xml 2011-03-17 09:08:29 +0000 |
26 | @@ -77,7 +77,7 @@ |
27 | <field name="search_view_id" ref="holiday_period_search"/> |
28 | </record> |
29 | |
30 | - <menuitem id="holiday_mi" name="Non-Working Days" parent="training_config_mi" sequence='60'/> |
31 | + <menuitem id="holiday_mi" name="Non-Working Days" parent="training_config_mi" sequence='3'/> |
32 | <menuitem id="holiday_period_all_mi" action="holiday_period_all_act" parent="holiday_mi" /> |
33 | |
34 | <record model="ir.ui.view" id="holiday_year_tree"> |
35 | |
36 | === modified file 'training/training_view.xml' |
37 | --- training/training_view.xml 2011-03-14 10:48:46 +0000 |
38 | +++ training/training_view.xml 2011-03-17 09:08:29 +0000 |
39 | @@ -483,12 +483,12 @@ |
40 | <group colspan="4" col="6"> |
41 | <field name="state" /> |
42 | <button name="signal_validate" string="Validate" type="workflow" states="draft" |
43 | - confirm="Do you want to validate this catalog ?" /> |
44 | + icon="terp-document-new" confirm="Do you want to validate this catalog ?" /> |
45 | <button name="signal_cancel" string="Cancel" type="workflow" states="validated,inprogress" |
46 | - confirm="Do you want to cancel this catalog ?"/> |
47 | - <button name="signal_inprogress" string="In Progress" type="workflow" states="validated" /> |
48 | + icon="gtk-cancel" confirm="Do you want to cancel this catalog ?"/> |
49 | + <button name="signal_inprogress" string="In Progress" type="workflow" states="validated" icon="terp-accessories-archiver"/> |
50 | <button name="signal_deprecate" string="Deprecate" type="workflow" states="inprogress" |
51 | - confirm="Do you want to deprecate this catalog ?"/> |
52 | + icon="gtk-execute" confirm="Do you want to deprecate this catalog ?"/> |
53 | </group> |
54 | </form> |
55 | </field> |
56 | @@ -633,12 +633,12 @@ |
57 | <group colspan="4" col="3"> |
58 | <field name="state" /> |
59 | <group col="6" groups="training.group_session_manager"> |
60 | - <button name="signal_open" string="Open" type="workflow" states="draft" confirm="Do you want to open this session ?"/> |
61 | - <button name="signal_open_confirm" string="Confirm" type="workflow" states="opened" confirm="Do you want to confirm this session ?" /> |
62 | - <button name="signal_close_confirm" string="Close Subscriptions" type="workflow" states="opened_confirmed" confirm="Do you want to close the subscription for this session ?" /> |
63 | - <button name="signal_inprogress" string="Start" type="workflow" states="closed_confirmed" confirm="Do you want to close this session for the subscription ?" /> |
64 | - <button name="signal_close" string="Close" type="workflow" states="inprogress" confirm="Do you want to close this session ?" /> |
65 | - <button name="signal_cancel" string="Cancel" type="workflow" states="draft,opened,opened_confirmed,closed_confirmed" confirm="Do you want to cancel this session ?"/> |
66 | + <button name="signal_open" icon="gtk-ok" string="Open" type="workflow" states="draft" confirm="Do you want to open this session ?"/> |
67 | + <button name="signal_open_confirm" icon="gtk-go-up" string="Confirm" type="workflow" states="opened" confirm="Do you want to confirm this session ?" /> |
68 | + <button name="signal_close_confirm" icon="gtk-close" string="Close Subscriptions" type="workflow" states="opened_confirmed" confirm="Do you want to close the subscription for this session ?" /> |
69 | + <button name="signal_inprogress" icon="gtk-ok" string="Start" type="workflow" states="closed_confirmed" confirm="Do you want to close this session for the subscription ?" /> |
70 | + <button name="signal_close" icon="gtk-close" string="Close" type="workflow" states="inprogress" confirm="Do you want to close this session ?" /> |
71 | + <button name="signal_cancel" icon="gtk-cancel" string="Cancel" type="workflow" states="draft,opened,opened_confirmed,closed_confirmed" confirm="Do you want to cancel this session ?"/> |
72 | </group> |
73 | </group> |
74 | </form> |
75 | @@ -777,9 +777,9 @@ |
76 | <separator string="" colspan="4" /> |
77 | <group colspan="4" col="5"> |
78 | <field name="state" invisible="1" /> |
79 | - <button string="Cancel" type="object" special="cancel" name="action_close" states="selection"/> |
80 | - <button string="Close" type="object" special="cancel" name="action_close" states="result" /> |
81 | - <button string="Generate Reports" type="object" name="action_generate_zip" states="selection"/> |
82 | + <button string="Cancel" icon="gtk-cancel" type="object" special="cancel" name="action_close" states="selection"/> |
83 | + <button string="Close" icon="gtk-close" type="object" special="cancel" name="action_close" states="result" /> |
84 | + <button string="Generate Reports" icon="gtk-new" type="object" name="action_generate_zip" states="selection"/> |
85 | </group> |
86 | </form> |
87 | </field> |
88 | @@ -909,15 +909,15 @@ |
89 | <group colspan="4" col="3"> |
90 | <field name="state" /> |
91 | <group col="5" groups="training.group_seance_manager"> |
92 | - <button name="seance_confirm" string="Confirm" type="workflow" states="opened" confirm="Do you want to confirm this seance (procurements, ...) ?" /> |
93 | - <button name="action_do_confirm" string="Re-generate Purchase" type="object" states="confirmed,inprogress" confirm="Are you sure you want to regenerate all purchases for this seance?" groups="training.group_seance_manager"/> |
94 | - <button name="signal_inprogress" string="Start" type="workflow" states="confirmed" confirm="Do you want to start this seance ?" /> |
95 | - <button name="signal_close" string="Close" type="workflow" states="inprogress" confirm="Do you want to close this seance ?" /> |
96 | - <button name="signal_cancel" string="Cancel" type="workflow" states="opened,confirmed" confirm="Do you want to cancel this seance ?" /> |
97 | - <button name="signal_seance_done" string="Done" type="workflow" states="closed" /> |
98 | + <button name="seance_confirm" icon="gtk-go-up" string="Confirm" type="workflow" states="opened" confirm="Do you want to confirm this seance (procurements, ...) ?" /> |
99 | + <button name="action_do_confirm" icon="gtk-refresh" string="Re-generate Purchase" type="object" states="confirmed,inprogress" confirm="Are you sure you want to regenerate all purchases for this seance?" groups="training.group_seance_manager"/> |
100 | + <button name="signal_inprogress" icon="gtk-ok" string="Start" type="workflow" states="confirmed" confirm="Do you want to start this seance ?" /> |
101 | + <button name="signal_close" icon="gtk-close" string="Close" type="workflow" states="inprogress" confirm="Do you want to close this seance ?" /> |
102 | + <button name="signal_cancel" icon="gtk-cancel" string="Cancel" type="workflow" states="opened,confirmed" confirm="Do you want to cancel this seance ?" /> |
103 | + <button name="signal_seance_done" icon="gtk-go-up" string="Done" type="workflow" states="closed" /> |
104 | </group> |
105 | </group> |
106 | - <button name="%(seance_generate_zip_wizard_act)d" type="action" string="Generate Reports" colspan="4" groups="training.group_training"/> |
107 | + <button name="%(seance_generate_zip_wizard_act)d" type="action" string="Generate Reports" colspan="4" groups="training.group_training" icon="gtk-execute"/> |
108 | </form> |
109 | </field> |
110 | </record> |
111 | @@ -1131,7 +1131,7 @@ |
112 | <field name="paid" /> |
113 | </group> |
114 | <group states="confirmed,done"> |
115 | - <button name="action_create_invoice" string="Create Invoice" type="object" attrs="{'invisible': [('invoice_line_id', '!=', False)]}"/> |
116 | + <button name="action_create_invoice" string="Create Invoice" icon="gtk-new" type="object" attrs="{'invisible': [('invoice_line_id', '!=', False)]}"/> |
117 | </group> |
118 | </group> |
119 | </group> |
120 | @@ -1160,9 +1160,9 @@ |
121 | <group colspan="4" col="6"> |
122 | <field name="state" /> |
123 | <button string="Confirm Request" type="workflow" name="signal_confirm" states="draft" |
124 | - confirm="Do you want to confirm the request for this subscription ?" /> |
125 | + icon="gtk-go-up" confirm="Do you want to confirm the request for this subscription ?" /> |
126 | <button string="Cancel" type="workflow" name="signal_cancel" states="draft" |
127 | - confirm="Do you want to cancel this subscription ?" /> |
128 | + icon="gtk-cancel" confirm="Do you want to cancel this subscription ?" /> |
129 | </group> |
130 | </form> |
131 | </field> |
132 | @@ -1295,7 +1295,7 @@ |
133 | <group states="end" colspan="4"> |
134 | <label string="The operation has been done with success !" colspan="4" /> |
135 | <separator string="" colspan="4" /> |
136 | - <button name="action_done" string="Done" type="object" states="end" /> |
137 | + <button name="action_done" icon="gtk-ok" string="Done" type="object" states="end" /> |
138 | </group> |
139 | |
140 | <group col="7" colspan="4" attrs="{'invisible' : [('state', '=', 'end')]}"> |
141 | @@ -1303,9 +1303,9 @@ |
142 | <field name="state" invisible="1" /> |
143 | <button name="action_cancel" string="Cancel" type="object" special="cancel" icon="gtk-cancel" states="init,replacement,postponement,cancellation"/> |
144 | <label string="" /> |
145 | - <button name="action_cancellation" string="Cancellation" type="object" states="init" /> |
146 | - <button name="action_replacement" string="Replacement" type="object" states="init" /> |
147 | - <button name="action_postponement" string="Postponement" type="object" states="init" /> |
148 | + <button name="action_cancellation" string="Cancellation" type="object" states="init" icon="gtk-cancel"/> |
149 | + <button name="action_replacement" string="Replacement" type="object" states="init" icon="gtk-refresh"/> |
150 | + <button name="action_postponement" string="Postponement" type="object" states="init" icon="execute"/> |
151 | <label string="" /> |
152 | <button name="action_apply" string="Apply" type="object" states="cancellation,replacement,postponement" icon="gtk-apply"/> |
153 | </group> |
154 | @@ -1355,7 +1355,7 @@ |
155 | <field name="paid" /> |
156 | </group> |
157 | <group states="confirmed,done" groups="training.group_training"> |
158 | - <button name="action_create_invoice" string="Create Invoice" type="object" |
159 | + <button name="action_create_invoice" string="Create Invoice" type="object" icon="gtk-new" |
160 | attrs="{'invisible': [('invoice_line_id', '!=', False)]}" /> |
161 | </group> |
162 | </group> |
163 | @@ -1388,14 +1388,15 @@ |
164 | <group col="9" colspan="4"> |
165 | <field name="state" /> |
166 | <button name="signal_confirm" string="Confirm" type="workflow" states="draft" |
167 | - confirm="Do you want to confirm this subscription line ?"/> |
168 | + icon="gtk-go-up" confirm="Do you want to confirm this subscription line ?"/> |
169 | <button name="signal_cancel" string="Cancel" type="workflow" states="draft" |
170 | - confirm="Do you want to cancel this subscription line ?" /> |
171 | + icon="gtk-cancel" confirm="Do you want to cancel this subscription line ?" /> |
172 | <button name="signal_invoice_and_send_emails" string="Cancel (Penalities)" type="workflow" states="confirmed" |
173 | - confirm="Do you want to cancel this subscription line ?" /> |
174 | + icon="gtk-cancel" confirm="Do you want to cancel this subscription line ?" /> |
175 | <button name="%(training.subscription_cancellation_wizard_act)d" |
176 | string="Cancel (Free)" |
177 | type="action" |
178 | + icon="gtk-cancel" |
179 | groups="training.group_subscription_manager" |
180 | states="confirmed" |
181 | context="{'default_state':'cancellation'}" |
182 | @@ -1403,18 +1404,20 @@ |
183 | <button name="%(training.subscription_cancellation_wizard_act)d" |
184 | string="Replacement" |
185 | type="action" |
186 | + icon="gtk-refresh" |
187 | states="confirmed" |
188 | groups="training.group_subscription_manager" |
189 | context="{'default_state':'replacement'}" |
190 | confirm="Do you want to do a replacement for this subscription line ?" /> |
191 | <button name="%(training.subscription_cancellation_wizard_act)d" |
192 | string="Postponement" |
193 | + icon="gtk-execute" |
194 | type="action" |
195 | states="confirmed" |
196 | groups="training.group_subscription_manager" |
197 | context="{'default_state':'postponement'}" |
198 | confirm="Do you want to postpone this subscription line ?" /> |
199 | - <button name="signal_done" string="Done" type="workflow" states="confirmed" /> |
200 | + <button name="signal_done" string="Done" type="workflow" states="confirmed" icon="gtk-go-up"/> |
201 | </group> |
202 | </form> |
203 | </field> |
204 | @@ -1566,8 +1569,8 @@ |
205 | <form string="Procurements Update"> |
206 | <group colspan="4" col="2" states="confirm"> |
207 | <label string="Are you sure you want to update procurements all opened seance in all future session?" colspan="2"/> |
208 | - <button string="Cancel" special="cancel" name="action_close"/> |
209 | - <button string="Confirm" type="object" name="action_confirm"/> |
210 | + <button string="Cancel" special="cancel" name="action_close" icon="gtk-cancel"/> |
211 | + <button string="Confirm" type="object" name="action_confirm" icon="gtk-go-up"/> |
212 | </group> |
213 | <group colspan="4" col="4" states="update" expand="1"> |
214 | <field name="name"/> |
215 | @@ -1687,10 +1690,12 @@ |
216 | </field> |
217 | <button name="action_load_procurements" |
218 | type="object" |
219 | + icon="gtk-execute" |
220 | string="Load Procurements From Courses" colspan="4" |
221 | attrs="{'invisible' : [('state', '=', 'validated')]}"/> |
222 | <button name="%(training_offer_purchase_line_wizard_act)d" |
223 | type="action" |
224 | + icon="gtk-execute" |
225 | string="Update Seance Procurments" colspan="4"/> |
226 | </page> |
227 | <page string="Pedagogical Suggestion"> |
228 | @@ -1717,12 +1722,12 @@ |
229 | <group col="5" colspan="4"> |
230 | <field name="state" /> |
231 | <button name="signal_validate" string="Validate" type="workflow" states="draft" |
232 | - confirm="Do you want to validate this offer ?"/> |
233 | + icon="gtk-new" confirm="Do you want to validate this offer ?"/> |
234 | <button name="signal_deprecate" string="Deprecate" type="workflow" states="validated,draft" |
235 | - confirm="Do you want to deprecate this offer ?" /> |
236 | + icon="gtk-execute" confirm="Do you want to deprecate this offer ?" /> |
237 | <button name="draft_cb" string="Draft" type="object" states="validated,deprecated" |
238 | confirm="Are you sure to reset to Draft (Check the sessions for this offer) ?" |
239 | - groups="training.group_offer_manager" /> |
240 | + groups="training.group_offer_manager" icon="gtk-new"/> |
241 | </group> |
242 | </form> |
243 | </field> |
244 | @@ -1823,7 +1828,7 @@ |
245 | |
246 | <menuitem id="training_config_mi" parent="training_mi" name="Configuration" sequence="1"/> |
247 | |
248 | - <menuitem id="training_config_library_mi" parent="training_config_mi" name="Library" /> |
249 | + <menuitem id="training_config_library_mi" parent="training_config_mi" name="Library" sequence="1"/> |
250 | <menuitem id="training_config_library_categ_mi" parent="training_config_library_mi" name="Categorisation" sequence='10'/> |
251 | |
252 | <menuitem id="course_theme_all_mi" parent="training_config_library_categ_mi" action="course_theme_all_act" sequence='10'/> |
253 | @@ -1999,8 +2004,8 @@ |
254 | <field name="price" /> |
255 | <field name="purchase_order_id" groups="training.group_training" /> |
256 | <button type="object" name="action_create_purchase_order" string="Create Purchase Order" |
257 | - attrs="{'invisible' : [('purchase_order_id', '!=', False)]}" icon="gtk-new" |
258 | - groups="training.group_training"/> |
259 | + attrs="{'invisible' : [('purchase_order_id', '!=', False)]}" |
260 | + groups="training.group_training" icon="gtk-new"/> |
261 | <field name="amount_to_pay" groups="training.group_training" /> |
262 | <field name="purchase_paid" groups="training.group_training" select="2"/> |
263 | </group> |
264 | @@ -2039,7 +2044,7 @@ |
265 | states="draft,valid,requested,accepted" |
266 | groups="training.group_request_manager" |
267 | confirm="Do you want to cancel this request ?" /> |
268 | - <button type="workflow" name="pshr_done" string="Done" states="accepted" groups="training.group_request_manager"/> |
269 | + <button type="workflow" name="pshr_done" string="Done" icon="gtk-ok" states="accepted" groups="training.group_request_manager"/> |
270 | </group> |
271 | </form> |
272 | </field> |
273 | |
274 | === renamed file 'training_intra/__terp__.py' => 'training_intra/__openerp__.py' |
275 | === modified file 'training_intra/report/detail_offer_intra.py' |
276 | --- training_intra/report/detail_offer_intra.py 2010-10-08 07:14:40 +0000 |
277 | +++ training_intra/report/detail_offer_intra.py 2011-03-17 09:08:29 +0000 |
278 | @@ -56,6 +56,8 @@ |
279 | |
280 | class report_sxw_offer_intra_detail(report_sxw.report_sxw): |
281 | def create_single_pdf(self, cr, uid, ids, data, report_xml, context=None): |
282 | + if context is None: |
283 | + context = {} |
284 | pool = pooler.get_pool(cr.dbname) |
285 | offer_pool = pool.get('training.offer') |
286 | sale_order_report = netsvc.LocalService('report.sale.order') |
287 | |
288 | === modified file 'training_intra/training_intra.py' |
289 | --- training_intra/training_intra.py 2011-02-25 12:33:02 +0000 |
290 | +++ training_intra/training_intra.py 2011-03-17 09:08:29 +0000 |
291 | @@ -21,10 +21,11 @@ |
292 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
293 | # |
294 | ############################################################################################ |
295 | -from osv import osv, fields |
296 | -import tools |
297 | -from tools import config |
298 | + |
299 | +from osv import osv |
300 | +from osv import fields |
301 | from tools.translate import _ |
302 | +import decimal_precision as dp |
303 | |
304 | class sale_order(osv.osv): |
305 | _inherit = 'sale.order' |
306 | @@ -41,11 +42,7 @@ |
307 | _columns = { |
308 | 'offer_partner_id' : fields.related('offer_id', 'partner_id', type='many2one', relation='res.partner', readonly=True, string='Partner', select=1), |
309 | 'offer_sale_order_id' : fields.related('offer_id', 'sale_order_id', type='many2one', relation='sale.order', readonly=True, string='Sale Order', select=1), |
310 | - 'offer_sale_order_state' : fields.related('offer_id', 'sale_order_id', |
311 | - 'state', |
312 | - string="Sale Order's State", |
313 | - type='selection', |
314 | - readonly=True, |
315 | + 'offer_sale_order_state' : fields.related('offer_id', 'sale_order_id', 'state', string="Sale Order's State", type='selection', readonly=True, |
316 | selection=[ |
317 | ('draft','Quotation'), |
318 | ('waiting_date','Waiting Schedule'), |
319 | @@ -62,9 +59,7 @@ |
320 | def on_change_offer(self, cr, uid, ids, offer_id, context=None): |
321 | if not offer_id: |
322 | return False |
323 | - |
324 | offer = self.pool.get('training.offer').browse(cr, uid, offer_id, context=context) |
325 | - |
326 | return { |
327 | 'value' : { |
328 | 'kind' : offer.kind, |
329 | @@ -83,7 +78,6 @@ |
330 | def _is_intra_search(self, cr, uid, obj, name, args, context=None): |
331 | if not len(args): |
332 | return [] |
333 | - |
334 | cr.execute(""" |
335 | SELECT DISTINCT(tssr.seance_id) |
336 | FROM training_session_seance_rel tssr, |
337 | @@ -101,26 +95,15 @@ |
338 | |
339 | def _is_intra_compute(self, cr, uid, ids, fields, args, context=None): |
340 | res = dict.fromkeys(ids, 0) |
341 | - |
342 | for obj in self.browse(cr, uid, ids, context=context): |
343 | res[obj.id] = all(session.kind == 'intra' for session in obj.session_ids) |
344 | - |
345 | return res |
346 | |
347 | _columns = { |
348 | - 'is_intra' : fields.function(_is_intra_compute, |
349 | - method=True, |
350 | - fnct_search=_is_intra_search, |
351 | - type='boolean', |
352 | - string='Is Intra'), |
353 | - |
354 | + 'is_intra' : fields.function(_is_intra_compute, method=True, fnct_search=_is_intra_search, type='boolean', string='Is Intra'), |
355 | 'partner_id' : fields.related('session_ids', 'offer_id', 'partner_id', type='many2one', relation='res.partner', readonly=True, string='Partner', select=1), |
356 | 'sale_order_id' : fields.related('session_ids', 'offer_id', 'sale_order_id', type='many2one', relation='sale.order', readonly=True, string='Sale Order'), |
357 | - 'sale_order_state' : fields.related('session_ids', 'offer_id', 'sale_order_id', |
358 | - 'state', |
359 | - string="Sale Order's State", |
360 | - type='selection', |
361 | - readonly=True, |
362 | + 'sale_order_state' : fields.related('session_ids', 'offer_id', 'sale_order_id', 'state', string="Sale Order's State", type='selection', readonly=True, |
363 | selection=[ |
364 | ('draft','Quotation'), |
365 | ('waiting_date','Waiting Schedule'), |
366 | @@ -131,7 +114,6 @@ |
367 | ('done','Done'), |
368 | ('cancel','Cancel'), |
369 | ], |
370 | - select=1 |
371 | ), |
372 | } |
373 | |
374 | @@ -141,6 +123,10 @@ |
375 | _inherit = 'training.seance.purchase_line' |
376 | |
377 | def _get_analytic_account_id(self, cr, uid, ids, context=None): |
378 | + if not ids: |
379 | + return False |
380 | + if context is None: |
381 | + context = {} |
382 | po_line = self.browse(cr, uid, ids[0], context=context) |
383 | if po_line.seance_id.is_intra: |
384 | offer_record = po_line.seance_id.session_ids[0].offer_id |
385 | @@ -157,38 +143,29 @@ |
386 | _name = 'training.intra.budget.tpl' |
387 | |
388 | def _amount_all(self, cr, uid, ids, fieldnames, args, context=None): |
389 | + if context is None: |
390 | + context = {} |
391 | res = {} |
392 | - |
393 | for obj in self.browse(cr, uid, ids, context=context): |
394 | values = {'costs' : 0.0, 'revenues' : 0.0, 'balance' : 0.0} |
395 | - |
396 | for line in obj.line_ids: |
397 | if line.type == 'cost': |
398 | values['costs'] += line.price |
399 | else: |
400 | values['revenues'] += line.price |
401 | - |
402 | values['balance'] = values['revenues'] - values['costs'] |
403 | - |
404 | res[obj.id] = values |
405 | - |
406 | return res |
407 | |
408 | _columns = { |
409 | 'name' : fields.char('Name', size=64, required=True), |
410 | 'line_ids' : fields.one2many('training.intra.budget.tpl.line', 'template_id', 'Budget Intra Template Lines'), |
411 | - 'costs' : fields.function(_amount_all, method=True, multi="compute", string="Costs", |
412 | - type="float", |
413 | - store=True, |
414 | - readonly=True, |
415 | - digits=(16, int(config['price_accuracy'])) |
416 | - ), |
417 | + 'costs' : fields.function(_amount_all, method=True, multi="compute", string="Costs", type="float", store=True, |
418 | + readonly=True, digits_compute=dp.get_precision('Account')), |
419 | 'revenues' : fields.function(_amount_all, method=True, multi="compute", string="Revenues", type="float", store=True, readonly=True, |
420 | - digits=(16, int(config['price_accuracy'])) |
421 | - ), |
422 | + digits_compute=dp.get_precision('Account')), |
423 | 'balance' : fields.function(_amount_all, method=True, multi="compute", string="Balance", type="float", store=True, readonly=True, |
424 | - digits=(16, int(config['price_accuracy'])) |
425 | - ), |
426 | + digits_compute=dp.get_precision('Account')), |
427 | } |
428 | |
429 | training_intra_budget_tpl() |
430 | @@ -198,10 +175,8 @@ |
431 | |
432 | def _price_compute(self, cr, uid, ids, fieldnames, args, context=None): |
433 | res = dict.fromkeys(ids, 0.0) |
434 | - |
435 | for obj in self.browse(cr, uid, ids, context=context): |
436 | res[obj.id] = obj.product_qty * obj.unit_price |
437 | - |
438 | return res |
439 | |
440 | _columns = { |
441 | @@ -210,13 +185,9 @@ |
442 | 'product_id' : fields.many2one('product.product', 'Product', required=True), |
443 | 'product_qty' : fields.float('Quantity', required=True), |
444 | 'product_uom' : fields.many2one('product.uom', 'Product UoM', required=True), |
445 | - 'unit_price' : fields.float('Unit Price', required=True, digits=(16, int(config['price_accuracy']))), |
446 | - 'price' : fields.function(_price_compute, |
447 | - method=True, |
448 | - store=True, |
449 | - string='Subtotal', |
450 | - digits=(16, int(config['price_accuracy'])), |
451 | - type='float'), |
452 | + 'unit_price' : fields.float('Unit Price', required=True, digits_compute=dp.get_precision('Account')), |
453 | + 'price' : fields.function(_price_compute, method=True, store=True, string='Subtotal', |
454 | + digits_compute=dp.get_precision('Account'), type='float'), |
455 | 'type' : fields.selection([('cost', 'Cost'),('revenue', 'Revenue')], 'Type', required=True), |
456 | } |
457 | |
458 | @@ -333,39 +304,22 @@ |
459 | return res |
460 | |
461 | _columns = { |
462 | - 'intra_session_started': fields.function( |
463 | - _is_intra_started, |
464 | - fnct_search=_is_intra_started_search, |
465 | - type='boolean', |
466 | - string='Is Intra Session Started', |
467 | - method=True, |
468 | - readonly=True), |
469 | - 'costs' : fields.function(_amount_all, |
470 | - method=True, |
471 | - multi="compute", |
472 | - string="Costs", |
473 | - digits=(16, int(config['price_accuracy'])), |
474 | - type="float", |
475 | + 'intra_session_started': fields.function(_is_intra_started, fnct_search=_is_intra_started_search, type='boolean', |
476 | + string='Is Intra Session Started', method=True, readonly=True), |
477 | + 'costs' : fields.function(_amount_all, method=True, multi="compute", string="Costs", digits_compute=dp.get_precision('Account'), |
478 | + type="float",readonly=True |
479 | #store={ |
480 | # 'training.intra.budget.line' : (_get_offer, None, 10), |
481 | #}, |
482 | - readonly=True), |
483 | - 'revenues' : fields.function(_amount_all, |
484 | - method=True, |
485 | - multi="compute", |
486 | - string="Revenues", |
487 | - digits=(16, int(config['price_accuracy'])), |
488 | - type="float", |
489 | + ), |
490 | + 'revenues' : fields.function(_amount_all, method=True, multi="compute", string="Revenues", |
491 | + digits_compute=dp.get_precision('Account'), type="float", |
492 | #store={ |
493 | # 'training.intra.budget.line' : (_get_offer, None, 10), |
494 | #}, |
495 | readonly=True), |
496 | - 'balance' : fields.function(_amount_all, |
497 | - method=True, |
498 | - multi="compute", |
499 | - string="Balance", |
500 | - digits=(16, int(config['price_accuracy'])), |
501 | - type="float", |
502 | + 'balance' : fields.function(_amount_all, method=True, multi="compute", string="Balance", |
503 | + digits_compute=dp.get_precision('Account'), type="float", |
504 | #store={ |
505 | # 'training.intra.budget.line' : (_get_offer, None, 10), |
506 | #}, |
507 | @@ -375,16 +329,10 @@ |
508 | 'address_id' : fields.many2one('res.partner.address', 'Address'), |
509 | 'job_id' : fields.many2one('res.partner.job', 'Contact'), |
510 | 'job_email' : fields.char('Email', size=64), |
511 | - |
512 | 'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account'), |
513 | - |
514 | 'sale_order_id' : fields.many2one('sale.order', 'Sale Order', readonly=True), |
515 | 'sale_order_create_date' : fields.related('sale_order_id', 'create_date', type='datetime', readonly=True, string="Sale Order's Create Date"), |
516 | - 'sale_order_state' : fields.related('sale_order_id', |
517 | - 'state', |
518 | - string="Sale Order's State", |
519 | - type='selection', |
520 | - readonly=True, |
521 | + 'sale_order_state' : fields.related('sale_order_id', 'state', string="Sale Order's State", type='selection', readonly=True, |
522 | selection=[ |
523 | ('draft','Quotation'), |
524 | ('waiting_date','Waiting Schedule'), |
525 | @@ -395,38 +343,28 @@ |
526 | ('done','Done'), |
527 | ('cancel','Cancel'), |
528 | ], |
529 | - select=1 |
530 | ), |
531 | - |
532 | 'budget_intra_template_id' : fields.many2one('training.intra.budget.tpl', 'Budget Intra Template'), |
533 | 'budget_intra_line_ids' : fields.one2many('training.intra.budget.line', 'offer_id', 'Budget Intra Lines'), |
534 | 'attachment_id' : fields.many2one('ir.attachment', 'Support of Course', domain="[('res_model', '=', 'training.course'),('type', '=', 'course_material')]"), |
535 | - 'attachment_price' : fields.related('attachment_id', 'price', type='float', |
536 | - digits=(16, int(config['price_accuracy'])), |
537 | - string="Support's Price", readonly=True), |
538 | + 'attachment_price' : fields.related('attachment_id', 'price', type='float', string="Support's Price", readonly=True, |
539 | + digits_compute=dp.get_precision('Account')), |
540 | 'note_intra' : fields.text('Note'), # note for internal usage |
541 | 'remark_intra' : fields.text('Remark(s)'), # node for client usage |
542 | 'coordinator' : fields.many2one('res.users', 'Coordinator'), |
543 | - |
544 | 'number_of_sessions' : fields.integer('Number of Sessions'), |
545 | 'number_of_participants' : fields.integer('Number of Participants', help='The number of participants of all sessions'), |
546 | 'max_participants_seance' : fields.integer('Maximum of Participants per Seance'), |
547 | 'approved_by' : fields.many2one('res.users', 'Approved By'), |
548 | 'lecturer_id' : fields.many2one('res.partner.job', 'Lecturer'), |
549 | 'location_id' : fields.many2one('training.location', 'Location'), |
550 | - |
551 | 'state' : fields.selection([('draft', 'Draft'), |
552 | ('validated', 'Validated'), |
553 | ('deprecated', 'Deprecated'), |
554 | ('refused', 'Refused'), |
555 | ('done', 'Done'), |
556 | ], |
557 | - 'State', |
558 | - required=True, |
559 | - readonly=True, |
560 | - select=1, |
561 | - help="The status of the course", |
562 | - ), |
563 | + 'State', required=True, readonly=True, help="The status of the course"), |
564 | } |
565 | |
566 | _defaults = { |
567 | @@ -435,10 +373,12 @@ |
568 | 'number_of_participants' : lambda *a: 12, |
569 | } |
570 | |
571 | - |
572 | def action_add_costs(self, cr, uid, ids, context=None): |
573 | + if not ids: |
574 | + return False |
575 | + if context is None: |
576 | + context = {} |
577 | this = self.browse(cr, uid, ids[0], context=context) |
578 | - |
579 | proxy = self.pool.get('training.intra.budget.line') |
580 | for course in this.course_ids: |
581 | for proc_line in course.course_id.purchase_line_ids: |
582 | @@ -465,7 +405,6 @@ |
583 | 'course_id' : course.course_id.id, |
584 | } |
585 | proxy.create(cr, uid, values, context=context) |
586 | - |
587 | return True |
588 | |
589 | def action_compute_values(self, cr, uid, ids, context=None): |
590 | @@ -475,13 +414,11 @@ |
591 | email = '' |
592 | if job_id: |
593 | email = self.pool.get('res.partner.job').browse(cr, uid, job_id, context=context).email or '' |
594 | - |
595 | return {'value' : {'job_email' : email}} |
596 | |
597 | def on_change_partner(self, cr, uid, ids, partner_id, context=None): |
598 | if not partner_id: |
599 | return {'value' : {'address_id' : 0}} |
600 | - |
601 | partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context) |
602 | if partner.address: |
603 | return {'value' : {'address_id' : partner.address[0].id}} |
604 | @@ -491,16 +428,12 @@ |
605 | def on_change_budget_intra_template(self, cr, uid, ids, tpl_id, context=None): |
606 | if not tpl_id: |
607 | return False |
608 | - |
609 | if not ids: |
610 | return False |
611 | - |
612 | his = self.browse(cr, uid, ids[0], context=context) |
613 | - |
614 | tpl_line_proxy = self.pool.get('training.intra.budget.tpl.line') |
615 | line_proxy = self.pool.get('training.intra.budget.line') |
616 | line_ids = tpl_line_proxy.search(cr, uid, [('template_id', '=', tpl_id)], context=context) |
617 | - |
618 | new_line_ids = [] |
619 | for line in tpl_line_proxy.browse(cr, uid, line_ids, context=context): |
620 | values = { |
621 | @@ -512,7 +445,6 @@ |
622 | 'type' : line.type, |
623 | } |
624 | new_line_ids.append(line_proxy.create(cr, uid, values, context=context)) |
625 | - |
626 | return { |
627 | 'value' : { |
628 | 'budget_intra_line_ids': new_line_ids |
629 | @@ -520,7 +452,15 @@ |
630 | } |
631 | |
632 | def action_create_quotation(self, cr, uid, ids, context=None): |
633 | - |
634 | + if not ids: |
635 | + return False |
636 | + if context is None: |
637 | + context = {} |
638 | + proxy_adist = self.pool.get('account.analytic.plan.instance') |
639 | + proxy_adistline = self.pool.get('account.analytic.plan.instance.line') |
640 | + proxy = self.pool.get('sale.order') |
641 | + proxy_line = self.pool.get('sale.order.line') |
642 | + journal_proxy = self.pool.get('account.journal') |
643 | this = self.browse(cr, uid, ids[0], context=context) |
644 | |
645 | if not this.partner_id: |
646 | @@ -533,10 +473,6 @@ |
647 | if not len(this.course_ids): |
648 | raise osv.except_osv(_('Warning'), |
649 | _('The list of courses is empty !')) |
650 | - |
651 | - proxy = self.pool.get('sale.order') |
652 | - proxy_line = self.pool.get('sale.order.line') |
653 | - |
654 | values = { |
655 | 'partner_id' : this.partner_id.id, |
656 | 'pricelist_id' : this.partner_id.property_product_pricelist.id, |
657 | @@ -559,10 +495,6 @@ |
658 | raise osv.except_osv(_('Error'), |
659 | _("The following course has not a valid duration \"%s\" (%d)") % (course_rel.course_id.name, course_rel.course_id.id)) |
660 | total_duration += course_rel.course_id.duration |
661 | - proxy_adist = self.pool.get('account.analytic.plan.instance') |
662 | - proxy_adistline = self.pool.get('account.analytic.plan.instance.line') |
663 | - |
664 | - journal_proxy = self.pool.get('account.journal') |
665 | journal_sales_srch = journal_proxy.search(cr, uid, [('type','=','sale'),('refund_journal','=',False)]) |
666 | journal_sales = journal_proxy.browse(cr, uid, journal_sales_srch)[0] |
667 | |
668 | @@ -648,7 +580,6 @@ |
669 | |
670 | def _price_compute(self, cr, uid, ids, fieldnames, args, context=None): |
671 | res = dict.fromkeys(ids, 0.0) |
672 | - |
673 | for obj in self.browse(cr, uid, ids, context=context): |
674 | res[obj.id] = obj.product_qty * obj.unit_price * (obj.number_of_seances or 1.0) |
675 | |
676 | @@ -656,21 +587,12 @@ |
677 | |
678 | _columns = { |
679 | 'offer_id' : fields.many2one('training.offer', 'Offer', select=1), |
680 | - |
681 | 'description' : fields.char('Description', size=128, required=True), |
682 | 'product_id' : fields.many2one('product.product', 'Product', select=1), |
683 | 'product_qty' : fields.float('Quantity', required=True), |
684 | 'product_uom' : fields.many2one('product.uom', 'Product UoM', required=True), |
685 | - 'unit_price' : fields.float('Unit Price', required=True, |
686 | - digits=(16, int(config['price_accuracy'])), |
687 | - ), |
688 | - 'price' : fields.function(_price_compute, |
689 | - method=True, |
690 | - string='Price', |
691 | - store=True, |
692 | - select=2, |
693 | - digits=(16, int(config['price_accuracy'])), |
694 | - type='float'), |
695 | + 'unit_price' : fields.float('Unit Price', required=True, digits_compute=dp.get_precision('Account')), |
696 | + 'price' : fields.function(_price_compute, method=True, string='Price', store=True, digits_compute=dp.get_precision('Account'), type='float'), |
697 | 'number_of_seances' : fields.integer('Recurrence', required=True), |
698 | 'type' : fields.selection([('cost', 'Cost'),('revenue', 'Revenue')], 'Type', required=True, select=1), |
699 | 'course_id' : fields.many2one('training.course', 'Course', select=1), |
700 | |
701 | === modified file 'training_intra/training_intra_view.xml' |
702 | --- training_intra/training_intra_view.xml 2011-02-23 12:44:45 +0000 |
703 | +++ training_intra/training_intra_view.xml 2011-03-17 09:08:29 +0000 |
704 | @@ -56,7 +56,23 @@ |
705 | </field> |
706 | </record> |
707 | |
708 | - <record model="ir.ui.view" id="budget_intra_tpl_form"> |
709 | + <record model="ir.ui.view" id="budget_intra_tpl_line_search"> |
710 | + <field name="name">training.intra.budget.tpl.line.search</field> |
711 | + <field name="model">training.intra.budget.tpl.line</field> |
712 | + <field name="type">search</field> |
713 | + <field name="arch" type="xml"> |
714 | + <search string="Search Training Intra Budget"> |
715 | + <field name="product_id"/> |
716 | + <field name="type"/> |
717 | + <newline/> |
718 | + <group expand="0" string="Group By..." colspan="4"> |
719 | + <filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type'}"/> |
720 | + </group> |
721 | + </search> |
722 | + </field> |
723 | + </record> |
724 | + |
725 | + <record model="ir.ui.view" id="view_budget_intra_tpl_form"> |
726 | <field name="name">training.intra.budget.tpl.form</field> |
727 | <field name="model">training.intra.budget.tpl</field> |
728 | <field name="type">form</field> |
729 | @@ -73,11 +89,39 @@ |
730 | </field> |
731 | </record> |
732 | |
733 | + <record model="ir.ui.view" id="view_budget_intra_tpl_tree"> |
734 | + <field name="name">training.intra.budget.tpl.tree</field> |
735 | + <field name="model">training.intra.budget.tpl</field> |
736 | + <field name="type">tree</field> |
737 | + <field name="arch" type="xml"> |
738 | + <tree string="Budget Template"> |
739 | + <field name="name"/> |
740 | + <field name="costs"/> |
741 | + <field name="revenues"/> |
742 | + <field name="balance"/> |
743 | + </tree> |
744 | + </field> |
745 | + </record> |
746 | + |
747 | + <record model="ir.ui.view" id="view_budget_intra_tpl_search"> |
748 | + <field name="name">training.intra.budget.tpl.search</field> |
749 | + <field name="model">training.intra.budget.tpl</field> |
750 | + <field name="type">search</field> |
751 | + <field name="arch" type="xml"> |
752 | + <search string="Budget Template"> |
753 | + <field name="name"/> |
754 | + <field name="revenues"/> |
755 | + <field name="balance"/> |
756 | + </search> |
757 | + </field> |
758 | + </record> |
759 | + |
760 | <record model="ir.actions.act_window" id="budget_intra_tpl_all_act"> |
761 | <field name="name">Budget Templates</field> |
762 | <field name="res_model">training.intra.budget.tpl</field> |
763 | <field name="view_type">form</field> |
764 | <field name="view_mode">tree,form</field> |
765 | + <field name="search_view_id" ref="view_budget_intra_tpl_search"/> |
766 | </record> |
767 | |
768 | <menuitem parent="training.training_config_mi" id="budget_intra_tpl_all_mi" action="budget_intra_tpl_all_act" /> |
769 | @@ -177,7 +221,7 @@ |
770 | </field> |
771 | </record> |
772 | |
773 | - <act_window |
774 | + <act_window |
775 | name="Sale Order" |
776 | src_model="training.offer" |
777 | res_model="sale.order" |
778 | @@ -186,26 +230,26 @@ |
779 | id="sale_order_offer_rel" |
780 | domain="[('id', '=', sale_order_id)]" /> |
781 | |
782 | - <act_window id="training_intra_sale_order_invoice_link" |
783 | - name="Invoices" |
784 | - src_model="sale.order" |
785 | - res_model="account.invoice" |
786 | - view_mode="tree,form" |
787 | - groups="base.group_user" |
788 | - domain="[('id','in',(invoice_ids and invoice_ids[0][2] or []))]"/> |
789 | - |
790 | - <record id="training_intra_so_link_view1" model="ir.actions.act_window.view"> |
791 | - <field name="sequence" eval="1"/> |
792 | - <field name="view_mode">tree</field> |
793 | - <field name="act_window_id" ref="training_intra_sale_order_invoice_link"/> |
794 | - </record> |
795 | - |
796 | - <record id="training_intra_so_link_view2" model="ir.actions.act_window.view"> |
797 | - <field name="sequence" eval="2"/> |
798 | - <field name="view_mode">form</field> |
799 | - <field name="view_id" ref="account.invoice_form"/> |
800 | - <field name="act_window_id" ref="training_intra_sale_order_invoice_link"/> |
801 | - </record> |
802 | + <act_window id="training_intra_sale_order_invoice_link" |
803 | + name="Invoices" |
804 | + src_model="sale.order" |
805 | + res_model="account.invoice" |
806 | + view_mode="tree,form" |
807 | + groups="base.group_user" |
808 | + domain="[('id','in',(invoice_ids and invoice_ids[0][2] or []))]"/> |
809 | + |
810 | + <record id="training_intra_so_link_view1" model="ir.actions.act_window.view"> |
811 | + <field name="sequence" eval="1"/> |
812 | + <field name="view_mode">tree</field> |
813 | + <field name="act_window_id" ref="training_intra_sale_order_invoice_link"/> |
814 | + </record> |
815 | + |
816 | + <record id="training_intra_so_link_view2" model="ir.actions.act_window.view"> |
817 | + <field name="sequence" eval="2"/> |
818 | + <field name="view_mode">form</field> |
819 | + <field name="view_id" ref="account.invoice_form"/> |
820 | + <field name="act_window_id" ref="training_intra_sale_order_invoice_link"/> |
821 | + </record> |
822 | |
823 | <record model="ir.ui.view" id="budget_intra_line_tree"> |
824 | <field name="name">training.intra.budget.line.tree</field> |
825 | @@ -215,7 +259,7 @@ |
826 | <tree string="Budget Lines" editable="bottom"> |
827 | <field name="offer_id" invisible="1" /> |
828 | <field name="number_of_seances" /> |
829 | - <field name="course_id" context="{'offer_id' : offer_id}" /> |
830 | + <field name="course_id" context="{'offer_id' : offer_id}" /> |
831 | <field name="type" on_change="on_change_product(type, product_id)" /> |
832 | <field name="product_id" on_change="on_change_product(type, product_id)" /> |
833 | <field name="description" /> |
834 | @@ -242,13 +286,29 @@ |
835 | <field name="type" on_change="on_change_product(type, product_id)" /> |
836 | <field name="unit_price" /> |
837 | <field name="number_of_seances" /> |
838 | - <field name="course_id" context="{'offer_id' : offer_id}" /> |
839 | + <field name="course_id" context="{'offer_id' : offer_id}" /> |
840 | <field name="offer_id" invisible="1" /> |
841 | </form> |
842 | </field> |
843 | </record> |
844 | |
845 | - |
846 | + <record model="ir.ui.view" id="budget_intra_line_search"> |
847 | + <field name="name">training.intra.budget.line.search</field> |
848 | + <field name="model">training.intra.budget.line</field> |
849 | + <field name="type">search</field> |
850 | + <field name="arch" type="xml"> |
851 | + <search string="Budget Lines"> |
852 | + <field name="offer_id"/> |
853 | + <field name="course_id"/> |
854 | + <field name="type"/> |
855 | + <field name="product_id"/> |
856 | + <newline/> |
857 | + <group expand="0" string="Group By..." colspan="4"> |
858 | + <filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type'}"/> |
859 | + </group> |
860 | + </search> |
861 | + </field> |
862 | + </record> |
863 | |
864 | <record model="ir.ui.view" id="course_form"> |
865 | <field name="name">training.course.form.intra</field> |
866 | @@ -271,71 +331,62 @@ |
867 | <field name="priority">20</field> |
868 | <field name="arch" type="xml"> |
869 | <tree string="Offers"> |
870 | - <field name="name" /> |
871 | - <field name="type_id" /> |
872 | - <field name="partner_id" select="1" /> |
873 | - <field name="responsible" select="1" /> |
874 | + <field name="name"/> |
875 | + <field name="kind"/> |
876 | + <field name="type_id"/> |
877 | + <field name="partner_id" select="1"/> |
878 | + <field name="responsible" select="1"/> |
879 | <field name="create_date" select="1"/> |
880 | - <field name="is_standalone" /> |
881 | - <field name="state" /> |
882 | - <field name="costs"/> |
883 | - <field name="revenues"/> |
884 | - <field name="sale_order_id" /> |
885 | - <field name="sale_order_create_date" /> |
886 | + <field name="is_standalone"/> |
887 | + <field name="state"/> |
888 | + <field name="costs"/> |
889 | + <field name="revenues"/> |
890 | + <field name="sale_order_id"/> |
891 | + <field name="sale_order_create_date"/> |
892 | <field name="sale_order_state" select="1"/> |
893 | </tree> |
894 | </field> |
895 | </record> |
896 | |
897 | + <record model="ir.ui.view" id="view_training_intra_offer_search"> |
898 | + <field name="name">training.offer.search</field> |
899 | + <field name="model">training.offer</field> |
900 | + <field name="type">search</field> |
901 | + <field name="arch" type="xml"> |
902 | + <search string="Search Training Offer"> |
903 | + <group col='10' colspan='4'> |
904 | + <filter icon="terp-document-new" string="Draft" domain="[('state','=', 'draft')]"/> |
905 | + <filter icon="terp-accessories-archiver" string="Validated" domain="[('state','=', 'validated')]"/> |
906 | + <filter icon="terp-dialog-close" string="Deprecated" domain="[('state','=', 'deprecated')]"/> |
907 | + <filter icon="gtk-go-up" string="Done" domain="[('state','=', 'done')]"/> |
908 | + <filter icon="gtk-refresh" string="Refused" domain="[('state','=', 'refused')]"/> |
909 | + <separator orientation="vertical"/> |
910 | + <field name="name"/> |
911 | + <field name="type_id"/> |
912 | + <field name="kind"/> |
913 | + </group> |
914 | + <newline/> |
915 | + <group expand="0" string="Group By..." colspan="4" col="20"> |
916 | + <filter string="Category" icon="terp-personal" domain="[]" context="{'group_by':'categorie_id'}"/> |
917 | + <filter string="kind" icon="terp-report" domain="[]" context="{'group_by':'kind'}"/> |
918 | + <filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type_id'}"/> |
919 | + <filter string="Product" icon="terp-stage" domain="[]" context="{'group_by':'product_id'}"/> |
920 | + <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/> |
921 | + </group> |
922 | + </search> |
923 | + </field> |
924 | + </record> |
925 | + |
926 | <record model="ir.actions.act_window" id="training_offer_intra_act"> |
927 | - <field name="name">Intra</field> |
928 | + <field name="name">Intra Offers</field> |
929 | <field name="res_model">training.offer</field> |
930 | <field name="view_type">form</field> |
931 | <field name="view_mode">tree,form</field> |
932 | <field name="view_id" ref="training_offer_intra_tree" /> |
933 | <field name="domain">[('kind', '=', 'intra')]</field> |
934 | - </record> |
935 | - <menuitem id="training_offer_intra_mi" parent="training.training_offer_mi" action="training_offer_intra_act" sequence="2"/> |
936 | - |
937 | - <record model="ir.actions.act_window" id="training_offer_validated_intra_act"> |
938 | - <field name="name">Validated Intra Offers</field> |
939 | - <field name="res_model">training.offer</field> |
940 | - <field name="view_type">form</field> |
941 | - <field name="view_mode">tree,form</field> |
942 | - <field name="view_id" ref="training_offer_intra_tree" /> |
943 | - <field name="domain">[('kind', '=', 'intra'),('state', '=', 'validated')]</field> |
944 | - </record> |
945 | - <menuitem id="training_offer_validated_intra_mi" parent="training_offer_intra_mi" action="training_offer_validated_intra_act" sequence="2"/> |
946 | - |
947 | - <record model="ir.actions.act_window" id="training_offer_draft_intra_act"> |
948 | - <field name="name">Draft Intra Offers</field> |
949 | - <field name="res_model">training.offer</field> |
950 | - <field name="view_type">form</field> |
951 | - <field name="view_mode">tree,form</field> |
952 | - <field name="view_id" ref="training_offer_intra_tree" /> |
953 | - <field name="domain">[('kind', '=', 'intra'),('state', '=', 'draft')]</field> |
954 | - </record> |
955 | - <menuitem id="training_offer_draft_intra_mi" parent="training_offer_intra_mi" action="training_offer_draft_intra_act" sequence="2"/> |
956 | - |
957 | - <record model="ir.actions.act_window" id="training_offer_deprecated_intra_act"> |
958 | - <field name="name">Deprecated Intra Offers</field> |
959 | - <field name="res_model">training.offer</field> |
960 | - <field name="view_type">form</field> |
961 | - <field name="view_mode">tree,form</field> |
962 | - <field name="view_id" ref="training_offer_intra_tree" /> |
963 | - <field name="domain">[('kind', '=', 'intra'),('state', '=', 'deprecated')]</field> |
964 | - </record> |
965 | - <menuitem id="training_offer_deprecated_intra_mi" parent="training_offer_intra_mi" action="training_offer_deprecated_intra_act" sequence="2"/> |
966 | - |
967 | - <record model="ir.actions.act_window" id="training_offer_intra_notdone_notcancelled_act"> |
968 | - <field name="name">Not Done, Not Cancelled Intra Offers</field> |
969 | - <field name="res_model">training.offer</field> |
970 | - <field name="view_type">form</field> |
971 | - <field name="view_mode">tree,form</field> |
972 | - <field name="view_id" ref="training_offer_intra_tree"/> |
973 | - <field name="domain">[('kind', '=', 'intra'),('state', 'not in', ['cancelled','done'])]</field> |
974 | - </record> |
975 | - <menuitem id="training_offer_intra_notdone_notcancelled_mi" parent="training_offer_intra_mi" action="training_offer_intra_notdone_notcancelled_act"/> |
976 | + <field name="search_view_id" ref="view_training_intra_offer_search"/> |
977 | + </record> |
978 | + <menuitem id="training_offer_intra_mi" parent="training.training_library_mi" action="training_offer_intra_act" sequence="20"/> |
979 | |
980 | <!-- contact function 'intra' doesn't exists -> choose 'standard' lecturers... --> |
981 | <record model='ir.ui.view' id="training_session_form_inherit"> |
982 | @@ -386,26 +437,6 @@ |
983 | </field> |
984 | </record> |
985 | |
986 | - <record model="ir.actions.act_window" id="intra_session_all_act"> |
987 | - <field name="name">Intra Sessions</field> |
988 | - <field name="res_model">training.session</field> |
989 | - <field name="view_type">form</field> |
990 | - <field name="view_mode">tree,form</field> |
991 | - <field name="domain">[('kind', '=', 'intra')]</field> |
992 | - </record> |
993 | - |
994 | - <menuitem id="intra_session_all_mi" parent="training.training_planning_session_future_all_mi" action="intra_session_all_act" /> |
995 | - |
996 | - <record model="ir.actions.act_window" id="intra_seance_all_act"> |
997 | - <field name="name">Intra Seances</field> |
998 | - <field name="res_model">training.seance</field> |
999 | - <field name="view_type">form</field> |
1000 | - <field name="view_mode">tree,form</field> |
1001 | - <field name="domain">[('is_intra', '=', 1)]</field> |
1002 | - </record> |
1003 | - |
1004 | - <menuitem id="intra_seance_all_mi" parent="training.training_planning_future_seances_mi" action="intra_seance_all_act"/> |
1005 | - |
1006 | <record model='ir.ui.view' id="training_seance_form_inherit"> |
1007 | <field name="name">training_intra.seance.form.inherit</field> |
1008 | <field name="model">training.seance</field> |
1009 | |
1010 | === modified file 'training_room/__init__.py' |
1011 | --- training_room/__init__.py 2011-02-25 12:33:02 +0000 |
1012 | +++ training_room/__init__.py 2011-03-17 09:08:29 +0000 |
1013 | @@ -1,7 +1,7 @@ |
1014 | # -*- encoding: utf-8 -*- |
1015 | ############################################################################################ |
1016 | # |
1017 | -# OpenERP, Open Source Management Solution |
1018 | +# OpenERP, Open Source Management Solution |
1019 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
1020 | # Copyright (C) 2008-2009 AJM Technologies S.A. (<http://www.ajm.lu). All Rights Reserved |
1021 | # Copyright (C) 2010-2011 Thamini S.à.R.L (<http://www.thamini.com>). All Rights Reserved |
1022 | @@ -24,3 +24,5 @@ |
1023 | |
1024 | import training_room |
1025 | import wizard |
1026 | + |
1027 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1028 | \ No newline at end of file |
1029 | |
1030 | === renamed file 'training_room/__terp__.py' => 'training_room/__openerp__.py' |
1031 | --- training_room/__terp__.py 2011-02-25 12:33:02 +0000 |
1032 | +++ training_room/__openerp__.py 2011-03-17 09:08:29 +0000 |
1033 | @@ -1,7 +1,7 @@ |
1034 | # -*- encoding: utf-8 -*- |
1035 | ############################################################################################ |
1036 | # |
1037 | -# OpenERP, Open Source Management Solution |
1038 | +# OpenERP, Open Source Management Solution |
1039 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
1040 | # Copyright (C) 2008-2009 AJM Technologies S.A. (<http://www.ajm.lu). All Rights Reserved |
1041 | # Copyright (C) 2010-2011 Thamini S.à.R.L (<http://www.thamini.com>). All Rights Reserved |
1042 | @@ -35,7 +35,7 @@ |
1043 | 'demo_xml' : [ ], |
1044 | 'update_xml' : [ |
1045 | 'training_room_view.xml', |
1046 | - 'wizard/wizard_create_session_i_view.xml', |
1047 | + 'wizard/training_create_session_wizard_view.xml', |
1048 | 'security/ir.model.access.csv', |
1049 | ], |
1050 | 'active' : False, |
1051 | |
1052 | === modified file 'training_room/training_room.py' |
1053 | --- training_room/training_room.py 2011-02-25 12:33:02 +0000 |
1054 | +++ training_room/training_room.py 2011-03-17 09:08:29 +0000 |
1055 | @@ -30,9 +30,8 @@ |
1056 | _inherit = 'res.partner' |
1057 | |
1058 | _columns = { |
1059 | - 'notify_location' : fields.many2one('res.partner.job', |
1060 | - 'Notification for Location', |
1061 | - domain="[('name', '=', active_id),('state', '=', 'current')]"), |
1062 | + 'notify_location' : fields.many2one('res.partner.job', 'Notification for Location', |
1063 | + domain="[('name', '=', active_id),('state', '=', 'current')]"), |
1064 | } |
1065 | |
1066 | res_partner() |
1067 | @@ -54,10 +53,11 @@ |
1068 | } |
1069 | |
1070 | def name_get(self, cr, uid, ids, context=None): |
1071 | + if context is None: |
1072 | + context = {} |
1073 | res = [] |
1074 | for obj in self.browse(cr, uid, list(set(ids)), context=context): |
1075 | res.append((obj.id, "%s (%s)" % (obj.name, obj.partner_id.name,))) |
1076 | - |
1077 | return res |
1078 | |
1079 | def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=80): |
1080 | @@ -118,7 +118,10 @@ |
1081 | def _default_get_location_id(self, cr, uid, context=None): |
1082 | # FIXME: get default for a core_config option |
1083 | cr.execute("SELECT min(id) from training_location") |
1084 | - return cr.fetchone() |
1085 | + location = cr.fetchone() |
1086 | + if not location or (len(location) > 0 and not location[0]): |
1087 | + location = False |
1088 | + return location |
1089 | |
1090 | _defaults = { |
1091 | 'reserved' : lambda *a: 0, |
1092 | @@ -155,14 +158,16 @@ |
1093 | seance_ids = super(training_session, self)._create_seance(cr, uid, session, context=context) |
1094 | seance_vals = {} |
1095 | if session.location_id: |
1096 | - seance_vals['location_id'] = session.location_id.id |
1097 | - seance_vals['delivery_location_id'] = session.location_id.id # will be overwritten if a the "delivery location" is really filled up |
1098 | + seance_vals.update({ |
1099 | + 'location_id' : session.location_id.id, |
1100 | + 'delivery_location_id' : session.location_id.id |
1101 | + }) # will be overwritten if a the "delivery location" is really filled up |
1102 | if session.delivery_location_id: |
1103 | - seance_vals['delivery_location_id'] = session.delivery_location_id.id |
1104 | + seance_vals.update({'delivery_location_id' : session.delivery_location_id.id}) |
1105 | if session.location_note: |
1106 | - seance_vals['location_note'] = session.location_note |
1107 | + seance_vals.update({'location_note' : session.location_note}) |
1108 | if session.delivery_location_note: |
1109 | - seance_vals['delivery_location_note'] = session.delivery_location_note |
1110 | + seance_vals.update({'delivery_location_note' : session.delivery_location_note}) |
1111 | if seance_vals: |
1112 | self.pool.get('training.seance').write(cr, uid, seance_ids, seance_vals, context=context) |
1113 | return seance_ids |
1114 | @@ -187,3 +192,5 @@ |
1115 | 'delivery_location_id': fields.related('seance_id', 'delivery_location_id', type='many2one', relation='training.location', string='Delivery Location', readonly=True), |
1116 | } |
1117 | purchase_order_line_seance_room() |
1118 | + |
1119 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1120 | \ No newline at end of file |
1121 | |
1122 | === modified file 'training_room/training_room_view.xml' |
1123 | --- training_room/training_room_view.xml 2011-01-05 11:41:40 +0000 |
1124 | +++ training_room/training_room_view.xml 2011-03-17 09:08:29 +0000 |
1125 | @@ -41,28 +41,31 @@ |
1126 | </field> |
1127 | </record> |
1128 | |
1129 | + <record model="ir.ui.view" id="view_training_location_search"> |
1130 | + <field name="name">training.location.search</field> |
1131 | + <field name="model">training.location</field> |
1132 | + <field name="type">search</field> |
1133 | + <field name="arch" type="xml"> |
1134 | + <search string="Search Training Location"> |
1135 | + <field name="name"/> |
1136 | + <field name="partner_id"/> |
1137 | + <field name="seats"/> |
1138 | + </search> |
1139 | + </field> |
1140 | + </record> |
1141 | + |
1142 | <record model="ir.actions.act_window" id="training_location_all_act"> |
1143 | <field name="name">Rooms</field> |
1144 | <field name="res_model">training.location</field> |
1145 | <field name="view_type">form</field> |
1146 | <field name="view_mode">tree,form</field> |
1147 | - </record> |
1148 | - |
1149 | - <record model="ir.actions.act_window" id="training_location_new_act"> |
1150 | - <field name="name">New Room</field> |
1151 | - <field name="res_model">training.location</field> |
1152 | - <field name="view_type">form</field> |
1153 | - <field name="view_mode">form</field> |
1154 | - </record> |
1155 | - |
1156 | - <menuitem |
1157 | - id="training_config_locations_mi" |
1158 | - parent="training.training_config_mi" |
1159 | - action="training_location_all_act" sequence='45'/> |
1160 | - <menuitem |
1161 | - id="training_config_locations_new_mi" |
1162 | - parent="training_config_locations_mi" |
1163 | - action="training_location_new_act" /> |
1164 | + <field name="search_view_id" ref="view_training_location_search"/> |
1165 | + </record> |
1166 | + |
1167 | + <menuitem |
1168 | + id="training_config_locations_mi" |
1169 | + parent="training.training_config_mi" |
1170 | + action="training_location_all_act" sequence='60'/> |
1171 | |
1172 | <record model="ir.ui.view" id="training_seance_form"> |
1173 | <field name="name">training.seance.form</field> |
1174 | |
1175 | === modified file 'training_room/wizard/__init__.py' |
1176 | --- training_room/wizard/__init__.py 2010-10-08 09:37:19 +0000 |
1177 | +++ training_room/wizard/__init__.py 2011-03-17 09:08:29 +0000 |
1178 | @@ -21,4 +21,6 @@ |
1179 | # |
1180 | ############################################################################## |
1181 | |
1182 | -import wizard_create_session_i |
1183 | +import training_create_session_wizard |
1184 | + |
1185 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1186 | \ No newline at end of file |
1187 | |
1188 | === renamed file 'training_room/wizard/wizard_create_session_i.py' => 'training_room/wizard/training_create_session_wizard.py' |
1189 | --- training_room/wizard/wizard_create_session_i.py 2010-10-08 09:50:38 +0000 |
1190 | +++ training_room/wizard/training_create_session_wizard.py 2011-03-17 09:08:29 +0000 |
1191 | @@ -33,6 +33,8 @@ |
1192 | } |
1193 | |
1194 | def _default_get_location(self, cr, uid, context=None, field='location_id'): |
1195 | + if context is None: |
1196 | + context= {} |
1197 | session_pool = self.pool.get('training.session') |
1198 | active_id = context and context.get('active_id') or None |
1199 | vals = session_pool.on_change_offer(cr, uid, None, active_id) |
1200 | @@ -50,6 +52,8 @@ |
1201 | } |
1202 | |
1203 | def _get_new_session_data(self, cr, uid, wizard, context=None): |
1204 | + if context is None: |
1205 | + context = {} |
1206 | resdict = super(training_session_create_wizard_room, self)._get_new_session_data(cr, uid, wizard, context=context) |
1207 | if wizard.location_id: |
1208 | resdict['location_id'] = wizard.location_id.id |
1209 | |
1210 | === renamed file 'training_room/wizard/wizard_create_session_i_view.xml' => 'training_room/wizard/training_create_session_wizard_view.xml' |
Hello,
Add Category field in tree view of training.offer.
Still the icon is not correct on filter.