Merge lp:~julie-w/unifield-server/US-7866 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 5921
Proposed branch: lp:~julie-w/unifield-server/US-7866
Merge into: lp:unifield-server
Diff against target: 108 lines (+48/-1)
5 files modified
bin/addons/msf_instance/account_target_costcenter.py (+29/-0)
bin/addons/msf_instance/msf_instance_view.xml (+1/-1)
bin/addons/msf_profile/data/patches.xml (+5/-0)
bin/addons/msf_profile/i18n/fr_MF.po (+1/-0)
bin/addons/msf_profile/msf_profile.py (+12/-0)
To merge this branch: bzr merge lp:~julie-w/unifield-server/US-7866
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+397371@code.launchpad.net
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
=== modified file 'bin/addons/msf_instance/account_target_costcenter.py'
--- bin/addons/msf_instance/account_target_costcenter.py 2020-10-21 14:18:30 +0000
+++ bin/addons/msf_instance/account_target_costcenter.py 2021-02-02 17:20:06 +0000
@@ -26,9 +26,38 @@
26 _rec_name = 'cost_center_id'26 _rec_name = 'cost_center_id'
27 _trace = True27 _trace = True
2828
29 def _get_cost_center_code(self, cr, uid, ids, name, args, context=None):
30 """
31 Returns a dict with key = target Cost Center id, and value = related Cost Center code.
32 """
33 if context is None:
34 context = {}
35 if isinstance(ids, (int, long)):
36 ids = [ids]
37 res = {}
38 for target_cc in self.browse(cr, uid, ids, fields_to_fetch=['cost_center_id'], context=context):
39 res[target_cc.id] = target_cc.cost_center_id.code or ''
40 return res
41
42 def _get_target_cc_to_update(self, cr, uid, analytic_acc_ids, context=None):
43 """
44 Returns the list of target CC for which the CC code should be updated.
45 """
46 if context is None:
47 context = {}
48 if isinstance(analytic_acc_ids, (int, long)):
49 analytic_acc_ids = [analytic_acc_ids]
50 return self.pool.get('account.target.costcenter').search(cr, uid, [('cost_center_id', 'in', analytic_acc_ids)],
51 order='NO_ORDER', context=context)
52
29 _columns = {53 _columns = {
30 'instance_id': fields.many2one('msf.instance', 'Instance', required=True, select=1),54 'instance_id': fields.many2one('msf.instance', 'Instance', required=True, select=1),
31 'cost_center_id': fields.many2one('account.analytic.account', 'Code', domain=[('category', '=', 'OC')], required=True, select=1),55 'cost_center_id': fields.many2one('account.analytic.account', 'Code', domain=[('category', '=', 'OC')], required=True, select=1),
56 'cost_center_code': fields.function(_get_cost_center_code, method=True, string="Code", type='char', size=24, readonly=True,
57 store={
58 'account.analytic.account': (_get_target_cc_to_update, ['code'], 10),
59 'account.target.costcenter': (lambda self, cr, uid, ids, c=None: ids, ['cost_center_id'], 20),
60 }),
32 'cost_center_name': fields.related('cost_center_id', 'name', string="Name", readonly=True, type="text"),61 'cost_center_name': fields.related('cost_center_id', 'name', string="Name", readonly=True, type="text"),
33 'is_target': fields.boolean('Is target'),62 'is_target': fields.boolean('Is target'),
34 'is_top_cost_center': fields.boolean('Top cost centre for budget consolidation'),63 'is_top_cost_center': fields.boolean('Top cost centre for budget consolidation'),
3564
=== modified file 'bin/addons/msf_instance/msf_instance_view.xml'
--- bin/addons/msf_instance/msf_instance_view.xml 2019-05-02 09:38:25 +0000
+++ bin/addons/msf_instance/msf_instance_view.xml 2021-02-02 17:20:06 +0000
@@ -52,7 +52,7 @@
52 <tree editable="top"52 <tree editable="top"
53 hide_delete_button="PROP_INSTANCE_HIDE_BUTTON or context.get('level')=='project'"53 hide_delete_button="PROP_INSTANCE_HIDE_BUTTON or context.get('level')=='project'"
54 hide_new_button="1" string="Cost Centers">54 hide_new_button="1" string="Cost Centers">
55 <field name="cost_center_id" readonly="1"/>55 <field name="cost_center_code"/>
56 <field name="cost_center_name"/>56 <field name="cost_center_name"/>
57 <field name="is_target"/>57 <field name="is_target"/>
58 <field name="is_top_cost_center"/>58 <field name="is_top_cost_center"/>
5959
=== modified file 'bin/addons/msf_profile/data/patches.xml'
--- bin/addons/msf_profile/data/patches.xml 2020-11-30 15:46:46 +0000
+++ bin/addons/msf_profile/data/patches.xml 2021-02-02 17:20:06 +0000
@@ -630,8 +630,13 @@
630 <field name="method">us_7808_ocg_rename_esc</field>630 <field name="method">us_7808_ocg_rename_esc</field>
631 </record>631 </record>
632632
633 <!-- UF20.0 -->
633 <record id="us_7848_cold_chain" model="patch.scripts">634 <record id="us_7848_cold_chain" model="patch.scripts">
634 <field name="method">us_7848_cold_chain</field>635 <field name="method">us_7848_cold_chain</field>
635 </record>636 </record>
637
638 <record id="us_7866_fill_in_target_cc_code" model="patch.scripts">
639 <field name="method">us_7866_fill_in_target_cc_code</field>
640 </record>
636 </data>641 </data>
637</openerp>642</openerp>
638643
=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
--- bin/addons/msf_profile/i18n/fr_MF.po 2021-02-01 13:51:28 +0000
+++ bin/addons/msf_profile/i18n/fr_MF.po 2021-02-02 17:20:06 +0000
@@ -34772,6 +34772,7 @@
34772#: report:addons/stock/report/products_situation_report_xls.mako:21634772#: report:addons/stock/report/products_situation_report_xls.mako:216
34773#: field:products.situation.report,p_code:034773#: field:products.situation.report,p_code:0
34774#: report:addons/msf_tools/report/report_stock_pipe_per_product_instance_xls.mako:8634774#: report:addons/msf_tools/report/report_stock_pipe_per_product_instance_xls.mako:86
34775#: field:account.target.costcenter,cost_center_code:0
34775#, python-format34776#, python-format
34776msgid "Code"34777msgid "Code"
34777msgstr "Code"34778msgstr "Code"
3477834779
=== modified file 'bin/addons/msf_profile/msf_profile.py'
--- bin/addons/msf_profile/msf_profile.py 2020-11-30 15:46:46 +0000
+++ bin/addons/msf_profile/msf_profile.py 2021-02-02 17:20:06 +0000
@@ -52,6 +52,18 @@
52 'model': lambda *a: 'patch.scripts',52 'model': lambda *a: 'patch.scripts',
53 }53 }
5454
55 # UF20.0
56 def us_7866_fill_in_target_cc_code(self, cr, uid, *a, **b):
57 """
58 Fills in the new "cost_center_code" field of the Account Target Cost Centers.
59 """
60 cr.execute("""
61 UPDATE account_target_costcenter t_cc
62 SET cost_center_code = (SELECT code FROM account_analytic_account a_acc WHERE a_acc.id = t_cc.cost_center_id);
63 """)
64 self._logger.warn('Cost Center Code updated in %s Target CC.' % (cr.rowcount,))
65 return True
66
55 def us_7848_cold_chain(self, cr, uid, *a, **b):67 def us_7848_cold_chain(self, cr, uid, *a, **b):
56 for table in ['internal_move_processor', 'outgoing_delivery_move_processor', 'return_ppl_move_processor', 'stock_move_in_processor', 'stock_move_processor']:68 for table in ['internal_move_processor', 'outgoing_delivery_move_processor', 'return_ppl_move_processor', 'stock_move_in_processor', 'stock_move_processor']:
57 cr.execute("update %s set kc_check = '' where kc_check != ''" % (table, )) # not_a_user_entry69 cr.execute("update %s set kc_check = '' where kc_check != ''" % (table, )) # not_a_user_entry

Subscribers

People subscribed via source and target branches