Merge lp:~fabien-morin/unifield-server/fm-us-1198 into lp:unifield-server
- fm-us-1198
- Merge into trunk
Proposed by
jftempo
Status: | Rejected |
---|---|
Rejected by: | jftempo |
Proposed branch: | lp:~fabien-morin/unifield-server/fm-us-1198 |
Merge into: | lp:unifield-server |
Diff against target: |
778 lines (+520/-45) 12 files modified
bin/addons/board/board_administration_view.xml (+4/-4) bin/addons/finance/__init__.py (+1/-0) bin/addons/finance/account.py (+1/-1) bin/addons/finance/board_account.py (+112/-0) bin/addons/finance/board_account_view.xml (+253/-17) bin/addons/financing_contract/contract.py (+75/-0) bin/addons/msf_budget/msf_budget_line.py (+35/-0) bin/addons/msf_profile/user_access_configurator.py (+31/-15) bin/addons/procurement/board_mrp_procurement_view.xml (+1/-1) bin/addons/useability_dashboard_and_menu/__openerp__.py (+1/-1) bin/addons/useability_dashboard_and_menu/dashboard/board_sale_view.xml (+2/-2) bin/addons/useability_dashboard_and_menu/dashboard/board_warehouse_view.xml (+4/-4) |
To merge this branch: | bzr merge lp:~fabien-morin/unifield-server/fm-us-1198 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+317591@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
jftempo (jfb-tempo-consulting) : | # |
- 4030. By Fabien MORIN
-
US-1198 [FIX] revert changes on hr_payroll.py
Revision history for this message
Fabien MORIN (fabien-morin) wrote : | # |
Revision history for this message
jftempo (jfb-tempo-consulting) wrote : | # |
> So I don't see why it could not work.
If you don't see why, you can test it.
This method is called from a store dict in a fields.function, so self is ...
Unmerged revisions
- 4030. By Fabien MORIN
-
US-1198 [FIX] revert changes on hr_payroll.py
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'bin/addons/board/board_administration_view.xml' |
2 | --- bin/addons/board/board_administration_view.xml 2011-01-14 00:11:01 +0000 |
3 | +++ bin/addons/board/board_administration_view.xml 2017-02-20 12:46:04 +0000 |
4 | @@ -139,12 +139,12 @@ |
5 | <form string="Administration Dashboard"> |
6 | <hpaned position="100"> |
7 | <child1> |
8 | - <action width="510" name="%(action_user_connection_tree)d" string="User Connections" /> |
9 | - <action width="510" name="%(action_latest_activities_tree)d" string="Latest Activities" /> |
10 | + <action width="510" name="%(action_user_connection_tree)d" string="User Connections" menu_ref="%(base.menu_action_res_users)d" /> |
11 | + <action width="510" name="%(action_latest_activities_tree)d" string="Latest Activities" menu_ref="%(base.menu_administration)d"/> |
12 | </child1> |
13 | <child2> |
14 | - <action name="%(board_monthly_res_log_report_action)d" string="Monthly Activity per Document"/> |
15 | - <action name="%(board_weekly_res_log_report_action)d" string="Weekly Global Activity" /> |
16 | + <action name="%(board_monthly_res_log_report_action)d" string="Monthly Activity per Document" menu_ref="%(base.menu_administration)d"/> |
17 | + <action name="%(board_weekly_res_log_report_action)d" string="Weekly Global Activity" menu_ref="%(base.menu_administration)d"/> |
18 | </child2> |
19 | </hpaned> |
20 | </form> |
21 | |
22 | === modified file 'bin/addons/finance/__init__.py' |
23 | --- bin/addons/finance/__init__.py 2016-12-08 14:19:09 +0000 |
24 | +++ bin/addons/finance/__init__.py 2017-02-20 12:46:04 +0000 |
25 | @@ -23,6 +23,7 @@ |
26 | import account |
27 | import invoice |
28 | import account_voucher |
29 | +import board_account |
30 | import purchase |
31 | import report |
32 | import wizard |
33 | |
34 | === modified file 'bin/addons/finance/account.py' |
35 | --- bin/addons/finance/account.py 2014-06-13 14:34:59 +0000 |
36 | +++ bin/addons/finance/account.py 2017-02-20 12:46:04 +0000 |
37 | @@ -45,7 +45,7 @@ |
38 | company = self.pool.get('res.users').browse(cr, uid, uid).company_id |
39 | if company and company.additional_allocation: |
40 | company_account_active = company.additional_allocation |
41 | - company_account = 7 # User for accounts that begins by "7" |
42 | + company_account = 7 # User for accounts that begins by "7" |
43 | # Prepare result |
44 | for account in self.read(cr, uid, ids, ['user_type_code', 'code'], context=context): |
45 | account_id = account.get('id', False) |
46 | |
47 | === added file 'bin/addons/finance/board_account.py' |
48 | --- bin/addons/finance/board_account.py 1970-01-01 00:00:00 +0000 |
49 | +++ bin/addons/finance/board_account.py 2017-02-20 12:46:04 +0000 |
50 | @@ -0,0 +1,112 @@ |
51 | +#!/usr/bin/env python |
52 | +# -*- coding: utf-8 -*- |
53 | +############################################################################## |
54 | +# |
55 | +# OpenERP, Open Source Management Solution |
56 | +# Copyright (C) 2012 TeMPO Consulting, MSF. All Rights Reserved |
57 | +# Developer: Olivier DOSSMANN |
58 | +# |
59 | +# This program is free software: you can redistribute it and/or modify |
60 | +# it under the terms of the GNU Affero General Public License as |
61 | +# published by the Free Software Foundation, either version 3 of the |
62 | +# License, or (at your option) any later version. |
63 | +# |
64 | +# This program is distributed in the hope that it will be useful, |
65 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
66 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
67 | +# GNU Affero General Public License for more details. |
68 | +# |
69 | +# You should have received a copy of the GNU Affero General Public License |
70 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
71 | +# |
72 | +############################################################################## |
73 | +from osv import fields |
74 | +from osv import osv |
75 | +from datetime import datetime |
76 | + |
77 | + |
78 | +class account_board_liquidity(osv.osv): |
79 | + _name = 'account.bank.statement' |
80 | + _inherit = 'account.bank.statement' |
81 | + |
82 | + def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): |
83 | + if context is not None and "board_view" in context and context['board_view'] is True: |
84 | + sql = 'SELECT id, name FROM account_bank_statement ' \ |
85 | + 'WHERE date <= \'' + str(datetime.now().strftime("%Y-%m-%d")) + \ |
86 | + '\' ORDER BY date DESC' |
87 | + cr.execute(sql) |
88 | + account_lines = cr.dictfetchall() |
89 | + res = [] |
90 | + account_names = [] |
91 | + for line in account_lines: |
92 | + if not line['name'] in account_names: |
93 | + account_names.append(line['name']) |
94 | + res.append(line['id']) |
95 | + else: |
96 | + res = super(account_board_liquidity, self)\ |
97 | + .search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count) |
98 | + return res |
99 | + |
100 | + def _get_current_balance(self, cr, uid, ids, field_name, arg, context=None): |
101 | + res = {} |
102 | + for account_id in ids: |
103 | + accounts = self.browse(cr, uid, [account_id], context=context) |
104 | + for account in accounts: |
105 | + if 'cheque' in account['journal_id']['type']: |
106 | + amount = 0 |
107 | + for line in account['line_ids']: |
108 | + if not line['direct_invoice_move_id'] and not line['direct_invoice']: |
109 | + amount += line['amount_out'] |
110 | + res[account_id] = amount |
111 | + else: |
112 | + res[account_id] = account['balance_end'] |
113 | + return res |
114 | + |
115 | + def _get_current_board_balance_func(self, cr, uid, ids, field_name, arg, context=None): |
116 | + res = {} |
117 | + ccy = self.pool.get('res.users').browse(cr, uid, [uid], context=context)[0].company_id.currency_id |
118 | + for account_id in ids: |
119 | + accounts = self.browse(cr, uid, [account_id], context=context) |
120 | + for account in accounts: |
121 | + amount = float(self.pool.get('res.currency').compute(cr, uid, |
122 | + account.currency.id, |
123 | + ccy.id, |
124 | + account.current_board_balance)) |
125 | + res[account_id] = amount |
126 | + return res |
127 | + |
128 | + def _get_current_board_currency_func(self, cr, uid, ids, field_name, arg, context=None): |
129 | + res = {} |
130 | + ccy = self.pool.get('res.users').browse(cr, uid, [uid], context=context)[0].company_id.currency_id |
131 | + for account_id in ids: |
132 | + res[account_id] = ccy.name |
133 | + return res |
134 | + |
135 | + def _get_balance_negative_board(self, cr, uid, ids, field_name, arg, context=None): |
136 | + res = {} |
137 | + for account_id in ids: |
138 | + res[account_id] = 'False' |
139 | + accounts = self.browse(cr, uid, [account_id], context=context) |
140 | + for account in accounts: |
141 | + if account.current_board_balance < 0: |
142 | + res[account_id] = 'True' |
143 | + return res |
144 | + |
145 | + _columns = { |
146 | + 'balance_negative_board': fields.function(_get_balance_negative_board, |
147 | + method=True, type='string', string='Is negative balance', readonly=True), |
148 | + 'current_board_balance': fields.function(_get_current_balance, |
149 | + method=True, type='float', string='Balance / Outstanding cheque amount', readonly=True), |
150 | + 'current_board_balance_func': fields.function(_get_current_board_balance_func, |
151 | + method=True, type='float', |
152 | + string='Balance / Outstanding cheque amount in func. ccy', readonly=True), |
153 | + 'current_board_currency_func': fields.function(_get_current_board_currency_func, |
154 | + method=True, type='string', |
155 | + string='Functional currency', readonly=True), |
156 | + } |
157 | + |
158 | + |
159 | + |
160 | + |
161 | +account_board_liquidity() |
162 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
163 | |
164 | === modified file 'bin/addons/finance/board_account_view.xml' |
165 | --- bin/addons/finance/board_account_view.xml 2014-03-17 10:45:24 +0000 |
166 | +++ bin/addons/finance/board_account_view.xml 2017-02-20 12:46:04 +0000 |
167 | @@ -2,7 +2,7 @@ |
168 | <openerp> |
169 | <data> |
170 | |
171 | - <!-- Tree for purchase displayed on the accounting board --> |
172 | + <!-- Tree for purchase displayed on the accounting board --> |
173 | <record id="account_purchase_order_tree" model="ir.ui.view"> |
174 | <field name="name">account.purchase.order.tree</field> |
175 | <field name="model">purchase.order</field> |
176 | @@ -27,7 +27,7 @@ |
177 | </field> |
178 | </record> |
179 | |
180 | - <!-- Action that give a link to the purchase_order_tree only for accounting (priority superior to the mainly purchase_order_tree --> |
181 | + <!-- Action that give a link to the purchase_order_tree only for accounting (priority superior to the mainly purchase_order_tree --> |
182 | <record id="purchase_waiting_msf" model="ir.actions.act_window"> |
183 | <field name="name">Purchase Order Waiting Approval</field> |
184 | <field name="type">ir.actions.act_window</field> |
185 | @@ -39,31 +39,267 @@ |
186 | <field name="search_view_id" eval="False"/> |
187 | </record> |
188 | |
189 | - <!-- Custom Accounting Board --> |
190 | + <!-- DashBoard --> |
191 | + <record id="account_board_commitment_voucher_view" model="ir.ui.view"> |
192 | + <field name="name">account.commitment</field> |
193 | + <field name="model">account.commitment</field> |
194 | + <field name="type">tree</field> |
195 | + <field name="arch" type="xml"> |
196 | + <tree string="Statement" limit="5"> |
197 | + <field name="name"/> |
198 | + <field name="date"/> |
199 | + <field name="partner_id"/> |
200 | + <field name="purchase_id"/> |
201 | + <field name="currency_id"/> |
202 | + <field name="state"/> |
203 | + </tree> |
204 | + </field> |
205 | + </record> |
206 | + <record id="account_board_commitment_voucher" model="ir.actions.act_window"> |
207 | + <field name="name">Commitment Voucher</field> |
208 | + <field name="res_model">account.commitment</field> |
209 | + <field name="view_type">form</field> |
210 | + <field name="view_mode">tree,form,calendar,graph</field> |
211 | + <field name="domain">[('state', 'in', ('draft','open'))]</field> |
212 | + <field name="context">{'board_view': True}</field> |
213 | + <field ref="account_board_commitment_voucher_view" name="view_id"/> |
214 | + <field name="limit">5</field> |
215 | + </record> |
216 | + |
217 | + <record id="account_board_supplier_invoice_draft_view" model="ir.ui.view"> |
218 | + <field name="name">account.invoice</field> |
219 | + <field name="model">account.invoice</field> |
220 | + <field name="type">tree</field> |
221 | + <field name="arch" type="xml"> |
222 | + <tree string="Statement" limit="5"> |
223 | + <field name="number"/> |
224 | + <field name="name"/> |
225 | + <field name="partner_id"/> |
226 | + <field name="date_invoice"/> |
227 | + <field name="date_due"/> |
228 | + <field name="currency_id"/> |
229 | + <field name="amount_to_pay"/> |
230 | + <field name="amount_total"/> |
231 | + <field name="state"/> |
232 | + </tree> |
233 | + </field> |
234 | + </record> |
235 | + <record id="account_board_supplier_invoice_draft" model="ir.actions.act_window"> |
236 | + <field name="name">Suppliers invoices pending validation</field> |
237 | + <field name="res_model">account.invoice</field> |
238 | + <field name="view_type">form</field> |
239 | + <field name="view_mode">tree,form,calendar,graph</field> |
240 | + <field name="domain">[('state', '=', 'draft')]</field> |
241 | + <field name="context">{'board_view': True}</field> |
242 | + <field ref="account_board_supplier_invoice_draft_view" name="view_id"/> |
243 | + <field name="limit">5</field> |
244 | + </record> |
245 | + <record id="account_board_supplier_invoice_open" model="ir.actions.act_window"> |
246 | + <field name="name">Suppliers invoices pending payment</field> |
247 | + <field name="res_model">account.invoice</field> |
248 | + <field name="view_type">form</field> |
249 | + <field name="view_mode">tree,form,calendar,graph</field> |
250 | + <field name="domain">[('state', '=', 'open')]</field> |
251 | + <field name="context">{'board_view': True}</field> |
252 | + <field ref="account_board_supplier_invoice_draft_view" name="view_id"/> |
253 | + <field name="limit">5</field> |
254 | + </record> |
255 | + |
256 | + <record id="account_board_liquidity_view" model="ir.ui.view"> |
257 | + <field name="name">account.bank.statement</field> |
258 | + <field name="model">account.bank.statement</field> |
259 | + <field name="type">tree</field> |
260 | + <field name="arch" type="xml"> |
261 | + <tree string="Statement" colors="red: balance_negative_board!='False'"> |
262 | + <field name="balance_negative_board"/> |
263 | + <field name="instance_id"/> |
264 | + <field name="journal_id" string="Register Code"/> |
265 | + <field name="name"/> |
266 | + <field name="current_board_balance"/> |
267 | + <field name="currency" string="Register currency"/> |
268 | + <field name="current_board_balance_func" string="Current balance in func. ccy" sum="Total"/> |
269 | + <field name="current_board_currency_func" string="Func. ccy"/> |
270 | + </tree> |
271 | + </field> |
272 | + </record> |
273 | + <record id="account_board_liquidity" model="ir.actions.act_window"> |
274 | + <field name="name">Liquidity</field> |
275 | + <field name="res_model">account.bank.statement</field> |
276 | + <field name="view_type">form</field> |
277 | + <field name="view_mode">tree,form,calendar,graph</field> |
278 | + <field ref="account_board_liquidity_view" name="view_id"/> |
279 | + <field name="context">{'board_view': True}</field> |
280 | + </record> |
281 | + |
282 | + <!-- Show the Currency rates --> |
283 | + <record id="account_board_currency_view" model="ir.ui.view"> |
284 | + <field name="name">res.currency</field> |
285 | + <field name="model">res.currency</field> |
286 | + <field name="type">tree</field> |
287 | + <field name="arch" type="xml"> |
288 | + <tree string="Latest FX rates" limit="5"> |
289 | + <field name="name"/> |
290 | + <field name="rate"/> |
291 | + <field name="date"/> |
292 | + </tree> |
293 | + </field> |
294 | + </record> |
295 | + <record id="account_board_currency" model="ir.actions.act_window"> |
296 | + <field name="name">Latest FX rates</field> |
297 | + <field name="res_model">res.currency</field> |
298 | + <field name="view_type">form</field> |
299 | + <field name="view_mode">tree,form,calendar,graph</field> |
300 | + <field ref="account_board_currency_view" name="view_id"/> |
301 | + <field name="context">{'board_view': True}</field> |
302 | + <field name="limit">3</field> |
303 | + </record> |
304 | + |
305 | + <!-- Show the XXX --> |
306 | + <record id="account_board_period_view" model="ir.ui.view"> |
307 | + <field name="name">account.period.board</field> |
308 | + <field name="model">account.period</field> |
309 | + <field name="type">tree</field> |
310 | + <field name="arch" type="xml"> |
311 | + <tree string="Account periods" limit="5"> |
312 | + <field name="name"/> |
313 | + <field name="code"/> |
314 | + <field name="date_start"/> |
315 | + <field name="date_stop"/> |
316 | + <field name="fiscalyear_id"/> |
317 | + <field name="state"/> |
318 | + </tree> |
319 | + </field> |
320 | + </record> |
321 | + |
322 | + <record id="account_board_period" model="ir.actions.act_window"> |
323 | + <field name="name">Account Periods</field> |
324 | + <field name="res_model">account.period</field> |
325 | + <field name="view_type">form</field> |
326 | + <field name="view_mode">tree,form,calendar,graph</field> |
327 | + <field ref="account_board_period_view" name="view_id"/> |
328 | + <field name="domain">[('state', '=', 'draft'), ('special', '=', False)]</field> |
329 | + <field name="context">{'board_view': True}</field> |
330 | + </record> |
331 | + |
332 | + <!-- Show HQ entries to be validated --> |
333 | + <record id="account_hq_entries_view" model="ir.ui.view"> |
334 | + <field name="name">hq.entries</field> |
335 | + <field name="model">hq.entries</field> |
336 | + <field name="type">tree</field> |
337 | + <field name="arch" type="xml"> |
338 | + <tree string="HQ Entries to be validated" limit="5"> |
339 | + <field name="name"/> |
340 | + <field name="ref"/> |
341 | + <field name="date"/> |
342 | + <field name="period_id"/> |
343 | + <field name="account_id"/> |
344 | + <field name="partner_txt"/> |
345 | + <field name="amount"/> |
346 | + <field name="currency_id"/> |
347 | + </tree> |
348 | + </field> |
349 | + </record> |
350 | + <record id="account_hq_entries" model="ir.actions.act_window"> |
351 | + <field name="name">HQ Entries to be validated</field> |
352 | + <field name="res_model">hq.entries</field> |
353 | + <field name="view_type">form</field> |
354 | + <field name="view_mode">tree,form,calendar,graph</field> |
355 | + <field ref="account_hq_entries_view" name="view_id"/> |
356 | + <field name="domain">[('user_validated', '!=', True)]</field> |
357 | + <field name="context">{'board_view': True}</field> |
358 | + <field name="limit">5</field> |
359 | + </record> |
360 | + <!-- End HQ Entries --> |
361 | + |
362 | + <!-- Show the Payrolls entries to be validated --> |
363 | + <record id="hr_payroll_board_view" model="ir.ui.view"> |
364 | + <field name="name">hr.payroll.msf</field> |
365 | + <field name="model">hr.payroll.msf</field> |
366 | + <field name="type">tree</field> |
367 | + <field name="arch" type="xml"> |
368 | + <tree string="Payroll Entries to be validated" limit="5"> |
369 | + <field name="name"/> |
370 | + <field name="ref"/> |
371 | + <field name="period_id"/> |
372 | + <field name="employee_id_number"/> |
373 | + <field name="account_id"/> |
374 | + <field name="amount"/> |
375 | + <field name="currency_id"/> |
376 | + </tree> |
377 | + </field> |
378 | + </record> |
379 | + <record id="hr_payroll_board" model="ir.actions.act_window"> |
380 | + <field name="name">Payroll entries to be validated</field> |
381 | + <field name="res_model">hr.payroll.msf</field> |
382 | + <field name="view_type">form</field> |
383 | + <field name="view_mode">tree,form,calendar,graph</field> |
384 | + <field ref="hr_payroll_board_view" name="view_id"/> |
385 | + <field name="domain">[('state', '=', 'draft'), ('account_id.is_analytic_addicted', '=', True)]</field> |
386 | + <field name="context">{'board_view': True}</field> |
387 | + <field name="limit">5</field> |
388 | + </record> |
389 | + <!-- End for Payroll --> |
390 | + |
391 | + <record id="account_board_budget_search_view" model="ir.ui.view"> |
392 | + <field name="name">msf.budget.line</field> |
393 | + <field name="model">msf.budget.line</field> |
394 | + <field name="type">search</field> |
395 | + <field name="arch" type="xml"> |
396 | + <search string="Search Budget"> |
397 | + <group col="6" colspan="4"> |
398 | + <field name="budget_id" select="1"/> |
399 | + </group> |
400 | + </search> |
401 | + </field> |
402 | + </record> |
403 | + <record id="account_board_budget_view" model="ir.ui.view"> |
404 | + <field name="name">msf.budget.line</field> |
405 | + <field name="model">msf.budget.line</field> |
406 | + <field name="type">graph</field> |
407 | + <field name="arch" type="xml"> |
408 | + <graph string="Budgets (percents)" type="bar" orientation="horizontal"> |
409 | + <field name="name"/> |
410 | + <field name="bugdet_synthesis" operator="max"/> |
411 | + </graph> |
412 | + </field> |
413 | + </record> |
414 | + <record id="account_board_budgets" model="ir.actions.act_window"> |
415 | + <field name="name">Budget synthesis</field> |
416 | + <field name="res_model">msf.budget.line</field> |
417 | + <field name="view_type">form</field> |
418 | + <field name="view_mode">graph,tree,form</field> |
419 | + <field ref="account_board_budget_view" name="view_id"/> |
420 | + <field name="context">{'board_view': 'budget'}</field> |
421 | + <field name="domain">[]</field> |
422 | + <field name="search_view_id" ref="account_board_budget_search_view"/> |
423 | + </record> |
424 | + --> |
425 | + <!-- Custom Accounting Board --> |
426 | <record id="inherit_board_account_form" model="ir.ui.view"> |
427 | <field name="name">inherit.board.account.form</field> |
428 | <field name="model">board.board</field> |
429 | - <field name="type">form</field> |
430 | + <field name="type">tree</field> |
431 | <field name='inherit_id' ref='account.board_account_form' /> |
432 | <field name="priority" eval="15"/> |
433 | <field name="arch" type="xml"> |
434 | <xpath expr="/form" position="replace"> |
435 | - <form string="Account Board"> |
436 | - </form> |
437 | - <!-- DASHBOARD FALSE DELETION UTP-398 |
438 | + <form string="Account Board"> |
439 | <hpaned> |
440 | <child1> |
441 | - <action colspan="4" height="160" width="400" name="%(account.action_draft_customer_invoices_dashboard)d" string="Customer Invoices to Approve" /> |
442 | - <action colspan="4" height="220" name="%(purchase_waiting_msf)d" string="Purchase Order Waiting Approval" width="400"/> |
443 | - <action colspan="4" height="160" width="400" name="%(account.action_company_analysis_tree)d" string="Company Analysis" /> |
444 | - </child1> |
445 | - <child2> |
446 | - <action colspan="4" height="220" name="%(account.action_treasory_graph)d" string="Treasury" /> |
447 | - <action colspan="4" height="220" name="%(account.action_aged_receivable)d" string="Aged Receivables" /> |
448 | - </child2> |
449 | + <action colspan="4" height="160" width="400" name="%(account_board_commitment_voucher)d" string="Commitment Voucher" menu_ref="%(analytic_distribution.menu_commitment)d,%(analytic_distribution.menu_commitment_entries)d" /> |
450 | + <action colspan="4" height="160" width="400" name="%(account_board_supplier_invoice_draft)d" string="Suppliers invoices pending validation" menu_ref="%(account.menu_finance_payables)d,%(account.menu_action_invoice_tree2)d" /> |
451 | + <action colspan="4" height="160" width="400" name="%(account_board_supplier_invoice_open)d" string="Suppliers invoices pending payment" menu_ref="%(account.menu_finance_payables)d,%(account.menu_action_invoice_tree2)d" /> |
452 | + <!-- DON'T SHOW LIQUIDITY FOR NOW! action colspan="4" height="160" width="400" name="%(account_board_liquidity)d" string="Liquidity" /--> |
453 | + </child1> |
454 | + |
455 | + <child1> |
456 | + <action colspan="4" height="160" width="400" name="%(hr_payroll_board)d" string="Payroll Entries to validate" menu_ref="%(msf_homere_interface.menu_finance_payroll)d,%(msf_homere_interface.menu_finance_payroll_entries)d" /> |
457 | + <action colspan="4" height="160" width="400" name="%(account_hq_entries)d" string="HQ Entries to validate" menu_ref="%(account_hq_entries.menu_hq)d,%(account_hq_entries.menu_hq_entries)d" /> |
458 | + <action colspan="4" height="160" width="400" name="%(account_board_period)d" string="Account Periods" menu_ref="%(account.menu_action_account_period_close_tree)d,%(account.menu_action_account_period_form)d" /> |
459 | + <action colspan="4" height="160" width="400" name="%(account_board_currency)d" string="Latest FX rates" menu_ref="%(res_currency_tables.menu_action_report_currency_table_form)d" /> |
460 | + </child1> |
461 | </hpaned> |
462 | - </form> |
463 | - END OF DASHBOARD FALSE DELETION UTP-398 --> |
464 | + </form> |
465 | </xpath> |
466 | </field> |
467 | </record> |
468 | |
469 | === modified file 'bin/addons/financing_contract/contract.py' |
470 | --- bin/addons/financing_contract/contract.py 2016-09-28 07:44:49 +0000 |
471 | +++ bin/addons/financing_contract/contract.py 2017-02-20 12:46:04 +0000 |
472 | @@ -22,6 +22,8 @@ |
473 | from osv import fields, osv |
474 | from tools.translate import _ |
475 | import netsvc |
476 | +import time |
477 | + |
478 | |
479 | class financing_contract_funding_pool_line(osv.osv): |
480 | _name = "financing.contract.funding.pool.line" |
481 | @@ -121,6 +123,7 @@ |
482 | |
483 | financing_contract_funding_pool_line() |
484 | |
485 | + |
486 | class financing_contract_contract(osv.osv): |
487 | |
488 | _name = "financing.contract.contract" |
489 | @@ -297,6 +300,71 @@ |
490 | instance_level = self.__get_instance_level(cr, uid, context=context)[1] |
491 | return dict((id, instance_level) for id in ids) |
492 | |
493 | + def _calc_elapsed_time(self, cr, uid, ids, field_name, arg, context=None): |
494 | + res = {} |
495 | + for contract_id in ids: |
496 | + contracts = self.browse(cr, uid, [contract_id], context=context) |
497 | + for contract in contracts: |
498 | + time_s = time.mktime(datetime. |
499 | + datetime.strptime(contract['eligibility_from_date'], "%Y-%m-%d").timetuple()) |
500 | + time_e = time.mktime(datetime. |
501 | + datetime.strptime(contract['eligibility_to_date'], "%Y-%m-%d").timetuple()) |
502 | + time_n = time.mktime(datetime.datetime.now().timetuple()) |
503 | + time_elapsed = ((time_n - time_s) / (time_e - time_s)) * 100 |
504 | + res[contract_id] = str(round(time_elapsed, 1)) + "%" |
505 | + return res |
506 | + |
507 | + def _calc_total_project(self, cr, uid, ids, field_name, arg, context=None): |
508 | + res = {} |
509 | + for contract_id in ids: |
510 | + contract = self.browse(cr, uid, contract_id, context=context) |
511 | + context.update({'reporting_currency': contract.reporting_currency.id, |
512 | + 'reporting_type': contract.reporting_type, |
513 | + 'currency_table_id': contract.currency_table_id.id, |
514 | + 'active_id': ids[0], |
515 | + 'active_ids': ids, |
516 | + 'display_fp': True}) |
517 | + |
518 | + if contract['reporting_type'] in ['all', 'project']: |
519 | + project_real = 0 |
520 | + project_budget = 0 |
521 | + for line in contract['actual_line_ids']: |
522 | + project_real += line['project_real'] |
523 | + project_budget += line['project_budget'] |
524 | + |
525 | + if project_budget != 0: |
526 | + res[contract_id] = str(round((project_real / project_budget) * 100, 1)) + "%" |
527 | + else: |
528 | + res[contract_id] = "-" |
529 | + else: |
530 | + res[contract_id] = "- n/a -" |
531 | + return res |
532 | + |
533 | + def _calc_board_grant(self, cr, uid, ids, field_name, arg, context=None): |
534 | + res = {} |
535 | + for c_id in ids: |
536 | + contract = self.browse(cr, uid, c_id, context=context) |
537 | + context.update({'reporting_currency': contract.reporting_currency.id, |
538 | + 'reporting_type': contract.reporting_type, |
539 | + 'currency_table_id': contract.currency_table_id.id, |
540 | + 'active_id': ids[0], |
541 | + 'active_ids': ids, |
542 | + 'display_fp': True}) |
543 | + if contract['reporting_type'] in ['all', 'allocated']: |
544 | + alloc_real = 0 |
545 | + alloc_budget = 0 |
546 | + for line in contract['actual_line_ids']: |
547 | + alloc_real += line['allocated_real'] |
548 | + alloc_budget += line['allocated_budget'] |
549 | + |
550 | + if alloc_budget != 0: |
551 | + res[c_id] = str(round((alloc_real / alloc_budget) * 100, 1)) + "%" |
552 | + else: |
553 | + res[c_id] = "-" |
554 | + else: |
555 | + res[c_id] = "- n/a -" |
556 | + return res |
557 | + |
558 | _columns = { |
559 | 'name': fields.char('Financing contract name', size=64, required=True), |
560 | 'code': fields.char('Financing contract code', size=16, required=True), |
561 | @@ -321,6 +389,12 @@ |
562 | ondelete="cascade", required=True), |
563 | 'fp_added_flag': fields.boolean('Flag when new FP is added'), |
564 | 'instance_level': fields.function(_get_instance_level, method=True, string="Current instance level", type="char", readonly=True), # UFTP-343 |
565 | + 'board_time_elapsed': fields.function(_calc_elapsed_time, method=True, |
566 | + type='str', string='Percent Time elapsed', readonly=True), # UF-1097 |
567 | + 'board_total_project': fields.function(_calc_total_project, method=True, |
568 | + type='str', string='Alloc/total project', readonly=True), # UF-1097 |
569 | + 'board_grant': fields.function(_calc_board_grant, method=True, |
570 | + type='str', string='Alloc/grant', readonly=True), # UF-1097 |
571 | } |
572 | |
573 | _defaults = { |
574 | @@ -443,6 +517,7 @@ |
575 | def menu_interactive_report(self, cr, uid, ids, context=None): |
576 | if context is None: |
577 | context = {} |
578 | + |
579 | # we update the context with the contract reporting type |
580 | contract = self.browse(cr, uid, ids[0], context=context) |
581 | context.update({'reporting_currency': contract.reporting_currency.id, |
582 | |
583 | === modified file 'bin/addons/msf_budget/msf_budget_line.py' |
584 | --- bin/addons/msf_budget/msf_budget_line.py 2016-07-21 10:12:49 +0000 |
585 | +++ bin/addons/msf_budget/msf_budget_line.py 2017-02-20 12:46:04 +0000 |
586 | @@ -375,6 +375,21 @@ |
587 | res = dict(tmp_res) |
588 | return res |
589 | |
590 | + def _get_bugdet_synthesis(self, cr, uid, ids, field_names=None, arg=None, context=None): |
591 | + res = {} |
592 | + for line_id in ids: |
593 | + res[line_id] = 0 |
594 | + |
595 | + line = self.browse(cr, uid, line_id, context=context) |
596 | + |
597 | + actual = line["actual_amount"] if line["actual_amount"] else 0 |
598 | + comm = line["comm_amount"] if line["comm_amount"] else 0 |
599 | + budget = line["budget_amount"] if line["budget_amount"] else 0 |
600 | + |
601 | + if budget > 0 and (actual + comm) > 0: |
602 | + res[line_id] = round(((actual + comm) / budget) * 100, 2) |
603 | + return res |
604 | + |
605 | _columns = { |
606 | 'budget_id': fields.many2one('msf.budget', 'Budget', ondelete='cascade'), |
607 | 'account_id': fields.many2one('account.account', 'Account', required=True, domain=[('type', '!=', 'view')]), |
608 | @@ -405,8 +420,28 @@ |
609 | ('destination', 'Destination')], 'Line type', required=True), |
610 | 'account_code': fields.related('account_id', 'code', type='char', string='Account code', size=64, store=True), |
611 | 'account_order': fields.function(_get_account_order, type='integer', string='order', method=True, store=True), |
612 | + 'bugdet_synthesis': fields.function(_get_bugdet_synthesis, method=True, store=False, string="Budget synthesis", type="float", readonly=True), # BKLG-65 |
613 | } |
614 | |
615 | + def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): |
616 | + if context and "board_view" in context and "budget" in context["board_view"]: |
617 | + res = [] |
618 | + where = "WHERE LENGTH(account_code) = 2" |
619 | + if 'budget_id' not in args: |
620 | + return [] |
621 | + for arg in args: |
622 | + where += " AND " + str(arg[0]) + " " + str(arg[1]) + " " + str(arg[2]) |
623 | + sql = "SELECT id FROM msf_budget_line " + where |
624 | + cr.execute(sql) |
625 | + sql_res = cr.fetchall() |
626 | + if sql_res: |
627 | + res += [x and x[0] for x in sql_res] |
628 | + return res |
629 | + else: |
630 | + return super(msf_budget_line, self).search(cr, uid, args, offset=offset, |
631 | + limit=limit, order=order, context=context, count=count) |
632 | + |
633 | + _order = 'account_code asc, line_type desc' |
634 | |
635 | _defaults = { |
636 | 'line_type': lambda *a: 'normal', |
637 | |
638 | === modified file 'bin/addons/msf_profile/user_access_configurator.py' |
639 | --- bin/addons/msf_profile/user_access_configurator.py 2016-10-19 13:02:08 +0000 |
640 | +++ bin/addons/msf_profile/user_access_configurator.py 2017-02-20 12:46:04 +0000 |
641 | @@ -22,6 +22,7 @@ |
642 | from osv import osv, fields |
643 | from tools.translate import _ |
644 | import base64 |
645 | +import logging |
646 | |
647 | from spreadsheet_xml.spreadsheet_xml import SpreadsheetXML |
648 | |
649 | @@ -1021,30 +1022,45 @@ |
650 | containing a view of an object on which he doesn't have access. |
651 | ''' |
652 | _inherit = 'board.board' |
653 | + _logger = logging.getLogger('board_board') |
654 | |
655 | def remove_unauthorized_children(self,cr, uid, node): |
656 | + iaaw_obj = self.pool.get('ir.actions.act_window') |
657 | + ima_obj = self.pool.get('ir.model.access') |
658 | + user_groups_id = self.pool.get('res.users').read(cr, uid, uid, ['groups_id'])['groups_id'] |
659 | for child in node.iterchildren(): |
660 | if child.tag == 'action': |
661 | if child.get('invisible'): |
662 | node.remove(child) |
663 | - break |
664 | + continue |
665 | elif child.get('name'): |
666 | action_id = int(child.get('name')) |
667 | - model = self.pool.get('ir.actions.act_window').browse(cr, uid, action_id).res_model |
668 | - if not self.pool.get('ir.model.access').check(cr, uid, model, mode='read', raise_exception=False): |
669 | + |
670 | + # check the group has write permission on the model |
671 | + model = iaaw_obj.browse(cr, uid, action_id).res_model |
672 | + write_perm = ima_obj.check_group(cr, uid, model, 'write', |
673 | + user_groups_id) |
674 | + |
675 | + if not child.get('menu_ref'): |
676 | + self._logger.warn('The dashboard \'%s\' does not have menu_ref attribute.' |
677 | + 'This is needed to define security.' % child.get('string')) |
678 | + |
679 | + menu_access = True |
680 | + # if the group has no write permission, check if the |
681 | + # user has access to the sub menu of the related dashboard. |
682 | + if not write_perm and child.get('menu_ref'): |
683 | + menu_ids = child.get('menu_ref').split(',') |
684 | + if not isinstance(menu_ids, list): |
685 | + menu_ids = [menu_ids] |
686 | + |
687 | + menu_ids = [int(menu_id) for menu_id in menu_ids] |
688 | + if not self.pool.get('ir.ui.menu').search(cr, uid, |
689 | + [('id', 'in', menu_ids)]): |
690 | + menu_access = False |
691 | + |
692 | + # if no access on the menu or on the model, delete the node |
693 | + if not(write_perm or menu_access): |
694 | node.remove(child) |
695 | - break |
696 | - |
697 | - if child.get('menu_ref'): |
698 | - menu_ids = child.get('menu_ref').split(',') |
699 | - if not isinstance(menu_ids, list): |
700 | - menu_ids = [menu_ids] |
701 | - |
702 | - for menu_id in menu_ids: |
703 | - menu_id = int(menu_id) |
704 | - if not self.pool.get('ir.ui.menu').search(cr, uid, [('id', '=', menu_id)]): |
705 | - node.remove(child) |
706 | - break |
707 | else: |
708 | child = self.remove_unauthorized_children(cr, uid, child) |
709 | |
710 | |
711 | === modified file 'bin/addons/procurement/board_mrp_procurement_view.xml' |
712 | --- bin/addons/procurement/board_mrp_procurement_view.xml 2011-01-14 00:11:01 +0000 |
713 | +++ bin/addons/procurement/board_mrp_procurement_view.xml 2017-02-20 12:46:04 +0000 |
714 | @@ -17,7 +17,7 @@ |
715 | <field name="type">form</field> |
716 | <field name="arch" type="xml"> |
717 | <xpath expr="/form/hpaned/child1/action[@string='Incoming Product']" position="before"> |
718 | - <action colspan="4" name="%(procurement_action_board)d" string="Procurements in Exception" width="510" /> |
719 | + <action colspan="4" name="%(procurement_action_board)d" string="Procurements in Exception" width="510" menu_res="%(procurement.menu_stock_procurement_action)d"/> |
720 | </xpath> |
721 | </field> |
722 | </record> |
723 | |
724 | === modified file 'bin/addons/useability_dashboard_and_menu/__openerp__.py' |
725 | --- bin/addons/useability_dashboard_and_menu/__openerp__.py 2013-03-26 10:41:00 +0000 |
726 | +++ bin/addons/useability_dashboard_and_menu/__openerp__.py 2017-02-20 12:46:04 +0000 |
727 | @@ -59,7 +59,7 @@ |
728 | "view/purchase_view.xml", |
729 | "view/sale_view.xml", |
730 | "view/shop_view.xml", |
731 | - |
732 | + |
733 | "dashboard/board_purchase_view.xml", |
734 | "dashboard/board_sale_view.xml", |
735 | "dashboard/board_warehouse_view.xml", |
736 | |
737 | === modified file 'bin/addons/useability_dashboard_and_menu/dashboard/board_sale_view.xml' |
738 | --- bin/addons/useability_dashboard_and_menu/dashboard/board_sale_view.xml 2014-08-28 14:16:40 +0000 |
739 | +++ bin/addons/useability_dashboard_and_menu/dashboard/board_sale_view.xml 2017-02-20 12:46:04 +0000 |
740 | @@ -86,10 +86,10 @@ |
741 | <action name="%(order_action_draft)d" string="Order Waiting For Validation" menu_ref="%(sale.menu_sale_order)d,%(base.menu_sales)d" /> |
742 | <action name="%(internal_request_action_validated)d" string="Internal Request Waiting For Sourcing" menu_ref="%(procurement_request.menu_procurement_request)d,%(base.menu_sales)d" /> |
743 | <action name="%(order_action_validated)d" string="Order Waiting For Sourcing" menu_ref="%(sale.menu_sale_order)d,%(base.menu_sales)d" /> |
744 | - <!-- Remove the two lines because there are same as above and made let me fix on Field order follow-up (see UF-1650) |
745 | + <!-- Remove the two lines because there are same as above and made let me fix on Field order follow-up (see UF-1650) |
746 | <action colspan="4" height="220" name="%(order_action_draft)d" string="Orders Waiting For Validation" width="510"/> |
747 | <action colspan="4" height="220" name="%(order_action_validated)d" string="Orders Waiting For Sourcing" width="510"/> --> |
748 | - <action colspan="4" height="220" name="%(order_action_sourced)d" string="Orders Sourced" width="510" menu_ref="%(base.menu_sales)d" /> |
749 | + <action colspan="4" height="220" name="%(order_action_sourced)d" string="Orders Sourced" width="510" menu_ref="%(sale.menu_sale_order)d,%(base.menu_sales)d" /> |
750 | </child1> |
751 | </hpaned> |
752 | </form> |
753 | |
754 | === modified file 'bin/addons/useability_dashboard_and_menu/dashboard/board_warehouse_view.xml' |
755 | --- bin/addons/useability_dashboard_and_menu/dashboard/board_warehouse_view.xml 2017-02-10 13:29:43 +0000 |
756 | +++ bin/addons/useability_dashboard_and_menu/dashboard/board_warehouse_view.xml 2017-02-20 12:46:04 +0000 |
757 | @@ -126,7 +126,7 @@ |
758 | <action name="%(action_picking_ticket_board)d" string="Picking Tickets" menu_ref="%(msf_outgoing.menu_action_picking_ticket)d,%(msf_outgoing.menu_warehouse_deliveries)d,%(stock.menu_stock_warehouse_mgmt)d" /> |
759 | <action name="%(action_ppl_board)d" string="Pre-Packing Lists" menu_ref="%(msf_outgoing.menu_action_ppl)d,%(msf_outgoing.menu_warehouse_deliveries)d,%(stock.menu_stock_warehouse_mgmt)d" /> |
760 | <action name="%(board_action_shipment)d" string="Shipments" menu_ref="%(msf_outgoing.menu_action_shipment)d,%(msf_outgoing.menu_warehouse_deliveries)d,%(stock.menu_stock_warehouse_mgmt)d" /> |
761 | - <action colspan="4" name="%(procurement.procurement_action_board)d" string="Procurements in Exception" width="510" /> |
762 | + <action colspan="4" name="%(procurement.procurement_action_board)d" string="Procurements in Exception" width="510" menu_ref="%(procurement.menu_stock_sched)d,%(procurement.menu_stock_procurement_action)d"/> |
763 | </child1> |
764 | </hpaned> |
765 | </form> |
766 | @@ -141,9 +141,9 @@ |
767 | <form string="Warehouse board"> |
768 | <hpaned position="100"> |
769 | <child1> |
770 | - <action name="%(action_picking_tree_available)d" string="Incoming Shipments"/> |
771 | - <action name="%(action_outgoing_product_board)d" string="Delivery Orders"/> |
772 | - <action colspan="4" name="%(procurement.procurement_action_board)d" string="Procurements in Exception" width="510" /> |
773 | + <action name="%(action_picking_tree_available)d" string="Incoming Shipments" menu_ref="%(stock.menu_action_picking_tree4)d,%(stock.menu_stock_warehouse_mgmt)d"/> |
774 | + <action name="%(action_outgoing_product_board)d" string="Delivery Orders" menu_ref="%(stock.menu_action_picking_tree)d,%(msf_outgoing.menu_warehouse_deliveries)d,%(stock.menu_stock_warehouse_mgmt)d"/> |
775 | + <action colspan="4" name="%(procurement.procurement_action_board)d" string="Procurements in Exception" width="510" menu_ref="%(procurement.menu_stock_sched)d,%(procurement.menu_stock_procurement_action)d"/> |
776 | </child1> |
777 | </hpaned> |
778 | </form> |
I reverted all this changes.
I did it because the search is called on module 'hr.payroll.msf' and the current class of
self object is also 'hr.payroll.msf'. So I don't see why it could not work.
On Monday 20 February 2017 12:37:27 you wrote: msf_homere_ interface/ hr_payroll. py' msf_homere_ interface/ hr_payroll. py 2016-12-21 08:28:03 msf_homere_ interface/ hr_payroll. py 2017-02-17 09:00:02 'category' ] == 'FUNDING': ana_account[ 'id']) get('hr. payroll. msf').search( cr, uid, center_ id','in' , cc), ('destination_ id','in' , dest)]) center_ id','in' , cc), id','in' , dest)])> state_account( self, cr, uid, ids, context=None): get('hr. payroll. msf') state_dest_ link(self, cr, uid, ids, context=None): get('hr. payroll. msf') pool_ids' ]): 'account_ id'][0] ), 'destination_ id'][0] ), 'funding_ pool_ids' ]) 'account_ id'][0] ), 'destination_ id'][0] ), + ('funding_pool_id', 'funding_ pool_ids' ])>
> Diff comments:
> > === modified file 'bin/addons/
> > --- bin/addons/
> > +0000
> > +++ bin/addons/
> > +0000
> > @@ -169,25 +169,23 @@
> >
> > elif ana_account[
> > fp.append(
> >
> > if len(fp) > 1 or len(cc) > 1 or len(dest) > 1:
> > - return self.pool.
> > [('state', '=', 'draft'), '|', '|', ('funding_pool_id', 'in', fp),
> > ('cost_
> Why did you change this ? It does not work.
>
> > + return self.search(cr, uid, [('state', '=', 'draft'), '|',
> > '|', ('funding_pool_id', 'in', fp), ('cost_
> > ('destination_
> > return []
> >
> > def _get_trigger_
> > - pay_obj = self.pool.
> > - return pay_obj.search(cr, uid, [('state', '=', 'draft'),
> > ('account_id', 'in', ids)]) + return self.search(cr, uid,
> > [('state', '=', 'draft'), ('account_id', 'in', ids)])
> Same issue here
>
> > def _get_trigger_
> > if isinstance(ids, (int, long)):
> > ids = [ids]
> >
> > to_update = []
> >
> > - pay_obj = self.pool.
> >
> > for dest_link in self.read(cr, uid, ids, ['account_id', 'destination_id',
'funding_
> > - to_update += pay_obj.search(cr, uid, [
> > - ('state', '=', 'draft'),
> > - ('account_id', '=', dest_link[
> > - ('destination_id', '=', dest_link[
> > - ('funding_pool_id', 'in', dest_link[
> > + to_update += self.search(cr, uid, [
>
> and here.
>
> > + ('state', '=', 'draft'),
> > + ('account_id', '=', dest_link[
> > + ('destination_id', '=',
> > dest_link[
> > 'in', dest_link[
> > ])
> >
> > return to_update
--
Fabien MORIN
TeMPO Consulting
20, avenue de la Paix
67000 Strasbourg
France
http:// www.tempo- consulting. fr
Tel : +33 3 88 56 82 16
Fax : +33 9 70 63 35 46