Merge lp:~jfb-tempo-consulting/unifield-web/US-7304 into lp:unifield-web
- US-7304
- Merge into trunk
Proposed by
jftempo
Status: | Merged |
---|---|
Merged at revision: | 4988 |
Proposed branch: | lp:~jfb-tempo-consulting/unifield-web/US-7304 |
Merge into: | lp:unifield-web |
Diff against target: |
265 lines (+91/-42) 9 files modified
addons/openerp/controllers/templates/base.mako (+1/-1) addons/openerp/static/css/listgrid.css (+15/-2) addons/openerp/widgets/form/_form.py (+6/-0) addons/openerp/widgets/form/templates/html.mako (+2/-0) addons/openerp/widgets/listgrid.py (+4/-0) addons/openerp/widgets/listgroup.py (+28/-7) addons/openerp/widgets/templates/listgrid/html.mako (+1/-0) addons/openerp/widgets/templates/listgrid/listgrid.mako (+33/-31) addons/openerp/widgets/templates/listgrid/listgroup.mako (+1/-1) |
To merge this branch: | bzr merge lp:~jfb-tempo-consulting/unifield-web/US-7304 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Dev Team | Pending | ||
Review via email: mp+381115@code.launchpad.net |
Commit message
Description of the change
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/templates/base.mako' |
2 | --- addons/openerp/controllers/templates/base.mako 2020-02-25 13:53:15 +0000 |
3 | +++ addons/openerp/controllers/templates/base.mako 2020-03-24 15:50:11 +0000 |
4 | @@ -33,7 +33,7 @@ |
5 | <link rel="stylesheet" type="text/css" href="/openerp/static/css/notebook.css?v=16.0rc2"/> |
6 | |
7 | <link rel="stylesheet" type="text/css" href="/openerp/static/css/pager.css"/> |
8 | - <link rel="stylesheet" type="text/css" href="/openerp/static/css/listgrid.css?v=16.0rc2"/> |
9 | + <link rel="stylesheet" type="text/css" href="/openerp/static/css/listgrid.css?v=16.1"/> |
10 | <link rel="stylesheet" type="text/css" href="/openerp/static/css/autocomplete.css"/> |
11 | |
12 | <!--[if lt IE 9]> |
13 | |
14 | === modified file 'addons/openerp/static/css/listgrid.css' |
15 | --- addons/openerp/static/css/listgrid.css 2020-02-25 10:55:25 +0000 |
16 | +++ addons/openerp/static/css/listgrid.css 2020-03-24 15:50:11 +0000 |
17 | @@ -86,7 +86,6 @@ |
18 | font-weight: bold; |
19 | position: sticky; |
20 | top: 0; |
21 | - z-index: 1; |
22 | text-align: center !important; |
23 | } |
24 | |
25 | @@ -230,14 +229,28 @@ |
26 | color: #7D7979; |
27 | font-size: 0.9em; |
28 | } |
29 | - |
30 | +.o2m_filter_block { |
31 | + width: 99.5%; |
32 | + border-bottom: 1px solid rgb(153, 153, 153); |
33 | + padding-bottom: 5px; |
34 | +} |
35 | .o2m_header_filter td { |
36 | padding-right: 10px; |
37 | padding-left: 4px; |
38 | + padding-top: 10px; |
39 | + padding-bottom: 10px; |
40 | } |
41 | .o2m_header_filter img { |
42 | cursor: pointer; |
43 | } |
44 | + |
45 | +.htmlbox { |
46 | + display: flex; |
47 | + align-items: center; |
48 | +} |
49 | +.warning { |
50 | + margin-right: 3px; |
51 | +} |
52 | /** |
53 | * vim: sts=4 st=4 et |
54 | * |
55 | |
56 | === modified file 'addons/openerp/widgets/form/_form.py' |
57 | --- addons/openerp/widgets/form/_form.py 2020-02-24 15:15:02 +0000 |
58 | +++ addons/openerp/widgets/form/_form.py 2020-03-24 15:50:11 +0000 |
59 | @@ -799,6 +799,12 @@ |
60 | |
61 | register_widget(HtmlView, ["html"]) |
62 | |
63 | +class HtmlText(Char): |
64 | + |
65 | + template = "/openerp/widgets/form/templates/html.mako" |
66 | + |
67 | +register_widget(HtmlText, ["html_text"]) |
68 | + |
69 | class Form(TinyInputWidget): |
70 | """A generic form widget |
71 | """ |
72 | |
73 | === added file 'addons/openerp/widgets/form/templates/html.mako' |
74 | --- addons/openerp/widgets/form/templates/html.mako 1970-01-01 00:00:00 +0000 |
75 | +++ addons/openerp/widgets/form/templates/html.mako 2020-03-24 15:50:11 +0000 |
76 | @@ -0,0 +1,2 @@ |
77 | + <span kind="${kind}" id="${name}" value="${value}">${value|n}</span> |
78 | + |
79 | |
80 | === modified file 'addons/openerp/widgets/listgrid.py' |
81 | --- addons/openerp/widgets/listgrid.py 2020-02-25 11:28:30 +0000 |
82 | +++ addons/openerp/widgets/listgrid.py 2020-03-24 15:50:11 +0000 |
83 | @@ -594,6 +594,9 @@ |
84 | def __str__(self): |
85 | return ustr(self.text) |
86 | |
87 | +class HtmlText(Char): |
88 | + template = "/openerp/widgets/templates/listgrid/html.mako" |
89 | + |
90 | class Reference(Char): |
91 | |
92 | def get_text(self): |
93 | @@ -900,4 +903,5 @@ |
94 | 'progressbar' : ProgressBar, |
95 | 'separator': Separator, |
96 | 'human_size': HumanSize, |
97 | + 'html_text': HtmlText, |
98 | } |
99 | |
100 | === modified file 'addons/openerp/widgets/listgroup.py' |
101 | --- addons/openerp/widgets/listgroup.py 2020-01-24 11:10:44 +0000 |
102 | +++ addons/openerp/widgets/listgroup.py 2020-03-24 15:50:11 +0000 |
103 | @@ -226,17 +226,33 @@ |
104 | |
105 | self.group_by_ctx, self.hiddens, self.headers = parse(self.group_by_ctx, self.hiddens, self.headers, None, self.group_by_ctx) |
106 | |
107 | - self.grp_records = proxy.read_group(self.context.get('__domain', []) + (self.domain or []), |
108 | - fields.keys(), self.group_by_ctx, 0, False, self.context) |
109 | |
110 | + limited_groupby = self.model == 'replenishment.product.list' |
111 | + order_by = '' |
112 | terp_params = getattr(cherrypy.request, 'terp_params', []) |
113 | if terp_params.sort_key and terp_params.sort_key in self.group_by_ctx and self.group_by_ctx.index(terp_params.sort_key) == 0: |
114 | + order_by = terp_params.sort_key |
115 | if terp_params.sort_order == 'desc': |
116 | rev = True |
117 | + order_by += ' desc' |
118 | else: |
119 | rev = False |
120 | + order_by += ' asc' |
121 | + |
122 | + read_offset = 0 |
123 | + read_limit = False |
124 | + read_groupby = False |
125 | + if limited_groupby: |
126 | + read_offset = terp_offset |
127 | + read_limit = terp_limit |
128 | + read_groupby = order_by |
129 | + order_by = False |
130 | + |
131 | + self.grp_records = proxy.read_group(self.context.get('__domain', []) + (self.domain or []), |
132 | + fields.keys(), self.group_by_ctx, read_offset, read_limit, self.context, read_groupby) |
133 | + |
134 | + if order_by: |
135 | self.grp_records = sorted(self.grp_records, key=itemgetter(terp_params.sort_key), reverse=rev) |
136 | - |
137 | for grp_rec in self.grp_records: |
138 | if not grp_rec.get('__domain'): |
139 | grp_rec['__domain'] = self.context.get('__domain', []) + (self.domain or []) |
140 | @@ -246,14 +262,19 @@ |
141 | self.grouped, grp_ids = parse_groups(self.group_by_ctx, self.grp_records, self.headers, self.ids, model, terp_offset, terp_limit, self.context, self.data, self.field_total, fields, self.rounding_values) |
142 | |
143 | if self.pageable: |
144 | - self.count = len(self.grouped) |
145 | + if limited_groupby: |
146 | + self.count = proxy.read_group(self.context.get('__domain', []) + (self.domain or []), fields.keys(), self.group_by_ctx, 0, False, self.context, False, True) |
147 | + else: |
148 | + self.count = len(self.grouped) |
149 | + |
150 | self.pager = Pager(ids=self.ids, offset=self.offset, limit=self.limit, count=self.count) |
151 | self.pager._name = self.name |
152 | |
153 | # Display only the lines according to pager |
154 | - start_index = self.offset |
155 | - end_index = self.offset + self.limit |
156 | - self.grp_records = self.grp_records[start_index:end_index] |
157 | + if not limited_groupby: |
158 | + start_index = self.offset |
159 | + end_index = self.offset + self.limit |
160 | + self.grp_records = self.grp_records[start_index:end_index] |
161 | |
162 | |
163 | class MultipleGroup(List): |
164 | |
165 | === added file 'addons/openerp/widgets/templates/listgrid/html.mako' |
166 | --- addons/openerp/widgets/templates/listgrid/html.mako 1970-01-01 00:00:00 +0000 |
167 | +++ addons/openerp/widgets/templates/listgrid/html.mako 2020-03-24 15:50:11 +0000 |
168 | @@ -0,0 +1,1 @@ |
169 | +<span name="${name}" value="${value}" class="htmlbox">${text|n}</span> |
170 | |
171 | === modified file 'addons/openerp/widgets/templates/listgrid/listgrid.mako' |
172 | --- addons/openerp/widgets/templates/listgrid/listgrid.mako 2020-02-21 09:16:40 +0000 |
173 | +++ addons/openerp/widgets/templates/listgrid/listgrid.mako 2020-03-24 15:50:11 +0000 |
174 | @@ -189,6 +189,38 @@ |
175 | </%def> |
176 | |
177 | <div class="box-a list-a"> |
178 | +% if any([field != 'button' and field_attrs.get('filter_selector') for field, field_attrs in headers]): |
179 | +<div class="o2m_filter_block"> |
180 | + <table id="${name}_o2m_filter" class="o2m_header_filter"><tr> |
181 | + % for (field, field_attrs) in headers: |
182 | + % if field != 'button' and field_attrs.get('filter_selector'): |
183 | + <% has_filter = True %> |
184 | + <td> ${field_attrs['string']|br}: |
185 | + % if field_attrs['type'] == 'selection': |
186 | + <select id="${name}_${field}" class="paging ignore_changes_when_leaving_page" style="width: auto" field="${field}" kind="selection"> |
187 | + <option value=""></option> |
188 | + % for key, val in field_attrs['selection']: |
189 | + <option value="${key}">${val}</option> |
190 | + % endfor |
191 | + </select> |
192 | + % elif field_attrs['type'] == 'boolean': |
193 | + <select id="${name}_${field}" class="paging ignore_changes_when_leaving_page" style="width: auto" field="${field}" kind="boolean"> |
194 | + <option value=""></option> |
195 | + <option value="t">${_('Yes')}</option> |
196 | + <option value="f">${_('No')}</option> |
197 | + </select> |
198 | + % else: |
199 | + <input id="${name}_${field}" type="text" class="paging ignore_changes_when_leaving_page" style="width: auto" field="${field}" onkeydown="if (event.keyCode == 13) new ListView('${name}').update_o2m_filter();"/> |
200 | + % endif |
201 | + </td> |
202 | + % endif |
203 | + % endfor |
204 | + <td><button type="button" onclick="new ListView('${name}').update_o2m_filter()">${_('Search')}</button></td> |
205 | + <td><button type="button" onclick="new ListView('${name}').clear_filter()">${_('Clear')}</button></td> |
206 | + </table> |
207 | +</div> |
208 | +% endif |
209 | + |
210 | <div class="inner"> |
211 | <table id="${name}" class="gridview" width="100%" cellspacing="0" cellpadding="0"> |
212 | % if pageable: |
213 | @@ -291,38 +323,8 @@ |
214 | </td> |
215 | % else: |
216 | <td class="pager-cell" style="width: 90%"> |
217 | - <% has_filter = False %> |
218 | - <table id="${name}_o2m_filter" class="o2m_header_filter"><tr> |
219 | - % for (field, field_attrs) in headers: |
220 | - % if field != 'button' and field_attrs.get('filter_selector'): |
221 | - <% has_filter = True %> |
222 | - <td> ${field_attrs['string']|br}: |
223 | - % if field_attrs['type'] == 'selection': |
224 | - <select id="${name}_${field}" class="paging ignore_changes_when_leaving_page" style="width: auto" field="${field}" kind="selection"> |
225 | - <option value=""></option> |
226 | - % for key, val in field_attrs['selection']: |
227 | - <option value="${key}">${val}</option> |
228 | - % endfor |
229 | - </select> |
230 | - % elif field_attrs['type'] == 'boolean': |
231 | - <select id="${name}_${field}" class="paging ignore_changes_when_leaving_page" style="width: auto" field="${field}" kind="boolean"> |
232 | - <option value=""></option> |
233 | - <option value="t">${_('Yes')}</option> |
234 | - <option value="f">${_('No')}</option> |
235 | - </select> |
236 | - % else: |
237 | - <input id="${name}_${field}" type="text" class="paging ignore_changes_when_leaving_page" style="width: auto" field="${field}" onkeydown="if (event.keyCode == 13) new ListView('${name}').update_o2m_filter();"/> |
238 | - % endif |
239 | - </td> |
240 | - % endif |
241 | - % endfor |
242 | - % if has_filter: |
243 | - <td><button type="button" onclick="new ListView('${name}').update_o2m_filter()">${_('Search')}</button></td> |
244 | - <td><button type="button" onclick="new ListView('${name}').clear_filter()">${_('Clear')}</button></td> |
245 | - % endif |
246 | - </table> |
247 | </td> |
248 | - % endif |
249 | + % endif |
250 | <td class="pager-cell" style="width: 90%"> |
251 | ${pager.display()} |
252 | </td> |
253 | |
254 | === modified file 'addons/openerp/widgets/templates/listgrid/listgroup.mako' |
255 | --- addons/openerp/widgets/templates/listgrid/listgroup.mako 2019-05-06 13:41:44 +0000 |
256 | +++ addons/openerp/widgets/templates/listgrid/listgroup.mako 2020-03-24 15:50:11 +0000 |
257 | @@ -85,7 +85,7 @@ |
258 | % if field_attrs.get('type') == 'progressbar': |
259 | ${grouped[j][field].display()} |
260 | % else: |
261 | - % if grp_row.get(field): |
262 | + % if grp_row.get(field) or grp_row.get(field) == 0: |
263 | % if field_attrs.get('type') == 'many2one': |
264 | ${isinstance(grp_row.get(field), (int, long)) and " " or grp_row.get(field)[-1]} |
265 | % elif field_attrs.get('type') == 'selection': |