Merge lp:~julie-w/unifield-server/US-5667 into lp:unifield-server
- US-5667
- Merge into trunk
Proposed by
jftempo
Status: | Merged |
---|---|
Merged at revision: | 5310 |
Proposed branch: | lp:~julie-w/unifield-server/US-5667 |
Merge into: | lp:unifield-server |
Diff against target: |
248 lines (+76/-76) 7 files modified
bin/addons/financing_contract/__openerp__.py (+0/-1) bin/addons/financing_contract/contract.py (+36/-3) bin/addons/financing_contract/financing_contract_view.xml (+1/-1) bin/addons/financing_contract/financing_contract_workflow.xml (+0/-68) bin/addons/financing_contract/wizard/wizard_financing_contract_warning.py (+2/-3) bin/addons/msf_profile/data/patches.xml (+5/-0) bin/addons/msf_profile/msf_profile.py (+32/-0) |
To merge this branch: | bzr merge lp:~julie-w/unifield-server/US-5667 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+364808@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 'bin/addons/financing_contract/__openerp__.py' | |||
2 | --- bin/addons/financing_contract/__openerp__.py 2017-10-09 21:06:10 +0000 | |||
3 | +++ bin/addons/financing_contract/__openerp__.py 2019-03-20 14:43:46 +0000 | |||
4 | @@ -31,7 +31,6 @@ | |||
5 | 31 | "update_xml": [ | 31 | "update_xml": [ |
6 | 32 | 'security/ir.model.access.csv', | 32 | 'security/ir.model.access.csv', |
7 | 33 | 'financing_contract_view.xml', | 33 | 'financing_contract_view.xml', |
8 | 34 | 'financing_contract_workflow.xml', | ||
9 | 35 | 'financing_contract_report.xml', | 34 | 'financing_contract_report.xml', |
10 | 36 | 'wizard/wizard_financing_currency_export_view.xml' | 35 | 'wizard/wizard_financing_currency_export_view.xml' |
11 | 37 | ], | 36 | ], |
12 | 38 | 37 | ||
13 | === modified file 'bin/addons/financing_contract/contract.py' | |||
14 | --- bin/addons/financing_contract/contract.py 2018-04-03 10:18:51 +0000 | |||
15 | +++ bin/addons/financing_contract/contract.py 2019-03-20 14:43:46 +0000 | |||
16 | @@ -132,6 +132,19 @@ | |||
17 | 132 | return self._check_grant_amount_proxy(cr, uid, ids, | 132 | return self._check_grant_amount_proxy(cr, uid, ids, |
18 | 133 | 'contract_open', context=context) | 133 | 'contract_open', context=context) |
19 | 134 | 134 | ||
20 | 135 | def contract_reopen_proxy(self, cr, uid, ids, context=None): | ||
21 | 136 | """ | ||
22 | 137 | Sets the contract state from Soft-Closed BACK to Open (no check needed) | ||
23 | 138 | """ | ||
24 | 139 | if context is None: | ||
25 | 140 | context = {} | ||
26 | 141 | if isinstance(ids, (long, int)): | ||
27 | 142 | ids = [ids] | ||
28 | 143 | for contract in self.read(cr, uid, ids, ['state'], context=context): | ||
29 | 144 | if contract.get('state', '') == 'soft_closed': | ||
30 | 145 | self.write(cr, uid, contract['id'], {'state': 'open'}, context=context) | ||
31 | 146 | return True | ||
32 | 147 | |||
33 | 135 | def contract_open(self, cr, uid, ids, *args): | 148 | def contract_open(self, cr, uid, ids, *args): |
34 | 136 | self.write(cr, uid, ids, { | 149 | self.write(cr, uid, ids, { |
35 | 137 | 'state': 'open', | 150 | 'state': 'open', |
36 | @@ -628,6 +641,8 @@ | |||
37 | 628 | def write(self, cr, uid, ids, vals, context=None): | 641 | def write(self, cr, uid, ids, vals, context=None): |
38 | 629 | if not ids: | 642 | if not ids: |
39 | 630 | return True | 643 | return True |
40 | 644 | if isinstance(ids, (int, long)): | ||
41 | 645 | ids = [ids] | ||
42 | 631 | if context is None: | 646 | if context is None: |
43 | 632 | context = {} | 647 | context = {} |
44 | 633 | 648 | ||
45 | @@ -716,6 +731,26 @@ | |||
46 | 716 | 731 | ||
47 | 717 | return res | 732 | return res |
48 | 718 | 733 | ||
49 | 734 | def change_contract_state(self, cr, uid, ids, signal, context=None): | ||
50 | 735 | """ | ||
51 | 736 | Changes the contract state: | ||
52 | 737 | - from Draft to Open (signal contract_open) | ||
53 | 738 | - from Open to Soft-closed (signal contract_soft_closed) | ||
54 | 739 | - from Soft-closed to Hard-closed (signal contract_hard_closed) | ||
55 | 740 | """ | ||
56 | 741 | if context is None: | ||
57 | 742 | context = {} | ||
58 | 743 | if isinstance(ids, (long, int)): | ||
59 | 744 | ids = [ids] | ||
60 | 745 | for contract in self.read(cr, uid, ids, ['state'], context=context): | ||
61 | 746 | state = contract.get('state', '') | ||
62 | 747 | if state == 'draft' and signal == 'contract_open': | ||
63 | 748 | self.contract_open(cr, uid, contract['id']) | ||
64 | 749 | elif state == 'open' and signal == 'contract_soft_closed': | ||
65 | 750 | self.contract_soft_closed(cr, uid, contract['id']) | ||
66 | 751 | elif state == 'soft_closed' and signal == 'contract_hard_closed': | ||
67 | 752 | self.contract_hard_closed(cr, uid, contract['id']) | ||
68 | 753 | |||
69 | 719 | def _check_grant_amount_proxy(self, cr, uid, ids, signal, context=None): | 754 | def _check_grant_amount_proxy(self, cr, uid, ids, signal, context=None): |
70 | 720 | if isinstance(ids, (long, int)): | 755 | if isinstance(ids, (long, int)): |
71 | 721 | ids = [ids] | 756 | ids = [ids] |
72 | @@ -723,9 +758,7 @@ | |||
73 | 723 | context=context) | 758 | context=context) |
74 | 724 | if check_action: | 759 | if check_action: |
75 | 725 | return check_action | 760 | return check_action |
79 | 726 | wf_service = netsvc.LocalService("workflow") | 761 | self.change_contract_state(cr, uid, ids, signal, context=context) |
77 | 727 | for id in ids: | ||
78 | 728 | wf_service.trg_validate(uid, self._name, id, signal, cr) | ||
80 | 729 | return True | 762 | return True |
81 | 730 | 763 | ||
82 | 731 | def _check_grant_amount(self, cr, uid, ids, signal, context=None): | 764 | def _check_grant_amount(self, cr, uid, ids, signal, context=None): |
83 | 732 | 765 | ||
84 | === modified file 'bin/addons/financing_contract/financing_contract_view.xml' | |||
85 | --- bin/addons/financing_contract/financing_contract_view.xml 2017-06-13 15:20:13 +0000 | |||
86 | +++ bin/addons/financing_contract/financing_contract_view.xml 2019-03-20 14:43:46 +0000 | |||
87 | @@ -134,7 +134,7 @@ | |||
88 | 134 | </group> | 134 | </group> |
89 | 135 | <button name="contract_open_proxy" states="draft" string="Open" type="object" icon="gtk-go-forward"/> | 135 | <button name="contract_open_proxy" states="draft" string="Open" type="object" icon="gtk-go-forward"/> |
90 | 136 | <button name="contract_soft_closed_proxy" states="open" string="Soft-close" type="object" icon="gtk-go-forward"/> | 136 | <button name="contract_soft_closed_proxy" states="open" string="Soft-close" type="object" icon="gtk-go-forward"/> |
92 | 137 | <button name="contract_reopen" states="soft_closed" string="Re-Open" type="workflow" icon="gtk-go-forward"/> | 137 | <button name="contract_reopen_proxy" states="soft_closed" string="Re-Open" type="object" icon="gtk-go-forward"/> |
93 | 138 | <button name="contract_hard_closed_proxy" states="soft_closed" string="Hard-close" type="object" icon="gtk-ok"/> | 138 | <button name="contract_hard_closed_proxy" states="soft_closed" string="Hard-close" type="object" icon="gtk-ok"/> |
94 | 139 | </form> | 139 | </form> |
95 | 140 | </field> | 140 | </field> |
96 | 141 | 141 | ||
97 | === removed file 'bin/addons/financing_contract/financing_contract_workflow.xml' | |||
98 | --- bin/addons/financing_contract/financing_contract_workflow.xml 2018-09-28 15:47:23 +0000 | |||
99 | +++ bin/addons/financing_contract/financing_contract_workflow.xml 1970-01-01 00:00:00 +0000 | |||
100 | @@ -1,68 +0,0 @@ | |||
101 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
102 | 2 | <openerp> | ||
103 | 3 | <data> | ||
104 | 4 | |||
105 | 5 | <record id="wkf" model="workflow"> | ||
106 | 6 | <field name="name">wkf.financing.contract</field> | ||
107 | 7 | <field name="osv">financing.contract.contract</field> | ||
108 | 8 | <field name="on_create">True</field> | ||
109 | 9 | </record> | ||
110 | 10 | |||
111 | 11 | <record id="act_draft" model="workflow.activity"> | ||
112 | 12 | <field name="wkf_id" ref="wkf"/> | ||
113 | 13 | <field name="flow_start">True</field> | ||
114 | 14 | <field name="name">draft</field> | ||
115 | 15 | </record> | ||
116 | 16 | |||
117 | 17 | <record id="act_open" model="workflow.activity"> | ||
118 | 18 | <field name="wkf_id" ref="wkf"/> | ||
119 | 19 | <field name="name">open</field> | ||
120 | 20 | <field name="action">contract_open()</field> | ||
121 | 21 | <field name="kind">function</field> | ||
122 | 22 | </record> | ||
123 | 23 | |||
124 | 24 | <record id="act_soft_closed" model="workflow.activity"> | ||
125 | 25 | <field name="wkf_id" ref="wkf"/> | ||
126 | 26 | <field name="name">soft_closed</field> | ||
127 | 27 | <field name="action">contract_soft_closed()</field> | ||
128 | 28 | <field name="kind">function</field> | ||
129 | 29 | </record> | ||
130 | 30 | |||
131 | 31 | <record id="act_hard_closed" model="workflow.activity"> | ||
132 | 32 | <field name="wkf_id" ref="wkf"/> | ||
133 | 33 | <field name="name">hard_closed</field> | ||
134 | 34 | <field name="flow_stop">True</field> | ||
135 | 35 | <field name="action">contract_hard_closed()</field> | ||
136 | 36 | <field name="kind">function</field> | ||
137 | 37 | </record> | ||
138 | 38 | |||
139 | 39 | <record id="t1" model="workflow.transition"> | ||
140 | 40 | <field name="act_from" ref="act_draft"/> | ||
141 | 41 | <field name="act_to" ref="act_open"/> | ||
142 | 42 | <field name="sequence" eval="10" /> | ||
143 | 43 | <field name="signal">contract_open</field> | ||
144 | 44 | </record> | ||
145 | 45 | |||
146 | 46 | <record id="t2" model="workflow.transition"> | ||
147 | 47 | <field name="act_from" ref="act_open"/> | ||
148 | 48 | <field name="act_to" ref="act_soft_closed"/> | ||
149 | 49 | <field name="sequence" eval="10" /> | ||
150 | 50 | <field name="signal">contract_soft_closed</field> | ||
151 | 51 | </record> | ||
152 | 52 | |||
153 | 53 | <record id="t3" model="workflow.transition"> | ||
154 | 54 | <field name="act_from" ref="act_soft_closed"/> | ||
155 | 55 | <field name="act_to" ref="act_hard_closed"/> | ||
156 | 56 | <field name="sequence" eval="10" /> | ||
157 | 57 | <field name="signal">contract_hard_closed</field> | ||
158 | 58 | </record> | ||
159 | 59 | |||
160 | 60 | <record id="t4" model="workflow.transition"> | ||
161 | 61 | <field name="act_from" ref="act_soft_closed"/> | ||
162 | 62 | <field name="act_to" ref="act_open"/> | ||
163 | 63 | <field name="sequence" eval="20" /> | ||
164 | 64 | <field name="signal">contract_reopen</field> | ||
165 | 65 | </record> | ||
166 | 66 | |||
167 | 67 | </data> | ||
168 | 68 | </openerp> | ||
169 | 69 | 0 | ||
170 | === modified file 'bin/addons/financing_contract/wizard/wizard_financing_contract_warning.py' | |||
171 | --- bin/addons/financing_contract/wizard/wizard_financing_contract_warning.py 2015-02-03 13:29:39 +0000 | |||
172 | +++ bin/addons/financing_contract/wizard/wizard_financing_contract_warning.py 2019-03-20 14:43:46 +0000 | |||
173 | @@ -42,14 +42,13 @@ | |||
174 | 42 | } | 42 | } |
175 | 43 | 43 | ||
176 | 44 | def btn_close(self, cr, uid, ids, context=None): | 44 | def btn_close(self, cr, uid, ids, context=None): |
177 | 45 | contract_obj = self.pool.get('financing.contract.contract') | ||
178 | 45 | signal = context.get('financing_contract_warning', {}).get( | 46 | signal = context.get('financing_contract_warning', {}).get( |
179 | 46 | 'signal', False) | 47 | 'signal', False) |
180 | 47 | res_id = context.get('financing_contract_warning', {}).get( | 48 | res_id = context.get('financing_contract_warning', {}).get( |
181 | 48 | 'res_id', False) | 49 | 'res_id', False) |
182 | 49 | if signal and res_id: | 50 | if signal and res_id: |
186 | 50 | wf_service = netsvc.LocalService("workflow") | 51 | contract_obj.change_contract_state(cr, uid, res_id, signal, context=context) |
184 | 51 | wf_service.trg_validate(uid, 'financing.contract.contract', res_id, | ||
185 | 52 | signal, cr) | ||
187 | 53 | return { | 52 | return { |
188 | 54 | 'type': 'ir.actions.act_window_close', 'context': context, | 53 | 'type': 'ir.actions.act_window_close', 'context': context, |
189 | 55 | } | 54 | } |
190 | 56 | 55 | ||
191 | === modified file 'bin/addons/msf_profile/data/patches.xml' | |||
192 | --- bin/addons/msf_profile/data/patches.xml 2019-02-21 16:12:25 +0000 | |||
193 | +++ bin/addons/msf_profile/data/patches.xml 2019-03-20 14:43:46 +0000 | |||
194 | @@ -1,6 +1,11 @@ | |||
195 | 1 | <?xml version="1.0" encoding="utf-8" ?> | 1 | <?xml version="1.0" encoding="utf-8" ?> |
196 | 2 | <openerp> | 2 | <openerp> |
197 | 3 | <data> | 3 | <data> |
198 | 4 | <!-- UF13.0 --> | ||
199 | 5 | <record id="us_5667_remove_contract_workflow" model="patch.scripts"> | ||
200 | 6 | <field name="method">us_5667_remove_contract_workflow</field> | ||
201 | 7 | </record> | ||
202 | 8 | |||
203 | 4 | <!-- UF12.0 --> | 9 | <!-- UF12.0 --> |
204 | 5 | <record id="us_5724_set_previous_fy_dates_allowed" model="patch.scripts"> | 10 | <record id="us_5724_set_previous_fy_dates_allowed" model="patch.scripts"> |
205 | 6 | <field name="method">us_5724_set_previous_fy_dates_allowed</field> | 11 | <field name="method">us_5724_set_previous_fy_dates_allowed</field> |
206 | 7 | 12 | ||
207 | === modified file 'bin/addons/msf_profile/msf_profile.py' | |||
208 | --- bin/addons/msf_profile/msf_profile.py 2019-02-21 16:12:25 +0000 | |||
209 | +++ bin/addons/msf_profile/msf_profile.py 2019-03-20 14:43:46 +0000 | |||
210 | @@ -52,6 +52,38 @@ | |||
211 | 52 | 'model': lambda *a: 'patch.scripts', | 52 | 'model': lambda *a: 'patch.scripts', |
212 | 53 | } | 53 | } |
213 | 54 | 54 | ||
214 | 55 | # UF13.0 | ||
215 | 56 | def us_5667_remove_contract_workflow(self, cr, uid, *a, **b): | ||
216 | 57 | """ | ||
217 | 58 | Deletes the workflow related to Financing Contracts (not used anymore) | ||
218 | 59 | """ | ||
219 | 60 | delete_wkf_transition = """ | ||
220 | 61 | DELETE FROM wkf_transition | ||
221 | 62 | WHERE signal IN ('contract_open', 'contract_soft_closed', 'contract_hard_closed', 'contract_reopen') | ||
222 | 63 | AND act_from IN | ||
223 | 64 | (SELECT id FROM wkf_activity WHERE wkf_id = | ||
224 | 65 | (SELECT id FROM wkf WHERE name='wkf.financing.contract' AND osv='financing.contract.contract') | ||
225 | 66 | ); | ||
226 | 67 | """ | ||
227 | 68 | delete_wkf_workitem = """ | ||
228 | 69 | DELETE FROM wkf_workitem WHERE act_id IN | ||
229 | 70 | (SELECT id FROM wkf_activity WHERE wkf_id = | ||
230 | 71 | (SELECT id FROM wkf WHERE name='wkf.financing.contract' AND osv='financing.contract.contract') | ||
231 | 72 | ); | ||
232 | 73 | """ | ||
233 | 74 | delete_wkf_activity = """ | ||
234 | 75 | DELETE FROM wkf_activity | ||
235 | 76 | WHERE wkf_id = (SELECT id FROM wkf WHERE name='wkf.financing.contract' AND osv='financing.contract.contract'); | ||
236 | 77 | """ | ||
237 | 78 | delete_wkf = """ | ||
238 | 79 | DELETE FROM wkf WHERE name='wkf.financing.contract' AND osv='financing.contract.contract'; | ||
239 | 80 | """ | ||
240 | 81 | cr.execute(delete_wkf_transition) | ||
241 | 82 | cr.execute(delete_wkf_workitem) | ||
242 | 83 | cr.execute(delete_wkf_activity) | ||
243 | 84 | cr.execute(delete_wkf) # will also delete data in wkf_instance because of the ONDELETE 'cascade' | ||
244 | 85 | return True | ||
245 | 86 | |||
246 | 55 | # UF12.0 | 87 | # UF12.0 |
247 | 56 | def us_5724_set_previous_fy_dates_allowed(self, cr, uid, *a, **b): | 88 | def us_5724_set_previous_fy_dates_allowed(self, cr, uid, *a, **b): |
248 | 57 | """ | 89 | """ |