Merge lp:~unifield-team/unifield-web/uf_408_remove_duplicate_button into lp:unifield-web

Proposed by Duy VO
Status: Merged
Merge reported by: jftempo
Merged at revision: not available
Proposed branch: lp:~unifield-team/unifield-web/uf_408_remove_duplicate_button
Merge into: lp:unifield-web
Diff against target: 84 lines (+15/-20)
2 files modified
addons/openerp/controllers/form.py (+14/-19)
addons/openerp/controllers/templates/form.mako (+1/-1)
To merge this branch: bzr merge lp:~unifield-team/unifield-web/uf_408_remove_duplicate_button
Reviewer Review Type Date Requested Status
jftempo Pending
Review via email: mp+71658@code.launchpad.net

Description of the change

use a quick&dirty solution, if it's too dirty, then i will try another solution ...

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 'addons/openerp/controllers/form.py'
2--- addons/openerp/controllers/form.py 2011-08-01 15:24:01 +0000
3+++ addons/openerp/controllers/form.py 2011-08-16 10:22:26 +0000
4@@ -23,13 +23,16 @@
5 import cherrypy
6 from openerp import utils, widgets as tw, validators
7 from openerp.controllers import SecuredController
8-from openerp.utils import rpc, common, TinyDict, TinyForm, expr_eval
9+from openerp.utils import rpc, common, TinyDict, TinyForm, expr_eval, node_attributes
10 from error_page import _ep
11 from openobject.tools import expose, redirect, validate, error_handler, exception_handler
12 import openobject
13 import openobject.paths
14 import simplejson
15
16+import xml.dom.minidom
17+
18+
19 def make_domain(name, value, kind='char'):
20 """A helper function to generate domain for the given name, value pair.
21 Will be used for search window...
22@@ -207,6 +210,13 @@
23 buttons.new = (not editable or mode == 'tree') and mode != 'diagram'
24 buttons.edit = not editable and (mode == 'form' or mode == 'diagram')
25 buttons.save = editable and mode == 'form'
26+
27+
28+ # UF-408: A quick&dirty fix to remove the button "duplicate" in the view Periods!
29+ buttons.duplicate = True
30+ if params.model == "account.period":
31+ buttons.duplicate = False
32+
33 buttons.cancel = editable and mode == 'form'
34 buttons.delete = not editable and mode == 'form'
35 buttons.pager = mode == 'form' or mode == 'diagram'# Pager will visible in edit and non-edit mode in form view.
36@@ -287,7 +297,6 @@
37 '_terp_notebook_tab': notebook_tab})
38 params.o2m_edit = o2m_edit
39 params.editable = editable
40- params.action_id = kw.get('action_id')
41
42 if kw.get('default_date'):
43 params.context.update({'default_date' : kw['default_date']})
44@@ -405,24 +414,10 @@
45 params.ids = (params.ids or []) + [params.id]
46 params.count += 1
47 else:
48- ctx = utils.context_with_concurrency_info(params.context, params.concurrency_info)
49- if params.button and params.button.name:
50+ ctx = utils.context_with_concurrency_info(params.context, params.concurrency_info)
51+ if params.button and params.button.name:
52 ctx.update({'button': params.button.name})
53-
54- #original_data = Model.read(params.id, data.keys())
55- #modified = {}
56-
57- #if original_data and isinstance(original_data, dict):
58- # for field, original_value in original_data.iteritems():
59- # if isinstance(original_value, tuple):
60- # original_data[field] = original_value[0]
61- # if field in data and data[field] != original_data[field]:
62- # modified[field] = data[field]
63-
64- # Model.write([params.id], modified, ctx)
65- #else:
66- # Model.write([params.id], data, ctx)
67- Model.write([params.id], data, ctx)
68+ Model.write([params.id], data, ctx)
69
70 tw.ConcurrencyInfo.update(
71 params.model, Model.read([params.id], ['__last_update'], ctx)
72
73=== modified file 'addons/openerp/controllers/templates/form.mako'
74--- addons/openerp/controllers/templates/form.mako 2011-01-21 09:36:34 +0000
75+++ addons/openerp/controllers/templates/form.mako 2011-08-16 10:22:26 +0000
76@@ -125,7 +125,7 @@
77 <a href="javascript: void(0);" onclick="submit_form('save_and_edit')" class="button-a">${_("Save & Edit")}</a>
78 </li>
79 % endif
80- % if buttons.edit and form.screen.view_type== 'form':
81+ % if buttons.edit and form.screen.view_type== 'form' and buttons.duplicate:
82 <li title="${_('Duplicate this resource')}">
83 <a href="javascript: void(0);" onclick="submit_form('duplicate')" class="button-a">${_("Duplicate")}</a>
84 </li>

Subscribers

People subscribed via source and target branches

to all changes: