Merge lp:~mukunde/unifield-server/US-11269 into lp:unifield-server
- US-11269
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 6205 |
Proposed branch: | lp:~mukunde/unifield-server/US-11269 |
Merge into: | lp:unifield-server |
Diff against target: |
344 lines (+204/-3) (has conflicts) 5 files modified
bin/addons/account/account.py (+76/-0) bin/addons/account/account_view.xml (+47/-0) bin/addons/account_journal/account_journal.py (+14/-0) bin/addons/account_journal/account_journal_view.xml (+3/-2) bin/addons/msf_profile/i18n/fr_MF.po (+64/-1) Text conflict in bin/addons/msf_profile/i18n/fr_MF.po |
To merge this branch: | bzr merge lp:~mukunde/unifield-server/US-11269 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+451897@code.launchpad.net |
Commit message
Description of the change
- 6138. By jftempo
-
US-12011 [MERGE] PO Confirmation with MML non-conform product
- 6139. By jftempo
-
[MERGE] UF30.1
- 6140. By jftempo
-
Release UF30.1
- 6141. By jftempo
-
US-5946 [FIX] Import expact
- allow integer as Indentifier
- end date: issue depending on server locale (fr_MF)
- Tools > Import : allow to import file with or without end date - 6142. By jftempo
-
US-12041 [FIX] Import payroll: lmf if envoi.ini is ISO-8859 encoded with special char
- 6143. By jftempo
-
US-12130 [FIX] JI / JI Selector: pink screen if Display HQ Code is enabled on Company configuration
- 6144. By jftempo
-
US-12069 [IMP] OCP Webservice to update res.currency.table
- 6145. By jftempo
-
US-US-5912 [FIX] Export PO f/up: too many lines, replace Lmf by a warning message
- 6146. By jftempo
-
US-5376 [FIX] HQ entries import: allow B/S account
- 6147. By jftempo
-
US-6516 [FIX] OCG VI Finance: py3 error on itekeys
- 6148. By jftempo
-
[MERGE] UF31.0rc0
- 6149. By jftempo
-
[MERGE] UF31.0rc1
- 6150. By jftempo
-
[FIX] UF30.1 py3 migration
- 6151. By jftempo
-
[FIX] Asset py3: int, long
- 6152. By jftempo
-
US-12185 |FIX] PI import with ED date 11-2222 nothing happens
- dateutil.parser. parse does not raise a ValueError
- Exception.message no longer exists in py3 - 6153. By jftempo
-
Exception has no more message attribute
- 6154. By jftempo
-
[MERGE] UF31.0rc2
- 6155. By jftempo
-
US-11950 [FIX] Product asset sync down state
- 6156. By jftempo
-
[IMP] RB: create asset data
- 6157. By jftempo
-
Upgrade python lib
- 6158. By jftempo
-
Upgrade python lib
- 6159. By jftempo
-
Upgrade python lib
- 6160. By jftempo
-
upgrade from pip-audit
- 6161. By jftempo
-
Upgrade lib from safety tool
- 6162. By jftempo
-
[IMP] replace deprecated currentThread() / isDaemon() by current_thread() / daemon
- 6163. By jftempo
-
[FIX] Py3 Pillow 10: getsize replaced by getbbox
- 6164. By jftempo
-
US-12244 [FIX] Periodical forecast: fixed date check for dates in the future
- 6165. By jftempo
-
US-6144-py3 [FIX] Sourcing: fixed name filtering for python 3 during creation/
modification - 6166. By jftempo
-
[FIX] Generate translation file to py3
- 6167. By jftempo
-
Release UF31.0py3
- 6168. By jftempo
-
[MERGE] UF31.1
- 6169. By jftempo
-
unifield-
version. txt: typo in version - 6170. By Gaël Mukunde
-
US-11269 [IMP] Prevent changing G/L accounts linked to non-draft registers
- 6171. By Gaël Mukunde
-
US-11269 [IMP] Code fix to allow edition of default journal accounts only until first edition, after that it's only editable through action menu by super admin
- 6172. By Gaël Mukunde
-
US-11269 [IMP] Use less generic class name
- 6173. By Gaël Mukunde
-
US-11269 [IMP] Remove unused code + update the domain of the fields of the wizard + rename button
- 6174. By Gaël Mukunde
-
US-11269 [IMP] Rename action
- 6175. By Gaël Mukunde
-
US-11269 [IMP] Restrict domain of proposed account in wizard to only liquidity accounts
- 6176. By Gaël Mukunde
-
US-11269 [IMP] Code to adapt dynamically the domain of default accounts to display in the wizard search
- 6177. By Gaël Mukunde
-
US-11269 [IMP] Remove unused code
- 6178. By Gaël Mukunde
-
US-11269 [IMP] French translation
Preview Diff
1 | === modified file 'bin/addons/account/account.py' |
2 | --- bin/addons/account/account.py 2023-11-03 15:04:29 +0000 |
3 | +++ bin/addons/account/account.py 2024-02-05 12:55:03 +0000 |
4 | @@ -2939,4 +2939,80 @@ |
5 | |
6 | account_bank_accounts_wizard() |
7 | |
8 | +class journal_change_account(osv.osv_memory): |
9 | + _name = 'journal.change.account' |
10 | + |
11 | + def _get_journal(self, cr, uid, context=None): |
12 | + if context is None: |
13 | + context = {} |
14 | + return context.get('active_id', False) |
15 | + |
16 | + def _get_journal_type(self, cr, uid, context=None): |
17 | + if context is None: |
18 | + context = {} |
19 | + if context.get('active_id', False): |
20 | + return self.pool.get('account.journal').read(cr, uid, context['active_id'], ['type'], context=context)['type'] |
21 | + return False |
22 | + |
23 | + def _get_instance(self, cr, uid, context=None): |
24 | + if context is None: |
25 | + context = {} |
26 | + ids = context.get('active_ids', False) |
27 | + if ids and len(ids) == 1: |
28 | + return self.pool.get('account.journal').read(cr, uid, ids[0], ['is_current_instance'], context=context)['is_current_instance'] |
29 | + return False |
30 | + |
31 | + def _get_credit_account(self, cr, uid, context=None): |
32 | + if context is None: |
33 | + context = {} |
34 | + ids = context.get('active_ids', False) |
35 | + if ids and len(ids) == 1: |
36 | + return self.pool.get('account.journal').read(cr, uid, ids[0], ['default_credit_account_id'], context=context)['default_credit_account_id'] |
37 | + return [] |
38 | + |
39 | + def _get_debit_account(self, cr, uid, context=None): |
40 | + if context is None: |
41 | + context = {} |
42 | + ids = context.get('active_ids', False) |
43 | + if ids and len(ids) == 1: |
44 | + return self.pool.get('account.journal').read(cr, uid, ids[0], ['default_debit_account_id'], context=context)['default_debit_account_id'] |
45 | + return [] |
46 | + |
47 | + |
48 | + _columns = { |
49 | + 'journal_id': fields.many2one('account.journal', string="Current journal"), |
50 | + 'journal_type': fields.char("Current Journal Type", size=32), |
51 | + 'debit_account_id': fields.many2one('account.account', 'Debit account'), |
52 | + 'credit_account_id': fields.many2one('account.account', 'Credit account'), |
53 | + 'is_current_instance': fields.boolean('Is current instance?'), |
54 | + |
55 | + } |
56 | + _defaults = { |
57 | + 'journal_id': _get_journal, |
58 | + 'journal_type': _get_journal_type, |
59 | + 'debit_account_id': _get_debit_account, |
60 | + 'credit_account_id': _get_credit_account, |
61 | + 'is_current_instance': _get_instance, |
62 | + } |
63 | + |
64 | + def journal_change_account(self, cr, uid, ids, context=None): |
65 | + ''' |
66 | + US-11269: Modify the default debit or credit account of the journal |
67 | + ''' |
68 | + if context is None: |
69 | + context = {} |
70 | + journ_obj = self.pool.get('account.journal') |
71 | + active_ids = context.get('active_ids', False) |
72 | + if active_ids: |
73 | + debit_id = self.read(cr, uid, ids, ['debit_account_id'])[0]['debit_account_id'] |
74 | + credit_id = self.read(cr, uid, ids, ['credit_account_id'])[0]['credit_account_id'] |
75 | + if debit_id: |
76 | + journ_obj.write(cr, uid, active_ids, {'default_debit_account_id': debit_id}, context=context) |
77 | + if credit_id: |
78 | + journ_obj.write(cr, uid, active_ids, {'default_credit_account_id': credit_id}, context=context) |
79 | + return {'type': 'ir.actions.act_window_close'} |
80 | + |
81 | + |
82 | +journal_change_account() |
83 | + |
84 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
85 | |
86 | === modified file 'bin/addons/account/account_view.xml' |
87 | --- bin/addons/account/account_view.xml 2023-12-15 14:14:31 +0000 |
88 | +++ bin/addons/account/account_view.xml 2024-02-05 12:55:03 +0000 |
89 | @@ -2248,6 +2248,53 @@ |
90 | res_model="account.move.line" |
91 | src_model="account.journal"/> |
92 | |
93 | + <record model="ir.ui.view" id="wizard_change_account_code"> |
94 | + <field name="name">wizard.change.account.code.form</field> |
95 | + <field name="model">journal.change.account</field> |
96 | + <field name="type">form</field> |
97 | + <field name="arch" type="xml"> |
98 | + <form string="Change Account - Wizard"> |
99 | + <separator string="Wizard to modify the debit/credit accounts of current journal"/> |
100 | + <separator string="Current journal" colspan="2" /> |
101 | + <newline /> |
102 | + <field name="journal_id" nolabel="1" readonly="1" colspan="2"/> |
103 | + <field name="journal_type" invisible="1"/> |
104 | + <newline /> |
105 | + <separator string="Change Default Debit Account" colspan="2" /> |
106 | + <separator string="Change Default Credit Account" colspan="2" /> |
107 | + <newline /> |
108 | + <field name="is_current_instance" invisible="1"/> |
109 | + <field name="debit_account_id" domain="[('type','!=','view'), ('cash_domain', '=', journal_type)]" |
110 | + attrs="{'readonly': [('is_current_instance', '!=', True)]}" colspan="2"> |
111 | + <tree> |
112 | + <field name="name"/> |
113 | + </tree> |
114 | + </field> |
115 | + <field name="credit_account_id" domain="[('type','!=','view'), ('cash_domain', '=', journal_type)]" |
116 | + attrs="{'readonly': [('is_current_instance', '!=', True)]}" colspan="2"> |
117 | + <tree> |
118 | + <field name="name"/> |
119 | + </tree> |
120 | + </field> |
121 | + <newline /> |
122 | + <group colspan="4"> |
123 | + <button string="Cancel" special="cancel" icon="gtk-cancel" /> |
124 | + <button string="Confirm" icon="terp-check" name="journal_change_account" attrs="{'readonly': [('is_current_instance', '!=', True)]}" type="object"/> |
125 | + </group> |
126 | + </form> |
127 | + </field> |
128 | + </record> |
129 | + |
130 | + <act_window |
131 | + id="act_change_account_code" |
132 | + name="Change default journal accounts" |
133 | + res_model="journal.change.account" |
134 | + src_model="account.journal" |
135 | + key2="client_action_multi" |
136 | + view_mode="form" |
137 | + view_type="form" |
138 | + target="new" /> |
139 | + |
140 | <act_window context="{'search_default_reconcile_id':False, 'search_default_partner_id':[active_id]}" domain="[('account_id.reconcile', '=', True),('account_id.type', 'in', ['receivable', 'payable'])]" id="act_account_partner_account_move_all" name="Receivables & Payables" res_model="account.move.line" src_model="res.partner" groups="base.group_extended"/> |
141 | |
142 | <act_window context="{'search_default_partner_id':[active_id]}" id="act_account_partner_account_move" name="Journal Items" res_model="account.move.line" src_model="res.partner" groups="account.group_account_user"/> |
143 | |
144 | === modified file 'bin/addons/account_journal/account_journal.py' |
145 | --- bin/addons/account_journal/account_journal.py 2023-11-03 15:04:29 +0000 |
146 | +++ bin/addons/account_journal/account_journal.py 2024-02-05 12:55:03 +0000 |
147 | @@ -72,6 +72,19 @@ |
148 | res[id] = bool(count_entries(id)) |
149 | return res |
150 | |
151 | + def _get_has_non_draft_register(self, cr, uid, ids, field_name, arg, context=None): |
152 | + def has_non_draft_reg(journal_id): |
153 | + return abs_obj.search(cr, uid, [('journal_id', '=', journal_id), ('state', '!=', 'draft')], limit=1, context=context) |
154 | + res = {} |
155 | + if not ids: |
156 | + return res |
157 | + abs_obj = self.pool.get('account.bank.statement') |
158 | + if isinstance(ids, int): |
159 | + ids = [ids] |
160 | + for id in ids: |
161 | + res[id] = bool(has_non_draft_reg(id)) |
162 | + return res |
163 | + |
164 | _columns = { |
165 | 'type': fields.selection(get_journal_type, 'Type', size=32, required=True, select=1), |
166 | 'code': fields.char('Code', size=10, required=True, help="The code will be used to generate the numbers of the journal entries of this journal."), |
167 | @@ -79,6 +92,7 @@ |
168 | domain="[('type', '=', 'bank'), ('currency', '=', currency), ('is_active', '=', True)]"), |
169 | 'cheque_journal_id': fields.one2many('account.journal', 'bank_journal_id', 'Linked cheque'), |
170 | 'has_entries': fields.function(_get_has_entries, type='boolean', method=True, string='Has journal entries'), |
171 | + 'has_non_draft_register': fields.function(_get_has_non_draft_register, type='boolean', method=True, string='Has non-draft register'), |
172 | } |
173 | |
174 | _defaults = { |
175 | |
176 | === modified file 'bin/addons/account_journal/account_journal_view.xml' |
177 | --- bin/addons/account_journal/account_journal_view.xml 2022-10-05 14:08:57 +0000 |
178 | +++ bin/addons/account_journal/account_journal_view.xml 2024-02-05 12:55:03 +0000 |
179 | @@ -15,6 +15,7 @@ |
180 | <field name="is_current_instance" invisible="1"/> |
181 | <field name="is_coordo_editable" invisible="1"/> |
182 | <field name="has_entries" invisible="1"/> |
183 | + <field name="has_non_draft_register" invisible="1"/> |
184 | <field name="name" select="1"/> |
185 | <field name="code" select="1" |
186 | attrs="{'readonly': [('has_entries', '=', True)]}"/> |
187 | @@ -26,9 +27,9 @@ |
188 | <group col="2" colspan="2"> |
189 | <separator string="Accounts" colspan="4"/> |
190 | <field name="default_debit_account_id" domain="[('type','<>','view'), ('cash_domain', '=', type)]" |
191 | - attrs="{'required': [('type', 'in', ('cash', 'bank', 'cheque', 'cur_adj'))]}"/> |
192 | + attrs="{'required': [('type', 'in', ('cash', 'bank', 'cheque', 'cur_adj'))], 'readonly': [('type', 'in', ('cash', 'bank', 'cheque', 'cur_adj')), ('has_non_draft_register', '=', True)]}"/> |
193 | <field name="default_credit_account_id" domain="[('type','<>','view'), ('cash_domain', '=', type)]" |
194 | - attrs="{'required': [('type', 'in', ('cash', 'bank', 'cheque', 'cur_adj'))]}"/> |
195 | + attrs="{'required': [('type', 'in', ('cash', 'bank', 'cheque', 'cur_adj'))], 'readonly': [('type', 'in', ('cash', 'bank', 'cheque', 'cur_adj')), ('has_non_draft_register', '=', True)]}"/> |
196 | </group> |
197 | <group colspan="2" col="2"> |
198 | <separator string="Company" colspan="4"/> |
199 | |
200 | === modified file 'bin/addons/msf_profile/i18n/fr_MF.po' |
201 | --- bin/addons/msf_profile/i18n/fr_MF.po 2024-01-17 13:57:19 +0000 |
202 | +++ bin/addons/msf_profile/i18n/fr_MF.po 2024-02-05 12:55:03 +0000 |
203 | @@ -3377,10 +3377,11 @@ |
204 | msgid "Transport cost :" |
205 | msgstr "Coût du Transport :" |
206 | |
207 | -#. module: product_asset, account_period_closing_level |
208 | +#. module: product_asset, account_period_closing_level, account |
209 | #: model:ir.ui.menu,name:product_asset.menu_asset_sales |
210 | #: model:ir.ui.menu,name:product_asset.asset_configuration |
211 | #: view:account.period:0 |
212 | +#: view:account.account:0 |
213 | msgid "Assets" |
214 | msgstr "Immobilisations" |
215 | |
216 | @@ -36469,6 +36470,7 @@ |
217 | #: view:modify.responsible:0 |
218 | #: view:signature.add_user.wizard:0 |
219 | #: view:signature.change_date:0 |
220 | +#: view:journal.change.account:0 |
221 | msgid "Confirm" |
222 | msgstr "Confirmer" |
223 | |
224 | @@ -48880,6 +48882,7 @@ |
225 | #: report:addons/account/report/invoice_excel_export.mako:70 |
226 | #: model:product.uom.categ,name:msf_profile.uom_category_percentage |
227 | #: code:addons/msf_doc_import/report/export_po_ad_line_xlsx.py:43 |
228 | +#: report:addons/account/report/export_invoice.mako:146 |
229 | msgid "Percentage" |
230 | msgstr "Pourcentage" |
231 | |
232 | @@ -96635,6 +96638,7 @@ |
233 | #: view:product.asset.disposal:0 |
234 | #: selection:product.asset.event,asset_state:0 |
235 | #: view:product.asset.generate.entries:0 |
236 | +#: view:journal.change.account:0 |
237 | #, python-format |
238 | msgid "Cancel" |
239 | msgstr "Annuler" |
240 | @@ -119691,6 +119695,7 @@ |
241 | |
242 | #. module: register_accounting, account |
243 | #: field:account.move.line,counterpart_transfer_st_line_id:0 |
244 | +#: selection:account.journal.column,field:0 |
245 | msgid "Conterpart transfert register line" |
246 | msgstr "Line de registre de la contrepartie de transfert" |
247 | |
248 | @@ -119749,6 +119754,7 @@ |
249 | #. module: register_accounting, account |
250 | #: field:account.bank.statement.line,has_a_counterpart_transfer:0 |
251 | #: field:account.move.line,has_a_counterpart_transfer:0 |
252 | +#: selection:account.journal.column,field:0 |
253 | msgid "Has a counterpart_transfer" |
254 | msgstr "A une contrepartie de transfert" |
255 | |
256 | @@ -119807,6 +119813,7 @@ |
257 | #: report:addons/account_mcdb/report/report_account_analytic_line_xls.mako:72 |
258 | #: report:addons/account_mcdb/report/report_account_move_line_xls.mako:61 |
259 | #: report:combined.journals.report.pdf:0 |
260 | +#: selection:account.journal.column,field:0 |
261 | msgid "HQ System Account" |
262 | msgstr "Compte Système HQ" |
263 | |
264 | @@ -119936,6 +119943,7 @@ |
265 | #. module: register_accounting, account |
266 | #: field:account.bank.statement.line,counterpart_transfer_st_line_sdref:0 |
267 | #: field:account.move.line,counterpart_transfer_st_line_sdref:0 |
268 | +#: selection:account.journal.column,field:0 |
269 | msgid "St couterpert line sdref" |
270 | msgstr "Sdref de le ligne de reg. de cp" |
271 | |
272 | @@ -121276,6 +121284,7 @@ |
273 | |
274 | #. module: account |
275 | #: field:account.move.line,asset_line_id:0 |
276 | +#: selection:account.journal.column,field:0 |
277 | msgid "Asset Line" |
278 | msgstr "Ligne d'amortissement" |
279 | |
280 | @@ -121489,6 +121498,7 @@ |
281 | #, python-format |
282 | msgid "to open and compute" |
283 | msgstr "à ouvrir et générer" |
284 | +<<<<<<< TREE |
285 | |
286 | #. module: account_override |
287 | #: model:ir.actions.act_window,name:account_override.action_inkind_donation |
288 | @@ -121631,3 +121641,56 @@ |
289 | #, python-format |
290 | msgid "This record is not linked to any Picking." |
291 | msgstr "Cet enregistrement n'est lié à aucun Picking. " |
292 | +======= |
293 | + |
294 | +#. module: account |
295 | +#: view:journal.change.account:0 |
296 | +msgid "Change Account - Wizard" |
297 | +msgstr "Assistant de changement de comptes par défaut" |
298 | + |
299 | +#. module: account |
300 | +#: view:journal.change.account:0 |
301 | +msgid "Change Default Credit Account" |
302 | +msgstr "Changer le compte de crédit par défaut" |
303 | + |
304 | +#. module: account |
305 | +#: view:journal.change.account:0 |
306 | +msgid "Change Default Debit Account" |
307 | +msgstr "Changer le compte de débit par défaut" |
308 | + |
309 | +#. module: account |
310 | +#: model:ir.actions.act_window,name:account.act_change_account_code |
311 | +msgid "Change default journal accounts" |
312 | +msgstr "Changer les comptes par défaut du journal" |
313 | + |
314 | +#. module: account |
315 | +#: field:journal.change.account,credit_account_id:0 |
316 | +msgid "Credit account" |
317 | +msgstr "Compte de crédit" |
318 | + |
319 | +#. module: account |
320 | +#: field:journal.change.account,journal_type:0 |
321 | +msgid "Current Journal Type" |
322 | +msgstr "Type du journal actuel" |
323 | + |
324 | +#. module: account |
325 | +#: view:journal.change.account:0 |
326 | +#: field:journal.change.account,journal_id:0 |
327 | +msgid "Current journal" |
328 | +msgstr "Journal actuel" |
329 | + |
330 | +#. module: account |
331 | +#: field:journal.change.account,debit_account_id:0 |
332 | +msgid "Debit account" |
333 | +msgstr "Compte de débit" |
334 | + |
335 | +#. module: account |
336 | +#: field:journal.change.account,is_current_instance:0 |
337 | +msgid "Is current instance?" |
338 | +msgstr "A été créé dans l'instance actuelle?" |
339 | + |
340 | +#. module: account |
341 | +#: view:journal.change.account:0 |
342 | +msgid "Wizard to modify the debit/credit accounts of current journal" |
343 | +msgstr "Assistant pour modifier les comptes de débit/crédit par défaut du journal actuel" |
344 | +>>>>>>> MERGE-SOURCE |