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

Proposed by jftempo
Status: Merged
Merged at revision: 5772
Proposed branch: lp:~julie-w/unifield-server/US-7594
Merge into: lp:unifield-server
Diff against target: 128 lines (+86/-0) (has conflicts)
3 files modified
bin/addons/account/project/project_view.xml (+5/-0)
bin/addons/analytic_override/analytic_account.py (+58/-0)
bin/addons/msf_profile/i18n/fr_MF.po (+23/-0)
Text conflict in bin/addons/msf_profile/i18n/fr_MF.po
To merge this branch: bzr merge lp:~julie-w/unifield-server/US-7594
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+388475@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
1=== modified file 'bin/addons/account/project/project_view.xml'
2--- bin/addons/account/project/project_view.xml 2020-06-17 14:44:11 +0000
3+++ bin/addons/account/project/project_view.xml 2020-07-31 12:00:59 +0000
4@@ -98,6 +98,11 @@
5 </page>
6 <page string="Description">
7 <field colspan="4" name="description" nolabel="1"/>
8+ <!-- exportable fields -->
9+ <field name="top_cc_instance_ids" invisible="1"/>
10+ <field name="is_target_cc_instance_ids" invisible="1"/>
11+ <field name="po_fo_cc_instance_ids" invisible="1"/>
12+ <field name="cc_missions" invisible="1"/>
13 </page>
14 </notebook>
15 </form>
16
17=== modified file 'bin/addons/analytic_override/analytic_account.py'
18--- bin/addons/analytic_override/analytic_account.py 2020-01-30 14:58:12 +0000
19+++ bin/addons/analytic_override/analytic_account.py 2020-07-31 12:00:59 +0000
20@@ -290,6 +290,52 @@
21 dom.append(('id', 'in', compatible_dest_ids))
22 return dom
23
24+ def _get_cc_instance_ids(self, cr, uid, ids, fields, arg, context=None):
25+ """
26+ Computes the values for fields.function fields, retrieving:
27+ - the instances using the analytic account...
28+ ...as Top Cost Center => top_cc_instance_ids
29+ ...as Target Cost Center => is_target_cc_instance_ids
30+ ...as Cost centre picked for PO/FO reference => po_fo_cc_instance_ids
31+ (Note that those fields should theoretically always be linked to one single instance,
32+ but they are set as one2many in order to be consistent with the type of fields used in the related object.)
33+ - the Missions where the Cost Center is added to => cc_missions
34+ """
35+ if context is None:
36+ context = {}
37+ if isinstance(ids, (int, long)):
38+ ids = [ids]
39+ res = {}
40+ acc_target_cc_obj = self.pool.get('account.target.costcenter')
41+ for analytic_acc_id in ids:
42+ top_instance_ids = []
43+ target_instance_ids = []
44+ po_fo_instance_ids = []
45+ missions = set()
46+ missions_str = ""
47+ target_cc_ids = acc_target_cc_obj.search(cr, uid, [('cost_center_id', '=', analytic_acc_id)], context=context)
48+ if target_cc_ids:
49+ field_list = ['instance_id', 'is_target', 'is_po_fo_cost_center', 'is_top_cost_center']
50+ for target_cc in acc_target_cc_obj.browse(cr, uid, target_cc_ids, fields_to_fetch=field_list, context=context):
51+ instance = target_cc.instance_id
52+ if instance.mission:
53+ missions.add(instance.mission)
54+ if target_cc.is_top_cost_center:
55+ top_instance_ids.append(instance.id)
56+ if target_cc.is_target:
57+ target_instance_ids.append(instance.id)
58+ if target_cc.is_po_fo_cost_center:
59+ po_fo_instance_ids.append(instance.id)
60+ if missions:
61+ missions_str = ", ".join(missions)
62+ res[analytic_acc_id] = {
63+ 'top_cc_instance_ids': top_instance_ids,
64+ 'is_target_cc_instance_ids': target_instance_ids,
65+ 'po_fo_cc_instance_ids': po_fo_instance_ids,
66+ 'cc_missions': missions_str,
67+ }
68+ return res
69+
70 _columns = {
71 'name': fields.char('Name', size=128, required=True, translate=1),
72 'code': fields.char('Code', size=24),
73@@ -318,6 +364,18 @@
74 fnct_search=_search_dest_compatible_with_cc_ids),
75 'dest_without_cc': fields.function(_get_dest_without_cc, type='boolean', method=True, store=False,
76 string="Destination allowing no Cost Center",),
77+ 'top_cc_instance_ids': fields.function(_get_cc_instance_ids, method=True, store=False, readonly=True,
78+ string="Instances having the CC as Top CC",
79+ type="one2many", relation="msf.instance", multi="cc_instances"),
80+ 'is_target_cc_instance_ids': fields.function(_get_cc_instance_ids, method=True, store=False, readonly=True,
81+ string="Instances having the CC as Target CC",
82+ type="one2many", relation="msf.instance", multi="cc_instances"),
83+ 'po_fo_cc_instance_ids': fields.function(_get_cc_instance_ids, method=True, store=False, readonly=True,
84+ string="Instances having the CC as CC picked for PO/FO ref",
85+ type="one2many", relation="msf.instance", multi="cc_instances"),
86+ 'cc_missions': fields.function(_get_cc_instance_ids, method=True, store=False, readonly=True,
87+ string="Missions where the CC is added to",
88+ type='char', multi="cc_instances"),
89 }
90
91 _defaults ={
92
93=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
94--- bin/addons/msf_profile/i18n/fr_MF.po 2020-07-28 15:47:53 +0000
95+++ bin/addons/msf_profile/i18n/fr_MF.po 2020-07-31 12:00:59 +0000
96@@ -110356,9 +110356,32 @@
97 #: view:product.product:0
98 msgid "Merge product"
99 msgstr "Fusion produit"
100+<<<<<<< TREE
101
102 #. module: stock
103 #: code:addons/stock/stock.py:1813
104 #, python-format
105 msgid "is dispatched."
106 msgstr "est expédié."
107+=======
108+
109+#. module: analytic_override
110+#: field:account.analytic.account,top_cc_instance_ids:0
111+msgid "Instances having the CC as Top CC"
112+msgstr "Instances ayant le CC comme CC Principal"
113+
114+#. module: analytic_override
115+#: field:account.analytic.account,is_target_cc_instance_ids:0
116+msgid "Instances having the CC as Target CC"
117+msgstr "Instances ayant le CC comme CC Cible"
118+
119+#. module: analytic_override
120+#: field:account.analytic.account,po_fo_cc_instance_ids:0
121+msgid "Instances having the CC as CC picked for PO/FO ref"
122+msgstr "Instances ayant le CC comme CC sélectionné pour PO/FO"
123+
124+#. module: analytic_override
125+#: field:account.analytic.account,cc_missions:0
126+msgid "Missions where the CC is added to"
127+msgstr "Missions dans lesquelles le CC est ajouté"
128+>>>>>>> MERGE-SOURCE

Subscribers

People subscribed via source and target branches