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

Proposed by jftempo
Status: Merged
Merged at revision: 5146
Proposed branch: lp:~julie-w/unifield-server/US-4638
Merge into: lp:unifield-server
Diff against target: 1955 lines (+605/-383)
28 files modified
bin/addons/account/account_view.xml (+4/-4)
bin/addons/account/report/account_liquidity_balance.mako (+1/-1)
bin/addons/account_corrections/account_move_line.py (+62/-110)
bin/addons/account_corrections/account_wizard_view.xml (+6/-0)
bin/addons/account_corrections/wizard/analytic_distribution_wizard.py (+16/-10)
bin/addons/account_corrections/wizard/journal_items_corrections.py (+160/-38)
bin/addons/account_override/account_bank_statement.py (+4/-0)
bin/addons/account_override/account_move_line.py (+5/-1)
bin/addons/analytic_distribution/wizard/analytic_distribution_wizard.py (+2/-2)
bin/addons/finance/cash_request.py (+1/-1)
bin/addons/finance/cash_request_view.xml (+2/-2)
bin/addons/msf_profile/i18n/fr_MF.po (+127/-88)
bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv (+1/-1)
bin/addons/register_accounting/account_bank_statement.py (+37/-39)
bin/addons/register_accounting/account_cash_statement.py (+3/-3)
bin/addons/register_accounting/account_view.xml (+5/-4)
bin/addons/register_accounting/report/cash_inventory.rml (+2/-2)
bin/addons/register_accounting/report/fully_report_xls.mako (+104/-9)
bin/addons/register_accounting/report/liquidity_position_pdf.rml (+1/-1)
bin/addons/register_accounting/report/liquidity_position_xls.mako (+1/-1)
bin/addons/register_accounting/report/report_fully_report.py (+3/-3)
bin/addons/register_accounting/report/report_liquidity_position.py (+1/-1)
bin/addons/register_accounting/wizard/register_opening.py (+4/-4)
bin/addons/register_accounting/wizard/register_opening.xml (+1/-1)
bin/addons/register_accounting/wizard/wizard_cash_return.py (+47/-52)
bin/addons/vertical_integration/report/hq_report_ocb.py (+1/-1)
bin/addons/vertical_integration/report/hq_report_ocg.py (+2/-2)
bin/addons/vertical_integration/report/hq_report_ocp.py (+2/-2)
To merge this branch: bzr merge lp:~julie-w/unifield-server/US-4638
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+356818@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/account_view.xml'
2--- bin/addons/account/account_view.xml 2018-08-14 16:05:39 +0000
3+++ bin/addons/account/account_view.xml 2018-10-16 13:04:48 +0000
4@@ -2650,12 +2650,12 @@
5 <page string="CashBox">
6 <group col="2" colspan="2" expand="1">
7 <field name="starting_details_ids" nolabel="1" colspan="2" attrs="{'readonly':[('state','!=','draft')]}">
8- <tree string = "Opening Balance" editable="bottom">
9+ <tree string="Starting Balance" editable="bottom">
10 <field name="pieces"/>
11 <field name="number" on_change="on_change_sub(pieces,number, parent.balance_end)"/>
12 <field name="subtotal" sum="Total"/>
13 </tree>
14- <form string = "Opening Balance">
15+ <form string="Starting Balance">
16 <field name="pieces"/>
17 <field name="number" on_change="on_change_sub(pieces,number, parent.balance_end)"/>
18 <field name="subtotal"/>
19@@ -2688,8 +2688,8 @@
20 <field name="closing_date" select="1" readonly="1"/>
21 </group>
22 <group col="2" colspan="2">
23- <separator string="Opening Balance" colspan="4"/>
24- <field name="balance_start" readonly="1" string="Opening Balance"/>
25+ <separator string="Starting Balance" colspan="4"/>
26+ <field name="balance_start" readonly="1" string="Starting Balance"/>
27 <field name="total_entry_encoding"/>
28 </group>
29 <group col="2" colspan="2">
30
31=== modified file 'bin/addons/account/report/account_liquidity_balance.mako'
32--- bin/addons/account/report/account_liquidity_balance.mako 2017-05-31 13:57:26 +0000
33+++ bin/addons/account/report/account_liquidity_balance.mako 2018-10-16 13:04:48 +0000
34@@ -165,7 +165,7 @@
35 <Data ss:Type="String">${_('Period')}</Data>
36 </Cell>
37 <Cell ss:StyleID="ssHeader">
38- <Data ss:Type="String">${_('Opening balance')}</Data>
39+ <Data ss:Type="String">${_('Starting balance')}</Data>
40 </Cell>
41 <Cell ss:StyleID="ssHeader">
42 <Data ss:Type="String">${_('Calculated balance')}</Data>
43
44=== modified file 'bin/addons/account_corrections/account_move_line.py'
45--- bin/addons/account_corrections/account_move_line.py 2018-09-06 09:03:25 +0000
46+++ bin/addons/account_corrections/account_move_line.py 2018-10-16 13:04:48 +0000
47@@ -582,12 +582,27 @@
48 success_move_ids.append(new_move_id)
49 return success_move_line_ids, success_move_ids
50
51- def update_account_on_st_line(self, cr, uid, ids, account_id=None, context=None):
52- """
53- Update the account from the statement line attached if different
54- """
55- # Some verifications
56- if not context:
57+ def _get_third_party_fields(self, third_party):
58+ """
59+ Returns the partner_id, employee_id, transfer_journal_id corresponding to the third_party in parameter
60+ """
61+ partner_id = False
62+ employee_id = False
63+ transfer_journal_id = False
64+ if third_party:
65+ if third_party._table_name == 'res.partner':
66+ partner_id = third_party.id
67+ elif third_party._table_name == 'hr.employee':
68+ employee_id = third_party.id
69+ elif third_party._table_name == 'account.journal':
70+ transfer_journal_id = third_party.id
71+ return partner_id, employee_id, transfer_journal_id
72+
73+ def update_st_line(self, cr, uid, ids, account_id=None, context=None):
74+ """
75+ Update the account of the statement line
76+ """
77+ if context is None:
78 context = {}
79 if isinstance(ids, (int, long)):
80 ids = [ids]
81@@ -595,6 +610,7 @@
82 raise osv.except_osv(_('Warning'), _('No account_id given. No update on account will be done.'))
83 # Prepare some values
84 absl_obj = self.pool.get('account.bank.statement.line')
85+ cor_vals = {'account_id': account_id}
86 # Update lines
87 for ml in self.browse(cr, uid, ids, context=context):
88 # in order to update hard posted line (that's forbidden!), we use a tip: add from_correction in context
89@@ -607,22 +623,28 @@
90 # US-303: only update the statement line that links to this move line
91 if st_line.cash_return_move_line_id:
92 if st_line.cash_return_move_line_id.id == ml.id:
93- absl_obj.write(cr, uid, [st_line.id], {'account_id': account_id}, context=context)
94+ absl_obj.write(cr, uid, [st_line.id], cor_vals, context=context)
95 # we informs new move line that it have correct a statement line
96 self.write(cr, uid, corrected_line_ids, {'corrected_st_line_id': st_line.id}, context=context)
97 break
98 elif not st_line.from_cash_return: #US-1044: only update the account on line if the regline is not cash return!
99 #US-303: If not the case, then we inform the new move line that it has corrected a statement line
100- absl_obj.write(cr, uid, [st_line.id], {'account_id': account_id}, context=context)
101+ absl_obj.write(cr, uid, [st_line.id], cor_vals, context=context)
102 self.write(cr, uid, corrected_line_ids, {'corrected_st_line_id': st_line.id}, context=context)
103 # if not, this move line should have a direct link to a register line
104 elif ml.statement_id and ml.corrected_st_line_id:
105- absl_obj.write(cr, uid, [ml.corrected_st_line_id.id], {'account_id': account_id}, context=context)
106+ absl_obj.write(cr, uid, [ml.corrected_st_line_id.id], cor_vals, context=context)
107 return True
108
109- def correct_account(self, cr, uid, ids, date=None, new_account_id=None, distrib_id=False, context=None):
110+ def correct_aml(self, cr, uid, ids, date=None, new_account_id=None, distrib_id=False, new_third_party=None, context=None):
111 """
112- Correct given account_move_line by only changing account
113+ Corrects the G/L account and/or the Third Party of the JIs having their ids in param.
114+ Generates the related REV/COR lines.
115+
116+ /!\ WARNING /!\
117+ new_third_party is a partner_type, i.e. it can be a res.partner, hr.employee... If it is None (= no 3d party
118+ passed as a parameter): no change regarding 3d Party should be made, whereas if it is False/empty/browse_null,
119+ the COR line must have an empty Third Party.
120 """
121 # Verification
122 if not context:
123@@ -638,6 +660,7 @@
124 move_obj = self.pool.get('account.move')
125 j_obj = self.pool.get('account.journal')
126 al_obj = self.pool.get('account.analytic.line')
127+ wiz_obj = self.pool.get('wizard.journal.items.corrections')
128 success_move_line_ids = []
129
130 # New account
131@@ -680,8 +703,8 @@
132 not initial_al_ids and new_account and \
133 new_account.is_analytic_addicted:
134 # we check only if no distrib_id arg passed to function
135- msg = _("The line '%s' with new account '%s - %s' need an" \
136- " analytic distribution (you may have changed account from" \
137+ msg = _("The line '%s' with the new account '%s - %s' needs an" \
138+ " analytic distribution (you may have changed the account from" \
139 " one with no AD required to a new one with AD required).")
140 raise osv.except_osv(_('Error'), msg % (ml.move_id.name,
141 new_account.code, new_account.name, ))
142@@ -711,7 +734,8 @@
143 for aal in self.pool.get('account.analytic.line').browse(cr, uid, aal_ids):
144 check_accounts = self.pool.get('account.analytic.account').is_blocked_by_a_contract(cr, uid, [aal.account_id.id])
145 if check_accounts and aal.account_id.id in check_accounts:
146- raise osv.except_osv(_('Warning'), _('You cannot change the G/L account since it is used in a closed financing contract.'))
147+ raise osv.except_osv(_('Warning'), _('You cannot change this entry since one of its accounts is '
148+ 'used in a closed financing contract.'))
149 # (US-815) use the right period for December HQ Entries
150 period_id_dec_hq_entry = False
151 if period_number == 12 and context.get('period_id_for_dec_hq_entries', False):
152@@ -765,13 +789,31 @@
153 cor_vals['analytic_distribution_id'] = distrib_id
154 elif ml.analytic_distribution_id:
155 cor_vals['analytic_distribution_id'] = self.pool.get('analytic.distribution').copy(cr, uid, ml.analytic_distribution_id.id, {}, context=context)
156+ if new_third_party is not None: # if None: no correction on Third Party should be made
157+ new_partner_id, new_employee_id, new_transfer_journal_id = self._get_third_party_fields(new_third_party)
158+ cor_vals.update({
159+ 'partner_id': new_partner_id,
160+ 'employee_id': new_employee_id,
161+ 'transfer_journal_id': new_transfer_journal_id,
162+ })
163+ # if no Third Party: reset partner_txt (this field is automatically updated only when there is one)
164+ if not new_partner_id and not new_employee_id and not new_transfer_journal_id:
165+ cor_vals['partner_txt'] = ''
166+ # set the partner_type_mandatory tag
167+ third_required = False
168+ if new_account.type_for_register in ['advance', 'down_payment', 'payroll', 'transfer', 'transfer_same']:
169+ third_required = True
170+ cor_vals['partner_type_mandatory'] = third_required
171 self.write(cr, uid, [correction_line_id], cor_vals, context=context, check=False, update_check=False)
172+ # check the account compatibility with the Third Party on the COR line created
173+ correction_line = self.browse(cr, uid, correction_line_id, context=context)
174+ wiz_obj._check_account_partner_compatibility(cr, uid, new_account, correction_line, context)
175 # UF-2231: Remove the update to the statement line
176 # Update register line if exists
177
178 # UFTP-119: Reverted a code that has been commented out in UF-2231 without explanation, and which caused the problem of updating back the Reg line
179 if ml.statement_id:
180- self.update_account_on_st_line(cr, uid, [ml.id], new_account_id, context=context)
181+ self.update_st_line(cr, uid, [ml.id], account_id=new_account_id, context=context)
182 # Inform old line that it have been corrected
183 self.write(cr, uid, [ml.id], {'corrected': True, 'have_an_historic': True,}, context=context, check=False, update_check=False)
184 # Post the move
185@@ -804,101 +846,11 @@
186 self.corrected_upstream_marker(cr, uid, [ml.id], context=context)
187 return success_move_line_ids
188
189- def correct_partner_id(self, cr, uid, ids, date=None, partner_id=None, context=None):
190- """
191- Correct given entries in order to change its partner_id:
192- - do a reverse line for partner line
193- - do a correction line for new partner
194- """
195- # Verifications
196- if not context:
197- context = {}
198- if isinstance(ids, (int, long)):
199- ids = [ids]
200- if not date:
201- date = strftime('%Y-%m-%d')
202- if not partner_id:
203- raise osv.except_osv(_('Error'), _('No new partner_id given!'))
204- # Prepare some values
205- j_obj = self.pool.get('account.journal')
206- move_obj = self.pool.get('account.move')
207- success_move_line_ids = []
208- # Search correction journal
209- j_corr_ids = j_obj.search(cr, uid, [('type', '=', 'correction'),
210- ('is_current_instance', '=', True)], order='id', limit=1, context=context)
211- j_corr_id = j_corr_ids and j_corr_ids[0] or False
212- # Search extra-accounting journal
213- j_extra_ids = j_obj.search(cr, uid, [('type', '=', 'extra'),
214- ('is_current_instance', '=', True)], order='id', limit=1)
215- j_extra_id = j_extra_ids and j_extra_ids[0] or False
216- # Search attached period
217- period_ids = self.pool.get('account.period').search(cr, uid, [('date_start', '<=', date), ('date_stop', '>=', date)],
218- context=context, limit=1, order='date_start, name')
219- # Correct all given move lines
220- for ml in self.browse(cr, uid, ids, context=context):
221- # Search the move line (in the move) to be changed (account that have a payable OR a receivable account)
222- move_line = None
223- for line in ml.move_id.line_id:
224- if line.account_id.type == 'payable' or line.account_id.type == 'receivable':
225- move_line = line
226- break
227- # If no move line found or move line has been corrected, continue process
228- if not move_line or move_line.corrected:
229- continue
230- # Retrieve journal. If account is inkind, so use extra-accounting journal, otherwise use correction journal
231- journal_id = j_corr_id
232- if ml.account_id.type_for_register == 'donation':
233- journal_id = j_extra_id
234- if not journal_id:
235- raise osv.except_osv(_('Error'), _('No OD-Extra Accounting Journal found!'))
236- if not journal_id:
237- raise osv.except_osv(_('Error'), _('No correction journal found!'))
238- # Create a new move
239- move_id = move_obj.create(cr, uid,{'journal_id': journal_id, 'period_id': period_ids[0], 'date': date}, context=context)
240- # Search the new attached account_id
241- partner_type = 'res.partner,%s' % partner_id
242- account_vals = self.pool.get('account.bank.statement.line').onchange_partner_type(cr, uid, [], partner_type, move_line.credit,
243- move_line.debit, context=context)
244- if not 'value' in account_vals and not account_vals.get('value').get('account_id', False):
245- raise osv.except_osv(_('Error'), _('No account found for this partner!'))
246- account_id = account_vals.get('value').get('account_id')
247- # Prepare default value for new line
248- vals = {
249- 'move_id': move_id,
250- 'date': date,
251- 'journal_id': journal_id,
252- 'period_id': period_ids[0],
253- 'source_date': ml.date,
254- }
255- # Copy the line
256- rev_line_id = self.copy(cr, uid, move_line.id, vals, context=context)
257- correction_line_id = self.copy(cr, uid, move_line.id, vals, context=context)
258- # Do the reverse
259- name = self.join_without_redundancy(move_line.name, 'REV')
260- amt = -1 * move_line.amount_currency
261- vals.update({
262- 'debit': move_line.credit,
263- 'credit': move_line.debit,
264- 'amount_currency': amt,
265- 'journal_id': journal_id,
266- 'name': name,
267- 'reversal_line_id': move_line.id,
268- 'account_id': move_line.account_id.id,
269- })
270- self.write(cr, uid, [rev_line_id], vals, context=context)
271- # Do the correction line
272- name = self.join_without_redundancy(move_line.name, 'COR')
273- self.write(cr, uid, [correction_line_id], {'name': name, 'journal_id': journal_id, 'corrected_line_id': move_line.id,
274- 'account_id': account_id, 'partner_id': partner_id, 'have_an_historic': True,}, context=context)
275- # Inform old line that it have been corrected
276- self.write(cr, uid, [move_line.id], {'corrected': True, 'have_an_historic': True,}, context=context)
277- # Post the move
278- move_obj.post(cr, uid, [move_id], context=context)
279- # Reconcile the line with its reversal
280- self.reconcile_partial(cr, uid, [line.id, rev_line_id], context=context)
281- # Add this line to succeded lines
282- success_move_line_ids.append(move_line.id)
283- return success_move_line_ids
284+ def correct_account(self, cr, uid, aml_ids, date=None, new_account_id=None, distrib_id=False, context=None):
285+ """
286+ Corrects the G/L account (only) of the amls
287+ """
288+ return self.correct_aml(cr, uid, aml_ids, date=date, new_account_id=new_account_id, distrib_id=distrib_id, context=context)
289
290 def corrected_upstream_marker(self, cr, uid, ids, context=None):
291 """
292
293=== modified file 'bin/addons/account_corrections/account_wizard_view.xml'
294--- bin/addons/account_corrections/account_wizard_view.xml 2017-10-04 08:22:01 +0000
295+++ bin/addons/account_corrections/account_wizard_view.xml 2018-10-16 13:04:48 +0000
296@@ -15,7 +15,13 @@
297 <field name="account_id"
298 domain="[('restricted_area', '=', 'correction_wizard')]"
299 attrs="{'readonly': [('is_account_correctible', '=', False)]}"
300+ on_change="onchange_correction_line_account_id(account_id, partner_type)"
301 />
302+ <field name="partner_txt_only" invisible="1"/>
303+ <field name="partner_type_mandatory" invisible="1"/>
304+ <field name="partner_type"
305+ attrs="{'required': [('partner_type_mandatory', '=', True)],
306+ 'readonly': ['|', ('partner_txt_only', '=', True), ('is_account_correctible', '=', False)]}"/>
307 <button name="button_analytic_distribution" type="object"
308 icon="terp-stock_symbol-selection" string="Ana. Distri."
309 attrs="{'invisible': [('is_analytic_target', '=', False)]}" />
310
311=== modified file 'bin/addons/account_corrections/wizard/analytic_distribution_wizard.py'
312--- bin/addons/account_corrections/wizard/analytic_distribution_wizard.py 2018-05-29 08:49:55 +0000
313+++ bin/addons/account_corrections/wizard/analytic_distribution_wizard.py 2018-10-16 13:04:48 +0000
314@@ -34,7 +34,11 @@
315 'date': fields.date(string="Date", help="This date is taken from analytic distribution corrections"),
316 'state': fields.selection([('draft', 'Draft'), ('cc', 'Cost Center only'), ('dispatch', 'All other elements'), ('done', 'Done'),
317 ('correction', 'Correction')], string="State", required=True, readonly=True),
318- 'old_account_id': fields.many2one('account.account', "New account given by correction wizard", readonly=True),
319+ 'old_account_id': fields.many2one('account.account', "Original account of the line to be corrected", readonly=True),
320+ 'old_partner_id': fields.many2one('res.partner', "Original partner of the line to be corrected", readonly=True),
321+ 'old_employee_id': fields.many2one('hr.employee', "Original employee of the line to be corrected", readonly=True),
322+ 'new_partner_id': fields.many2one('res.partner', "New partner selected in the correction wizard", readonly=True),
323+ 'new_employee_id': fields.many2one('hr.employee', "New employee selected in the correction wizard", readonly=True),
324 }
325
326 _defaults = {
327@@ -593,14 +597,14 @@
328 if to_reverse or to_override or to_create:
329 self.pool.get('account.move.line').corrected_upstream_marker(cr, uid, [ml.id], context=context)
330
331- if context and 'ji_correction_account_changed' in context:
332+ if context and 'ji_correction_account_or_tp_changed' in context:
333 if (any_reverse or to_reverse) and \
334- not context['ji_correction_account_changed']:
335+ not context['ji_correction_account_or_tp_changed']:
336 # BKLG-12 pure AD correction flag marker
337 # (do this bypassing model write)
338 return osv.osv.write(self.pool.get('account.move.line'), cr,
339 uid, [ml.id], {'last_cor_was_only_analytic': True})
340- del context['ji_correction_account_changed']
341+ del context['ji_correction_account_or_tp_changed']
342
343 def button_cancel(self, cr, uid, ids, context=None):
344 """
345@@ -643,15 +647,17 @@
346 # Do some verifications before writing elements
347 self.wizard_verifications(cr, uid, wiz.id, context=context)
348 # Verify old account and new account
349- account_changed = False
350+ account_or_tp_changed = False
351 new_account_id = wiz.account_id and wiz.account_id.id or False
352 old_account_id = wiz.old_account_id and wiz.old_account_id.id or False
353- if old_account_id != new_account_id:
354- account_changed = True
355+ new_tp = wiz.new_partner_id or wiz.new_employee_id or False
356+ old_tp = wiz.old_partner_id or wiz.old_employee_id or False
357+ if (old_account_id != new_account_id) or (new_tp != old_tp):
358+ account_or_tp_changed = True
359
360- # Account AND/OR Distribution have changed
361- context['ji_correction_account_changed'] = account_changed
362- if account_changed:
363+ # Account and/or Third Party AND/OR Distribution have changed
364+ context['ji_correction_account_or_tp_changed'] = account_or_tp_changed
365+ if account_or_tp_changed:
366 # Create new distribution
367 new_distrib_id = self.pool.get('analytic.distribution').create(cr, uid, {})
368 # Write current distribution to the new one
369
370=== modified file 'bin/addons/account_corrections/wizard/journal_items_corrections.py'
371--- bin/addons/account_corrections/wizard/journal_items_corrections.py 2018-06-21 13:48:36 +0000
372+++ bin/addons/account_corrections/wizard/journal_items_corrections.py 2018-10-16 13:04:48 +0000
373@@ -77,6 +77,132 @@
374 res[line_br.id] = False
375 return res
376
377+ def _get_third_parties(self, cr, uid, ids, field_name=None, arg=None, context=None):
378+ """
379+ Gets the right Third Parties based on:
380+ - the partner / employee of the line if any (Journal 3d Party is excluded)
381+ - or on the line account type
382+ """
383+ res = {}
384+ if context is None:
385+ context = {}
386+ for line in self.browse(cr, uid, ids, context=context):
387+ if line.employee_id:
388+ res[line.id] = {'third_parties': 'hr.employee,%s' % line.employee_id.id}
389+ res[line.id]['partner_type'] = {'options': [('hr.employee', 'Employee')],
390+ 'selection': 'hr.employee,%s' % line.employee_id.id}
391+ elif line.partner_id:
392+ res[line.id] = {'third_parties': 'res.partner,%s' % line.partner_id.id}
393+ res[line.id]['partner_type'] = {'options': [('res.partner', 'Partner')],
394+ 'selection': 'res.partner,%s' % line.partner_id.id}
395+ else:
396+ res[line.id] = {'third_parties': False}
397+ if line.account_id:
398+ acc_type = line.account_id.type_for_register
399+ if acc_type == 'advance':
400+ third_type = [('hr.employee', 'Employee')]
401+ third_selection = 'hr.employee,'
402+ elif acc_type == 'down_payment':
403+ third_type = [('res.partner', 'Partner')]
404+ third_selection = 'res.partner,'
405+ else:
406+ # by default when no restriction and for the "payroll" type
407+ third_type = [('res.partner', 'Partner'), ('hr.employee', 'Employee')]
408+ third_selection = 'res.partner,'
409+ res[line.id]['partner_type'] = {'options': third_type, 'selection': third_selection}
410+ return res
411+
412+ def _set_third_parties(self, cr, uid, obj_id, name=None, value=None, fnct_inv_arg=None, context=None):
413+ """
414+ Sets the chosen 3d Party to the wizard line (can be: a partner, an employee, or empty)
415+ """
416+ if context is None:
417+ context = {}
418+ if name == 'partner_type':
419+ employee_id = False
420+ partner_id = False
421+ element = False
422+ if value:
423+ fields = value.split(",")
424+ element = fields[0]
425+ if element == 'hr.employee':
426+ employee_id = fields[1] and int(fields[1]) or False
427+ elif element == 'res.partner':
428+ partner_id = fields[1] and int(fields[1]) or False
429+ vals = {
430+ 'employee_id': employee_id,
431+ 'partner_id': partner_id,
432+ }
433+ self.write(cr, uid, obj_id, vals, context=context)
434+ return True
435+
436+ def _get_partner_txt_only(self, cr, uid, ids, name, args, context=None):
437+ """
438+ True if the JI to be corrected has got a partner_txt without any partner/employee/transfer_journal
439+ Ex.: coordo line with an internal partner synched to HQ
440+ """
441+ res = {}
442+ if not ids:
443+ return res
444+ if isinstance(ids, (int, long)):
445+ ids = [ids]
446+ if context is None:
447+ context = {}
448+ for corr_line in self.browse(cr, uid, ids, fields_to_fetch=['move_line_id'], context=context):
449+ res[corr_line.id] = False
450+ aml = corr_line.move_line_id
451+ if aml.partner_txt and not (aml.partner_id or aml.employee_id or aml.transfer_journal_id):
452+ res[corr_line.id] = True
453+ return res
454+
455+ def onchange_correction_line_account_id(self, cr, uid, ids, account_id=False, current_tp=False):
456+ """
457+ Adapts the "Third Parties" selectable on the wizard line according to the account selected
458+ """
459+ vals = {}
460+ warning = {}
461+ if isinstance(account_id, (list, tuple)):
462+ account_id = account_id[0]
463+ acc_obj = self.pool.get('account.account')
464+ if account_id:
465+ third_type = [('res.partner', 'Partner'), ('hr.employee', 'Employee')]
466+ third_required = False
467+ third_selection = 'res.partner,0'
468+ account = acc_obj.browse(cr, uid, account_id, fields_to_fetch=['code', 'name', 'type_for_register'])
469+ acc_type = account.type_for_register
470+ if acc_type in ['transfer', 'transfer_same']: # requires a journal 3d party on which corr. are forbidden
471+ warning = {
472+ 'title': _('Warning!'),
473+ 'message': _('The account %s - %s requires a Journal Third Party.') % (account.code, account.name)
474+ }
475+ vals.update({'account_id': False}) # empty the account
476+ third_type = [('res.partner', 'Partner'), ('hr.employee', 'Employee')]
477+ third_required = False
478+ third_selection = 'res.partner,0'
479+ elif acc_type == 'advance':
480+ third_type = [('hr.employee', 'Employee')]
481+ third_required = True
482+ third_selection = 'hr.employee,0'
483+ elif acc_type == 'down_payment':
484+ third_type = [('res.partner', 'Partner')]
485+ third_required = True
486+ third_selection = 'res.partner,0'
487+ elif acc_type == 'payroll':
488+ third_type = [('res.partner', 'Partner'), ('hr.employee', 'Employee')]
489+ third_required = True
490+ third_selection = 'res.partner,0'
491+ # keep the current Third Party if it is compatible with the new account selected
492+ if current_tp:
493+ current_tp_type = current_tp.split(',')[0] # ex: 'res.partner'
494+ for th_type in third_type:
495+ if current_tp_type == th_type[0]:
496+ third_selection = current_tp
497+ continue
498+ vals.update({'partner_type_mandatory': third_required,
499+ 'partner_type': {'options': third_type,
500+ 'selection': third_selection}})
501+ return {'value': vals, 'warning': warning}
502+
503 _columns = {
504 'move_line_id': fields.many2one('account.move.line', string="Account move line", readonly=True, required=True),
505 'wizard_id': fields.many2one('wizard.journal.items.corrections', string="wizard"),
506@@ -100,12 +226,25 @@
507 'is_account_correctible': fields.function(_get_is_account_correctible,
508 type='boolean', string='Is account correctible',
509 method=True, invisible=True),
510+ 'partner_type': fields.function(_get_third_parties, fnct_inv=_set_third_parties, type='reference', method=True,
511+ string="Third Parties", readonly=False,
512+ selection=[('res.partner', 'Partner'), ('hr.employee', 'Employee')],
513+ multi="third_parties_key"),
514+ 'partner_type_mandatory': fields.boolean('Third Party Mandatory'),
515+ 'third_parties': fields.function(_get_third_parties, type='reference', method=True,
516+ string="Third Parties",
517+ selection=[('res.partner', 'Partner'), ('hr.employee', 'Employee')],
518+ help="To use for python code when registering", multi="third_parties_key"),
519+ 'partner_txt_only': fields.function(_get_partner_txt_only, type='boolean', method=True, invisible=True,
520+ string='Has a "partner_txt" without any related partner/employee/transfer journal',
521+ help="The Third Party of the line to be corrected hasn't been synched to this instance"),
522 }
523
524 _defaults = {
525 'from_donation': lambda *a: False,
526 'is_analytic_target': lambda *a: False,
527 'is_account_correctible': lambda *a: True,
528+ 'partner_type_mandatory': lambda *a: False,
529 }
530
531 def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
532@@ -152,10 +291,14 @@
533 'move_line_id': wiz.move_line_id and wiz.move_line_id.id,
534 'currency_id': currency or False,
535 'old_account_id': wiz.move_line_id and wiz.move_line_id.account_id and wiz.move_line_id.account_id.id or False,
536+ 'old_partner_id': wiz.move_line_id and wiz.move_line_id.partner_id and wiz.move_line_id.partner_id.id or False,
537+ 'old_employee_id': wiz.move_line_id and wiz.move_line_id.employee_id and wiz.move_line_id.employee_id.id or False,
538 'distribution_id': distrib_id,
539 'state': 'dispatch', # Be very careful, if this state is not applied when creating wizard => no lines displayed
540 'date': wiz.date or strftime('%Y-%m-%d'),
541 'account_id': this_line.account_id and this_line.account_id.id or False,
542+ 'new_partner_id': this_line.partner_id and this_line.partner_id.id or False,
543+ 'new_employee_id': this_line.employee_id and this_line.employee_id.id or False,
544 'document_date': wiz.move_line_id.document_date,
545 'posting_date': wiz.date or wiz.move_line_id.date,
546 }
547@@ -257,7 +400,7 @@
548 'partner_id': move_line.partner_id and move_line.partner_id.id or None,
549 'employee_id': move_line.employee_id and move_line.employee_id.id or None,
550 'transfer_journal_id': move_line.transfer_journal_id and move_line.transfer_journal_id.id or None,
551- # 'partner_type_mandatory': move_line.partner_type_mandatory or None,
552+ 'partner_type_mandatory': move_line.partner_type_mandatory or False,
553 'analytic_distribution_id': move_line.analytic_distribution_id and move_line.analytic_distribution_id.id or None,
554 }
555 self.pool.get('wizard.journal.items.corrections.lines').create(cr, uid, corrected_line_vals, context=context)
556@@ -265,14 +408,12 @@
557
558 def compare_lines(self, cr, uid, old_line_id=None, new_line_id=None, context=None):
559 """
560- Compare an account move line to a wizard journal items corrections lines regarding 3 fields:
561+ Compare an account move line to a wizard journal items corrections line regarding 2 fields:
562 - account_id (1)
563 - partner_type (partner_id, employee_id or transfer_journal_id) (2)
564- - analytic_distribution_id (4)
565 Then return the sum.
566 """
567- # Verifications
568- if not context:
569+ if context is None:
570 context = {}
571 if not old_line_id or not new_line_id:
572 raise osv.except_osv(_('Error'), _('An ID is missing!'))
573@@ -284,23 +425,12 @@
574 # Fields
575 old_account = old_line.account_id and old_line.account_id.id or False
576 new_account = new_line.account_id and new_line.account_id.id or False
577- old_partner = old_line.partner_id and old_line.partner_id.id or False
578- new_partner = new_line.partner_id and new_line.partner_id.id or False
579- old_distrib = old_line.analytic_distribution_id and old_line.analytic_distribution_id.id or False
580- new_distrib = new_line.analytic_distribution_id and new_line.analytic_distribution_id.id or False
581+ old_third_party = old_line.partner_id or old_line.employee_id or old_line.transfer_journal_id or False
582+ new_third_party = new_line.partner_id or new_line.employee_id or new_line.transfer_journal_id or False
583 if cmp(old_account, new_account):
584 res += 1
585- if cmp(old_partner, new_partner): # FIXME !!!!! or cmp(old_line.employee_id, new_line.employee_id) or
586- # cmp(old_line.register_id, new_line.register_id):
587+ if cmp(old_third_party, new_third_party):
588 res += 2
589- if cmp(old_distrib, new_distrib):
590- # UFTP-1187
591- if old_line.account_id.is_analytic_addicted and \
592- new_account.account_id.is_analytic_addicted:
593- # tolerate this diff (no +4)
594- # if we correct an account with no AD required to a new account
595- # with AD required or from AD required to no AD
596- res += 4
597 return res
598
599 # UF-2056: Delete reverse button
600@@ -330,7 +460,7 @@
601 """
602 Check the compatibility between the account and the aml Third Party: raise a warning if they are not compatible.
603 :param account: new account selected in the Correction Wizard
604- :param aml: Journal Item to be corrected
605+ :param aml: Journal Item with the Third Party to check
606 """
607 acc_obj = self.pool.get('account.account')
608 acc_type = account.type_for_register
609@@ -408,25 +538,17 @@
610 new_lines = wizard.to_be_corrected_ids
611 # compare lines
612 comparison = self.compare_lines(cr, uid, old_line.id, new_lines[0].id, context=context)
613- # Result
614- res = [] # no result yet
615- # Correct account
616- if comparison == 1:
617- self._check_account_partner_compatibility(cr, uid, new_lines[0].account_id, old_line, context)
618- res = aml_obj.correct_account(cr, uid, [old_line.id], wizard.date, new_lines[0].account_id.id, distrib_id, context=context)
619+ if 1 <= comparison <= 3: # corr. on account and 3d Party are currently handled the same way (REV/COR generated)
620+ if new_lines[0].partner_txt_only:
621+ # prevent change on 3d Party if the 3d Party of the initial line hasn't been synched to the current
622+ # instance (=> only partner_txt exists)
623+ new_tp = None
624+ else:
625+ new_tp = new_lines[0].partner_type
626+ res = aml_obj.correct_aml(cr, uid, [old_line.id], wizard.date, new_lines[0].account_id.id, distrib_id,
627+ new_third_party=new_tp, context=context)
628 if not res:
629- raise osv.except_osv(_('Error'), _('No account changed!'))
630- # Correct third parties
631- elif comparison == 2:
632- if not old_line.statement_id:
633- res = aml_obj.correct_partner_id(cr, uid, [old_line.id], wizard.date, new_lines[0].partner_id.id, context=context)
634- if not res:
635- raise osv.except_osv(_('Error'),
636- _('No partner changed! Verify that the Journal Entries attached to this line was not modify previously.'))
637- elif comparison == 4:
638- raise osv.except_osv('Warning', 'Do analytic distribution reallocation here!')
639- elif comparison in [3, 5, 7]:
640- raise osv.except_osv(_('Error'), _("You're just allowed to change ONE field amongst Account, Third Party or Analytical Distribution"))
641+ raise osv.except_osv(_('Error'), _('No change made!'))
642 else:
643 raise osv.except_osv(_('Warning'), _('No modifications seen!'))
644 return {'type': 'ir.actions.act_window_close', 'success_move_line_ids': res}
645
646=== modified file 'bin/addons/account_override/account_bank_statement.py'
647--- bin/addons/account_override/account_bank_statement.py 2016-06-13 14:57:53 +0000
648+++ bin/addons/account_override/account_bank_statement.py 2018-10-16 13:04:48 +0000
649@@ -61,7 +61,11 @@
650 _columns = {
651 'ref': fields.char('Reference', size=50), # UF-1613 - add reference field from 32 to 50 chars
652 'invoice_id': fields.many2one('account.invoice', "Invoice", required=False),
653+ # NOTE: partner_move_ids is used for old entries until US-3874. Since then, entries use partner_move_line_ids.
654 'partner_move_ids': fields.one2many('account.move', 'register_line_id', 'Payable Entries', readonly=True, required=False),
655+ 'partner_move_line_ids': fields.one2many('account.move.line', 'partner_register_line_id', 'Automated Entries',
656+ readonly=True, required=False,
657+ help="Automated entries generated for expense/income register lines linked to a partner"),
658 }
659
660 account_bank_statement_line()
661
662=== modified file 'bin/addons/account_override/account_move_line.py'
663--- bin/addons/account_override/account_move_line.py 2018-06-27 14:28:34 +0000
664+++ bin/addons/account_override/account_move_line.py 2018-10-16 13:04:48 +0000
665@@ -343,6 +343,9 @@
666 'revaluation_date': fields.datetime(string='Revaluation date'),
667 'revaluation_reference': fields.char(string='Revaluation reference', size=64,
668 help="Entry sequence of the related Revaluation Entry"),
669+ # US-3874
670+ 'partner_register_line_id': fields.many2one('account.bank.statement.line', string="Register Line", required=False, readonly=True,
671+ help="Register line to which this partner automated entry is linked"),
672 }
673
674 _defaults = {
675@@ -632,7 +635,7 @@
676 def copy(self, cr, uid, aml_id, default=None, context=None):
677 """
678 When duplicate a JI, don't copy:
679- - the link to register lines
680+ - the links to register lines
681 - the reconciliation date
682 - the unreconciliation date
683 - the old reconciliation ref (unreconcile_txt)
684@@ -645,6 +648,7 @@
685 default = {}
686 default.update({
687 'imported_invoice_line_ids': [],
688+ 'partner_register_line_id': False,
689 'reconcile_date': None,
690 'unreconcile_date': None,
691 'unreconcile_txt': '',
692
693=== modified file 'bin/addons/analytic_distribution/wizard/analytic_distribution_wizard.py'
694--- bin/addons/analytic_distribution/wizard/analytic_distribution_wizard.py 2017-09-27 12:38:56 +0000
695+++ bin/addons/analytic_distribution/wizard/analytic_distribution_wizard.py 2018-10-16 13:04:48 +0000
696@@ -1162,8 +1162,8 @@
697 correction = True
698 # AD changed at header level: all JIs should recreate AJI
699 # if an AD is set on a new line, this JI and all JIs in the same move can be valide
700- # if we change the G/L account, new JE will be created => no need to validate original JE
701- if not context.get('ji_correction_account_changed'):
702+ # if we change the G/L account or Third Party, new JE will be created => no need to validate original JE
703+ if not context.get('ji_correction_account_or_tp_changed'):
704 self.pool.get('account.move').validate(cr, uid, [move_id])
705
706 # As analytic lines were deleted and recreated, we need to recreate links between reversal, corrections, etc.
707
708=== modified file 'bin/addons/finance/cash_request.py'
709--- bin/addons/finance/cash_request.py 2017-12-14 12:43:52 +0000
710+++ bin/addons/finance/cash_request.py 2018-10-16 13:04:48 +0000
711@@ -1241,7 +1241,7 @@
712 readonly=True), # can be "Not Created" if the cheque reg. of the month is not created yet
713 'period_id': fields.function(_period_id_compute, method=True, relation='account.period',
714 type='many2one', string='Period', readonly=True, store=False),
715- 'opening_balance': fields.float('Opening Balance in register currency', readonly=True,
716+ 'opening_balance': fields.float('Starting Balance in register currency', readonly=True,
717 digits_compute=dp.get_precision('Account')),
718 'calculated_balance_booking': fields.float('Calculated Balance in register currency', readonly=True,
719 digits_compute=dp.get_precision('Account')),
720
721=== modified file 'bin/addons/finance/cash_request_view.xml'
722--- bin/addons/finance/cash_request_view.xml 2017-12-08 14:47:02 +0000
723+++ bin/addons/finance/cash_request_view.xml 2018-10-16 13:04:48 +0000
724@@ -325,7 +325,7 @@
725 <field name="journal_name"/>
726 <field name="status"/>
727 <field name="period_id"/>
728- <field name="opening_balance" sum="Total Opening Balance"/>
729+ <field name="opening_balance" sum="Total Starting Balance"/>
730 <field name="calculated_balance_booking" sum="Total Calculated Balance Booking"/>
731 <field name="cashbox_balance_booking" sum="Total Cashbox Balance Booking"/>
732 <field name="booking_currency_id"/>
733@@ -348,7 +348,7 @@
734 <field name="journal_name"/>
735 <field name="status"/>
736 <field name="period_id"/>
737- <field name="opening_balance" sum="Total Opening Balance"/>
738+ <field name="opening_balance" sum="Total Starting Balance"/>
739 <field name="calculated_balance_booking" sum="Total Calculated Balance Booking"/>
740 <field name="bank_statement_balance_booking" sum="Total Bank Statement Balance Booking"/>
741 <field name="booking_currency_id"/>
742
743=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
744--- bin/addons/msf_profile/i18n/fr_MF.po 2018-09-27 16:17:57 +0000
745+++ bin/addons/msf_profile/i18n/fr_MF.po 2018-10-16 13:04:48 +0000
746@@ -4576,8 +4576,8 @@
747
748 #. module: register_accounting
749 #: view:wizard.register.opening.confirmation:0
750-msgid "Register Opening Balance"
751-msgstr "Solde d'Ouverture du Registre"
752+msgid "Register Starting Balance"
753+msgstr "Solde Initial du Registre"
754
755 #. module: finance
756 #: code:addons/finance/cash_request.py:276
757@@ -7655,12 +7655,6 @@
758 msgstr "Taxe de Remplacement"
759
760 #. module: register_accounting
761-#: code:addons/register_accounting/account_bank_statement.py:1807
762-#, python-format
763-msgid "No purchase journal found!"
764-msgstr "No purchase journal found!"
765-
766-#. module: register_accounting
767 #: report:bank.reconciliation:0
768 #: report:cash.inventory:0
769 msgid "Register closing date:"
770@@ -12067,7 +12061,7 @@
771 #. module: register_accounting
772 #: report:bank.reconciliation:0
773 msgid "Starting Balance:"
774-msgstr "Solde d'ouverture:"
775+msgstr "Solde Initial :"
776
777 #. module: sync_so
778 #: field:purchase.order,fo_sync_date:0
779@@ -13849,8 +13843,8 @@
780 #: field:cash.request.liquidity.cash,opening_balance:0
781 #: field:cash.request.liquidity.cheque,opening_balance:0
782 #: report:addons/register_accounting/report/liquidity_position_xls.mako:330
783-msgid "Opening Balance in register currency"
784-msgstr "Solde d'Ouverture dans la devise du registre"
785+msgid "Starting Balance in register currency"
786+msgstr "Solde Initial dans la devise du registre"
787
788 #. module: kit
789 #: model:ir.model,name:kit.model_kit_selection_sale_line
790@@ -14692,7 +14686,7 @@
791 #: view:cash.request:0
792 #: view:cash.request.liquidity.bank:0
793 msgid "Total Bank Statement Balance Functional"
794-msgstr "Solde Total du Relevé Bancaire en Devise Fonc."
795+msgstr "Solde Total Registre de Banque en Devise Fonc."
796
797 #. module: sync_client
798 #: field:sync.client.rule,owner_field:0
799@@ -15951,12 +15945,6 @@
800 msgid "Apply to lines"
801 msgstr "Appliquer aux lignes"
802
803-#. module: account_corrections
804-#: code:addons/account_corrections/wizard/journal_items_corrections.py:422
805-#, python-format
806-msgid "No partner changed! Verify that the Journal Entries attached to this line was not modify previously."
807-msgstr "No partner changed! Verify that the Journal Entries attached to this line was not modify previously."
808-
809 #. module: msf_tools
810 #: code:addons/msf_tools/msf_tools.py:812
811 #, python-format
812@@ -16260,7 +16248,12 @@
813 #. module: register_accounting
814 #: report:cash.inventory:0
815 msgid "CashBox Balance:"
816-msgstr "Solde de Caisse "
817+msgstr "Solde de Caisse :"
818+
819+#. module: register_accounting
820+#: report:addons/register_accounting/report/fully_report_xls.mako:508
821+msgid "Bank Statement balance:"
822+msgstr "Solde Registre de Banque :"
823
824 #. modules: msf_outgoing, specific_rules
825 #: code:addons/msf_outgoing/wizard/picking_processor.py:952
826@@ -19629,8 +19622,15 @@
827
828 #. module: register_accounting
829 #: report:cash.inventory:0
830-msgid "Opening balance:"
831-msgstr "Solde d'ouverture: "
832+#: report:addons/register_accounting/report/fully_report_xls.mako:500
833+msgid "Starting balance:"
834+msgstr "Solde initial :"
835+
836+#. modules: register_accounting, account
837+#: report:cash.inventory:0
838+#: report:addons/account/report/account_liquidity_balance.mako:168
839+msgid "Starting balance"
840+msgstr "Solde initial"
841
842 #. module: product_attributes
843 #: field:product.product,kc_txt:0
844@@ -26919,7 +26919,7 @@
845 #. module: finance
846 #: view:cash.request.liquidity.bank:0
847 msgid "Total Bank Statement Balance Booking"
848-msgstr "Solde Total du Relevé Bancaire en Devise d'Enreg."
849+msgstr "Solde Total Registre de Banque en Devise d'Enreg."
850
851 #. module: msf_partner
852 #: view:res.partner:0
853@@ -28248,7 +28248,7 @@
854 #: field:cash.request.liquidity.bank,bank_statement_balance_functional:0
855 #: report:addons/register_accounting/report/liquidity_position_xls.mako:352
856 msgid "Bank Statement Balance in functional currency"
857-msgstr "Solde du Relevé Bancaire en devise fonctionnelle"
858+msgstr "Solde Registre de Banque en devise fonctionnelle"
859
860 #. module: msf_instance
861 #: help:res.company,instance_id:0
862@@ -30098,11 +30098,6 @@
863 msgid "Statement"
864 msgstr "Relevé"
865
866-#. module: account
867-#: field:account.bank.statement,balance_start:0
868-msgid "Starting Balance"
869-msgstr "Solde Initial"
870-
871 #. module: financing_contract
872 #: view:financing.contract.contract:0
873 msgid "Contract information"
874@@ -31135,12 +31130,6 @@
875 msgid "Allocatable"
876 msgstr "Attribuable"
877
878-#. module: account_corrections
879-#: code:addons/account_corrections/wizard/journal_items_corrections.py:426
880-#, python-format
881-msgid "You're just allowed to change ONE field amongst Account, Third Party or Analytical Distribution"
882-msgstr "Vous ne pouvez changer qu'UN champ parmi: Compte, Tiers, Allocation Analytique"
883-
884 #. module: financing_contract
885 #: report:addons/financing_contract/report/financing_interactive_xls.mako:493
886 msgid "Total Project - %used"
887@@ -31863,10 +31852,10 @@
888 msgstr "Field Order Line %s of %s has already been sourced from order. Impossible to forward the claim."
889
890 #. module: account_corrections
891-#: code:addons/account_corrections/wizard/journal_items_corrections.py:415
892+#: code:addons/account_corrections/wizard/journal_items_corrections.py:551
893 #, python-format
894-msgid "No account changed!"
895-msgstr "Pas de compte changé!"
896+msgid "No change made!"
897+msgstr "Aucun changement effectué !"
898
899 #. modules: stock_override, stock
900 #: help:stock.move,prodlot_id:0
901@@ -37215,12 +37204,6 @@
902 msgid "Chained Location Type"
903 msgstr "Type de Zone Liée"
904
905-#. module: account_corrections
906-#: code:addons/account_corrections/account_move_line.py:863
907-#, python-format
908-msgid "No account found for this partner!"
909-msgstr "Pas de compte trouvé pour ce partenaire!"
910-
911 #. module: base
912 #: selection:res.config.users,context_tz:0
913 #: selection:res.users,context_tz:0
914@@ -43540,11 +43523,12 @@
915 msgid "done - (sale.order.line)"
916 msgstr "done - (sale.order.line)"
917
918-#. modules: register_accounting, analytic_distribution
919+#. modules: register_accounting, analytic_distribution, account_override
920 #: field:analytic.distribution.wizard,register_line_id:0
921 #: view:account.bank.statement.line:0
922 #: field:wizard.transfer.with.change,absl_id:0
923 #: field:account.direct.invoice.wizard,register_line_id:0
924+#: field:account.move.line,partner_register_line_id:0
925 msgid "Register Line"
926 msgstr "Ligne de Registre"
927
928@@ -45373,12 +45357,6 @@
929 msgid "Partner Name"
930 msgstr "Nom du Partenaire"
931
932-#. module: account_corrections
933-#: code:addons/account_corrections/account_move_line.py:821
934-#, python-format
935-msgid "No new partner_id given!"
936-msgstr "Pas de nouveau partner_id fournie!"
937-
938 #. module: product_attributes
939 #: view:product.where.used:0
940 #: field:product.where.used,kit_ids:0
941@@ -57373,8 +57351,8 @@
942
943 #. module: register_accounting
944 #: help:account.bank.statement,msf_calculated_balance:0
945-msgid "Opening balance + Cash Transaction"
946-msgstr "Solde initial + Transaction en espèce"
947+msgid "Starting Balance + Cash Transactions"
948+msgstr "Solde Initial + Transactions en espèces"
949
950 #. module: msf_doc_import
951 #: model:ir.model,name:msf_doc_import.model_purchase_line_import_xml_line
952@@ -61587,8 +61565,8 @@
953
954 #. module: register_accounting
955 #: field:wizard.register.opening.confirmation,confirm_opening_balance:0
956-msgid "Do you want to open the register with the following opening balance?"
957-msgstr "Voulez-vous ouvrir le registre avec le solde d'ouverture suivant ?"
958+msgid "Do you want to open the register with the following starting balance?"
959+msgstr "Voulez-vous ouvrir le registre avec le solde initial suivant ?"
960
961 #. module: msf_outgoing
962 #: field:stock.move.memory.shipment.create,selected_weight:0
963@@ -62141,8 +62119,9 @@
964 #: view:account.bank.statement:0
965 #: view:account.bank.statement:0
966 #: field:wizard.register.opening.confirmation,opening_balance:0
967-msgid "Opening Balance"
968-msgstr "Solde d'ouverture"
969+#: field:account.bank.statement,balance_start:0
970+msgid "Starting Balance"
971+msgstr "Solde Initial"
972
973 #. module: msf_accrual
974 #: code:addons/msf_accrual/wizard/wizard_accrual_validation.py:47
975@@ -63887,10 +63866,10 @@
976 msgstr "Format exécutif 4 7,5 x 10 pouces, 190,5 x 254 mm"
977
978 #. module: register_accounting
979-#: code:addons/register_accounting/account_bank_statement.py:1827
980+#: code:addons/register_accounting/account_bank_statement.py:1821
981 #, python-format
982-msgid "The supplier seems not have an incorrect account. Please contact an accountant administrator to resolve this problem."
983-msgstr "The supplier seems not have an incorrect account. Please contact an accountant administrator to resolve this problem."
984+msgid "The supplier seems to have an incorrect account. Please contact an Accounting Administrator to solve this problem."
985+msgstr "Le fournisseur semble avoir un compte incorrect. Veuillez contacter un Administrateur Finance pour résoudre ce problème."
986
987 #. module: account_override
988 #: field:account.move.line,reconcile_txt:0
989@@ -66349,10 +66328,10 @@
990 msgstr "Rapport Destruction"
991
992 #. module: account_corrections
993-#: code:addons/account_corrections/account_move_line.py:714
994+#: code:addons/account_corrections/account_move_line.py:721
995 #, python-format
996-msgid "You cannot change the G/L account since it is used in a closed financing contract."
997-msgstr "Vous ne pouvez pas modifier le compte du Grand livre parce qu'il est utilisé dans un contrat de financement clôturé."
998+msgid "You cannot change this entry since one of its accounts is used in a closed financing contract."
999+msgstr "Vous ne pouvez pas modifier cette écriture car l'un de ses comptes est utilisé dans un contrat de financement clôturé."
1000
1001 #. modules: base_setup, unifield_setup, base
1002 #: selection:base.setup.company,country_id:0
1003@@ -68417,7 +68396,7 @@
1004 #: report:bank.reconciliation:0
1005 #: report:cash.inventory:0
1006 msgid "Gap:"
1007-msgstr "Écart"
1008+msgstr "Écart :"
1009
1010 #. module: product_asset
1011 #: view:product.asset.event:0
1012@@ -69772,11 +69751,12 @@
1013 msgid "Taxes Report"
1014 msgstr "Rapport des Taxes"
1015
1016-#. modules: account, register_accounting
1017+#. modules: account, register_accounting, account_corrections
1018 #: field:account.bank.statement.line,partner_type_mandatory:0
1019 #: field:account.move.line,partner_type_mandatory:0
1020 #: selection:account.journal.column,field:0
1021 #: field:wizard.register.import.lines,partner_type_mandatory:0
1022+#: field:wizard.journal.items.corrections.lines,partner_type_mandatory:0
1023 msgid "Third Party Mandatory"
1024 msgstr "Tiers Obligatoire"
1025
1026@@ -70334,12 +70314,6 @@
1027 msgid "Confirmed sale order lines, not yet delivered"
1028 msgstr "Confirmed sale order lines, not yet delivered"
1029
1030-#. modules: account, register_accounting
1031-#: report:addons/account/report/account_liquidity_balance.mako:168
1032-#: report:cash.inventory:0
1033-msgid "Opening balance"
1034-msgstr "Solde d'ouverture"
1035-
1036 #. module: product_attributes
1037 #: model:product.justification.code,code:product_attributes.justification_code_jme
1038 msgid "ME"
1039@@ -71081,9 +71055,14 @@
1040 msgstr "Solde de clôture"
1041
1042 #. module: register_accounting
1043-#: report:addons/register_accounting/report/fully_report_xls.mako:508
1044+#: report:addons/register_accounting/report/fully_report_xls.mako:512
1045 msgid "Closing balance:"
1046-msgstr "Solde de clôture :"
1047+msgstr "Solde de Clôture :"
1048+
1049+#. module: register_accounting
1050+#: report:addons/register_accounting/report/fully_report_xls.mako:510
1051+msgid "CashBox balance:"
1052+msgstr "Solde de Caisse :"
1053
1054 #. modules: account, finance, account_voucher, account_override, analytic, register_accounting, msf_doc_import
1055 #: report:account.account.balance:0
1056@@ -84287,7 +84266,7 @@
1057 #. module: register_accounting
1058 #: report:cash.inventory:0
1059 msgid "Theoretical balance:"
1060-msgstr "Solde théorique"
1061+msgstr "Solde théorique :"
1062
1063 #. module: msf_config_locations
1064 #: model:ir.actions.act_window,name:msf_config_locations.action_configurable_location_setup
1065@@ -89453,9 +89432,10 @@
1066 msgid "From assigned to backorder."
1067 msgstr "De attribué à reliquat de commande."
1068
1069-#. module: register_accounting
1070+#. modules: register_accounting, account_corrections
1071 #: help:account.bank.statement.line,third_parties:0
1072 #: help:account.move.line,third_parties:0
1073+#: help:wizard.journal.items.corrections.lines,third_parties:0
1074 msgid "To use for python code when registering"
1075 msgstr "A utiliser pour le code python lors de l'enregistrement"
1076
1077@@ -93062,10 +93042,10 @@
1078 msgstr "Inscrire une date de début !"
1079
1080 #. module: account_corrections
1081-#: code:addons/account_corrections/account_move_line.py:683
1082+#: code:addons/account_corrections/account_move_line.py:706
1083 #, python-format
1084-msgid "The line '%s' with new account '%s - %s' need an analytic distribution (you may have changed account from one with no AD required to a new one with AD required)."
1085-msgstr "The line '%s' with new account '%s - %s' need an analytic distribution (you may have changed account from one with no AD required to a new one with AD required)."
1086+msgid "The line '%s' with the new account '%s - %s' needs an analytic distribution (you may have changed the account from one with no AD required to a new one with AD required)."
1087+msgstr "La ligne '%s' avec le nouveau compte '%s - %s' a besoin d'une distribution analytique (il se peut que vous ayez passé la ligne d'un compte sans Distribution Analytique requise à un compte qui en requiert une)."
1088
1089 #. module: product_attributes
1090 #: field:product.international.status,no_storage:0
1091@@ -93156,7 +93136,7 @@
1092 #: field:cash.request.liquidity.bank,bank_statement_balance_booking:0
1093 #: report:addons/register_accounting/report/liquidity_position_xls.mako:339
1094 msgid "Bank Statement Balance in register currency"
1095-msgstr "Solde du Relevé Bancaire dans la devise du registre"
1096+msgstr "Solde Registre de Banque dans la devise du registre"
1097
1098 #. module: base
1099 #: selection:res.config.users,context_tz:0
1100@@ -94596,7 +94576,7 @@
1101 msgid "Additional Information"
1102 msgstr "Information Complémentaire"
1103
1104-#. modules: account, register_accounting, account_mcdb, msf_homere_interface, msf_audittrail
1105+#. modules: account, register_accounting, account_mcdb, msf_homere_interface, msf_audittrail, account_corrections
1106 #: report:combined.journals.report.pdf:0
1107 #: report:addons/account_mcdb/report/combined_journals_report.mako:226
1108 #: field:hr.payroll.msf,partner_type:0
1109@@ -94606,6 +94586,8 @@
1110 #: field:account.move.line,partner_txt:0
1111 #: field:account.move.line,partner_type:0
1112 #: field:account.move.line,third_parties:0
1113+#: field:wizard.journal.items.corrections.lines,partner_type:0
1114+#: field:wizard.journal.items.corrections.lines,third_parties:0
1115 #: report:addons/register_accounting/report/cheque_inventory_xls.mako:169
1116 #: report:addons/register_accounting/report/open_advances_xls.mako:151
1117 #: report:addons/register_accounting/report/pending_cheque_xls.mako:225
1118@@ -98071,8 +98053,8 @@
1119
1120 #. module: account_corrections
1121 #: field:analytic.distribution.wizard,old_account_id:0
1122-msgid "New account given by correction wizard"
1123-msgstr "Nouveau compte donné par l'assistant de correction "
1124+msgid "Original account of the line to be corrected"
1125+msgstr "Compte d'origine de la ligne à corriger"
1126
1127 #. module: msf_doc_import
1128 #: code:addons/msf_doc_import/account.py:139
1129@@ -98409,8 +98391,8 @@
1130 #. module: finance
1131 #: view:cash.request.liquidity.bank:0
1132 #: view:cash.request.liquidity.cash:0
1133-msgid "Total Opening Balance"
1134-msgstr "Total Solde d'Ouverture"
1135+msgid "Total Starting Balance"
1136+msgstr "Total Solde Initial"
1137
1138 #. module: product_list
1139 #: field:old.product.list.line,removal_date:0
1140@@ -101091,11 +101073,6 @@
1141 msgstr "Cmpt"
1142
1143 #. module: register_accounting
1144-#: report:addons/register_accounting/report/fully_report_xls.mako:500
1145-msgid "Starting balance:"
1146-msgstr "Solde d'ouverture:"
1147-
1148-#. module: register_accounting
1149 #: report:addons/register_accounting/report/fully_report_xls.mako:469
1150 msgid "REPORT"
1151 msgstr "RAPPORT"
1152@@ -101851,6 +101828,68 @@
1153 msgid " goods products, please refer to the appropriate procedures"
1154 msgstr " veuillez vous référer aux procédures adéquates."
1155
1156+#. module: account_corrections
1157+#: code:addons/account_corrections/wizard/journal_items_corrections.py:157
1158+#, python-format
1159+msgid "The account %s - %s requires a Journal Third Party."
1160+msgstr "Le compte %s - %s requiert un Tiers de type Journal."
1161+
1162+#. module: account_corrections
1163+#: field:wizard.journal.items.corrections.lines,partner_txt_only:0
1164+msgid "Has a \"partner_txt\" without any related partner/employee/transfer journal"
1165+msgstr "A un \"partner_txt\" sans partenaire/employé/journal de transfert associé"
1166+
1167+#. module: account_corrections
1168+#: help:wizard.journal.items.corrections.lines,partner_txt_only:0
1169+msgid "The Third Party of the line to be corrected hasn't been synched to this instance"
1170+msgstr "Le Tiers de la ligne à corriger n'a pas été synchronisé vers cette instance"
1171+
1172+#. module: account_corrections
1173+#: field:analytic.distribution.wizard,old_partner_id:0
1174+msgid "Original partner of the line to be corrected"
1175+msgstr "Partenaire d'origine de la ligne à corriger"
1176+
1177+#. module: account_corrections
1178+#: field:analytic.distribution.wizard,old_employee_id:0
1179+msgid "Original employee of the line to be corrected"
1180+msgstr "Employé d'origine de la ligne à corriger"
1181+
1182+#. module: account_corrections
1183+#: field:analytic.distribution.wizard,new_partner_id:0
1184+msgid "New partner selected in the correction wizard"
1185+msgstr "Nouveau partenaire sélectionné dans l'assistant de correction"
1186+
1187+#. module: account_corrections
1188+#: field:analytic.distribution.wizard,new_employee_id:0
1189+msgid "New employee selected in the correction wizard"
1190+msgstr "Nouvel employé sélectionné dans l'assistant de correction"
1191+
1192+#. module: register_accounting
1193+#: code:addons/register_accounting/account_bank_statement.py:1824
1194+#, python-format
1195+msgid "Journal Entry linked to the register line %s not found."
1196+msgstr "Ecriture comptable liée à la ligne de registre %s non trouvée."
1197+
1198+#. module: register_accounting
1199+#: report:addons/register_accounting/report/fully_report_xls.mako:1043
1200+msgid "Automated Entry"
1201+msgstr "Écriture Automatique"
1202+
1203+#. module: account_override
1204+#: field:account.bank.statement.line,partner_move_line_ids:0
1205+msgid "Automated Entries"
1206+msgstr "Écritures Automatiques"
1207+
1208+#. module: account_override
1209+#: help:account.bank.statement.line,partner_move_line_ids:0
1210+msgid "Automated entries generated for expense/income register lines linked to a partner"
1211+msgstr "Écritures Automatiques générées pour les lignes de registre de dépenses/produits liées à un partenaire"
1212+
1213+#. module: account_override
1214+#: help:account.move.line,partner_register_line_id:0
1215+msgid "Register line to which this partner automated entry is linked"
1216+msgstr "Ligne de registre à laquelle cette écriture automatique liée à un partenaire est rattachée"
1217+
1218 #. module: account_override
1219 #: code:addons/account_override/account.py:517
1220 #, python-format
1221
1222=== modified file 'bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv'
1223--- bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv 2018-09-06 13:44:28 +0000
1224+++ bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv 2018-10-16 13:04:48 +0000
1225@@ -81,7 +81,7 @@
1226 msf_sync_data_server.account_move,TRUE,TRUE,TRUE,FALSE,bidirectional,Bidirectional-Private,[],"['date', 'document_date', 'imported', 'journal_id/id', 'name', 'narration', 'period_id/id', 'ref', 'statement_line_ids/id', 'to_check','instance_id/id','status','employee_id/id','transfer_journal_id/id','manual_currency_id/id','block_manual_currency_id','partner_id2/id','analytic_distribution_id/id', 'register_line_id/id']",HQ + MISSION,account.move,instance_id,Account Move,Valid,,411
1227 msf_sync_data_server.account_move_line,TRUE,TRUE,TRUE,FALSE,bidirectional,Bidirectional-Private,[],"['account_id/id', 'accrual', 'analytic_account_id/id', 'analytic_distribution_id/id', 'blocked', 'cheque_number','corrected', 'credit', 'credit_currency', 'currency_id/id', 'date_created', 'date_maturity', 'debit', 'debit_currency', 'document_date', 'employee_id/id', 'have_an_historic', 'instance_id/id', 'is_addendum_line', 'is_counterpart', 'is_transfer_with_change', 'is_write_off', 'journal_id/id', 'last_cor_was_only_analytic', 'move_id/id', 'name', 'partner_id/id','partner_txt','period_id/id', 'reconcile_id/id', 'reconcile_partial_id/id', 'ref', 'reversal', 'source_date', 'statement_id/id', 'reference', 'state','transfer_journal_id/id', 'transfer_amount', 'is_downpayment', 'reconcile_date', 'is_revaluated_ok', 'unreconcile_date', 'unreconcile_txt', 'is_manually_corrected', 'is_si_refund']",HQ + MISSION,account.move.line,instance_id,Account Move Line,Valid,,412
1228 msf_sync_data_server.account_move_line_correction,TRUE,TRUE,FALSE,FALSE,bidirectional,Bidirectional-Private,"[('move_id','in',('account.move','id',[('state','=','posted')]))]","['corrected_line_id/id', 'instance_id/id', 'reversal_line_id/id']",HQ + MISSION,account.move.line,instance_id,Account Move Line Correction,Valid,,413
1229-msf_sync_data_server.account_move_line_register_line,TRUE,TRUE,FALSE,FALSE,bidirectional,Bidirectional-Private,[],"['corrected_st_line_id/id', 'instance_id/id']",MISSION,account.move.line,instance_id,Account Move Line / Register Line,Valid,,414
1230+msf_sync_data_server.account_move_line_register_line,TRUE,TRUE,FALSE,FALSE,bidirectional,Bidirectional-Private,[],"['corrected_st_line_id/id', 'instance_id/id', 'partner_register_line_id/id']",MISSION,account.move.line,instance_id,Account Move Line / Register Line,Valid,,414
1231 msf_sync_data_server.register_line_account_move_line,TRUE,TRUE,FALSE,FALSE,bidirectional,Bidirectional-Private,"[('instance_id' , 'in' , ('msf.instance' , 'id' , [('level' , '=' , 'project')])),('statement_id','in',('account.bank.statement','id',[('state','!=','draft')])),'!',('state','=','draft')]","['direct_invoice_move_id/id', 'first_move_line_id/id', 'from_import_cheque_id/id', 'imported_invoice_line_ids/id','instance_id/id', 'cash_return_move_line_id/id', 'advance_invoice_move_id/id']",MISSION,account.bank.statement.line,instance_id,Register Line / Account Move Line,Valid,,415
1232 msf_sync_data_server.account_move_state,TRUE,TRUE,FALSE,FALSE,bidirectional,Bidirectional-Private,[],"['instance_id/id', 'state']",HQ + MISSION,account.move,instance_id,Account Move State,Valid,,416
1233 msf_sync_data_server.account_move_line_corrected_upstream,TRUE,TRUE,FALSE,FALSE,bidirectional,Bidirectional-Private,[],"['corrected_upstream', 'instance_id/id']",HQ + MISSION,account.move.line,instance_id,Account Move Line Corrected Upstream,Valid,,417
1234
1235=== modified file 'bin/addons/register_accounting/account_bank_statement.py'
1236--- bin/addons/register_accounting/account_bank_statement.py 2018-08-31 07:57:21 +0000
1237+++ bin/addons/register_accounting/account_bank_statement.py 2018-10-16 13:04:48 +0000
1238@@ -1791,36 +1791,26 @@
1239 {'reference': ''}, context=context)
1240 return True
1241
1242- def do_direct_expense(self, cr, uid, st_line, context=None):
1243+ def do_direct_expense(self, cr, uid, st_line, posttype='', context=None):
1244 """
1245- Do a direct expense when the line is hard posted and content a supplier
1246+ If the statement line...
1247+ - is being hardposted
1248+ - has a Partner Third Party
1249+ - is booked on an income or expense account
1250+ ... this method creates automated entries on partner payable or receivable account (JI), adds them to the
1251+ regline JE, and returns a list of their ids that will have to be reconciled once the JE will be posted.
1252 """
1253 if context is None:
1254 context = {}
1255 if not st_line:
1256 return False
1257- # Do the treatment only if the line is hard posted and have a partner who is a supplier
1258- if st_line.state == "hard" and st_line.partner_id and st_line.account_id.user_type.code in ('expense', 'income') and \
1259+ automated_entries_ids = []
1260+ if posttype == 'hard' and st_line.partner_id and st_line.account_id.user_type.code in ('expense', 'income') and \
1261 st_line.direct_invoice is False:
1262 # Prepare some elements
1263 move_obj = self.pool.get('account.move')
1264 move_line_obj = self.pool.get('account.move.line')
1265 curr_date = time.strftime('%Y-%m-%d')
1266- journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'purchase'), ('is_current_instance', '=', True)])
1267- if not journal_ids:
1268- raise osv.except_osv(_('Error'), _('No purchase journal found!'))
1269- journal_id = journal_ids[0]
1270- # Create a move
1271- move_vals= {
1272- 'journal_id': journal_id,
1273- 'period_id': st_line.statement_id.period_id.id,
1274- 'date': st_line.date or curr_date,
1275- 'document_date': st_line.document_date or curr_date,
1276- # name removed from UF-1542 because of a bug from UF-1129
1277- #'name': 'DirectExpense/' + st_line.name,
1278- 'partner_id': st_line.partner_id.id,
1279- }
1280- move_id = move_obj.create(cr, uid, move_vals, context=context)
1281 # Create move lines
1282 account_id = False
1283 if st_line.account_id.user_type.code == 'expense':
1284@@ -1828,23 +1818,25 @@
1285 elif st_line.account_id.user_type.code == 'income':
1286 account_id = st_line.partner_id.property_account_receivable.id or False
1287 if not account_id:
1288- raise osv.except_osv(_('Warning'), _('The supplier seems not have an incorrect account. \
1289- Please contact an accountant administrator to resolve this problem.'))
1290+ raise osv.except_osv(_('Warning'), _('The supplier seems to have an incorrect account. Please contact '
1291+ 'an Accounting Administrator to solve this problem.'))
1292+ reg_move = st_line.first_move_line_id and st_line.first_move_line_id.move_id or False
1293+ if not reg_move:
1294+ raise osv.except_osv(_('Warning'),
1295+ _('Journal Entry linked to the register line %s not found.') % st_line.sequence_for_reference or '')
1296 val = {
1297 'name': st_line.name,
1298- 'date': st_line.date or curr_date,
1299- 'document_date': st_line.document_date or curr_date,
1300- 'ref': st_line.ref or st_line.sequence_for_reference,
1301- 'reference': st_line.ref or st_line.sequence_for_reference,
1302- 'move_id': move_id,
1303+ 'date': reg_move.date,
1304+ 'document_date': reg_move.document_date,
1305+ 'move_id': reg_move.id,
1306 'partner_id': st_line.partner_id.id or False,
1307 'partner_type_mandatory': True,
1308 'account_id': account_id,
1309 'credit': 0.0,
1310 'debit': 0.0,
1311 'statement_id': st_line.statement_id.id,
1312- 'journal_id': journal_id,
1313- 'period_id': st_line.statement_id.period_id.id,
1314+ 'journal_id': reg_move.journal_id.id,
1315+ 'period_id': reg_move.period_id.id,
1316 'currency_id': st_line.statement_id.currency.id,
1317 'analytic_account_id': st_line.analytic_account_id and st_line.analytic_account_id.id or False
1318 }
1319@@ -1856,18 +1848,17 @@
1320 st_line.statement_id.company_id.currency_id.id, amount, round=False, context=context)
1321 val.update({'debit': amount, 'credit': 0.0, 'amount_currency': abs(st_line.amount)})
1322 # Optimization: Add check=False because of next post() for the move
1323+ # (From US-3874: JIs are added to the regline JE to be posted right after the current method is called)
1324 move_line_debit_id = move_line_obj.create(cr, uid, val, context=context, check=False)
1325 val.update({'debit': 0.0, 'credit': amount, 'amount_currency': -abs(st_line.amount)})
1326- # Optimization: Add check=False because of next post() for the move
1327 move_line_credit_id = move_line_obj.create(cr, uid, val, context=context, check=False)
1328- # Post the move
1329- move_obj.post(cr, uid, [move_id], context=context)
1330- # Do reconciliation
1331- move_line_obj.reconcile_partial(cr, uid, [move_line_debit_id, move_line_credit_id])
1332+ # the new JIs created will have to be reconciled after the JE will be posted
1333+ automated_entries_ids.append(move_line_debit_id)
1334+ automated_entries_ids.append(move_line_credit_id)
1335 # Disable the cash return button on this line
1336 # Optimization on write() for this field
1337 self.write(cr, uid, [st_line.id], {'from_cash_return': True}, context=context)
1338- return True
1339+ return automated_entries_ids
1340
1341 def do_import_invoices_reconciliation(self, cr, uid, st_line, context=None):
1342 """
1343@@ -2092,7 +2083,8 @@
1344 state = self._get_state(cr, uid, ids, context=context).values()[0]
1345 # Verify that the statement line isn't in hard state
1346 if state == 'hard':
1347- if values.get('partner_move_ids') or values == {'from_cash_return': True} or values.get('analytic_distribution_id', False) or \
1348+ if values.get('partner_move_ids') or values.get('partner_move_line_ids') or \
1349+ values == {'from_cash_return': True} or values.get('analytic_distribution_id', False) or \
1350 (values.get('invoice_id', False) and len(values.keys()) == 2 and values.get('from_cash_return')) or \
1351 'from_correction' in context or context.get('sync_update_execution', False):
1352 res = super(account_bank_statement_line, self).write(cr, uid, ids, values, context=context)
1353@@ -2228,6 +2220,7 @@
1354 'down_payment_id': False,
1355 'cash_return_move_line_id': False, # BKLG-60
1356 'partner_move_ids': [],
1357+ 'partner_move_line_ids': [],
1358 'advance_invoice_move_id': False,
1359 'direct_invoice_move_id': False,
1360 })
1361@@ -2437,11 +2430,16 @@
1362 acc_move_obj.write(cr, uid, [x.id for x in absl.move_ids], {'state':'posted'}, context=context)
1363 acc_move_obj.write(cr, uid, [absl.invoice_id.move_id.id], {'state':'posted'}, context=context)
1364 else:
1365+ # create automated entries if need be: add the JIs to the regline JE and get the JIs to be reconciled
1366+ automated_entries_ids = self.do_direct_expense(cr, uid, absl, posttype=postype, context=context)
1367+ # post regline JE
1368 acc_move_obj.post(cr, uid, [x.id for x in absl.move_ids], context=context)
1369- # WARNING: if we don't do a browse before the "do_direct_expense", the system doesn't know that the absl state is hard post. And so the direct expense functionnality doesn't work!
1370- absl = self.browse(cr, uid, absl.id, context=context)
1371- # do a move that enable a complete supplier follow-up
1372- self.do_direct_expense(cr, uid, absl, context=context)
1373+ if automated_entries_ids:
1374+ # reconcile automated entries together
1375+ self.pool.get('account.move.line').reconcile_partial(cr, uid, automated_entries_ids, context=context)
1376+ # store them in the regline as partner_move_line_ids ("Automated Entries")
1377+ self.write(cr, uid, absl.id, {'partner_move_line_ids': [(6, 0, automated_entries_ids)]}, context=context)
1378+
1379 if previous_state == 'draft':
1380 direct_hard_post = True # UF-2316
1381 else:
1382
1383=== modified file 'bin/addons/register_accounting/account_cash_statement.py'
1384--- bin/addons/register_accounting/account_cash_statement.py 2018-06-20 13:17:44 +0000
1385+++ bin/addons/register_accounting/account_cash_statement.py 2018-10-16 13:04:48 +0000
1386@@ -254,7 +254,7 @@
1387
1388 def _msf_calculated_balance_compute(self, cr, uid, ids, field_name=None, arg=None, context=None):
1389 """
1390- Sum of opening balance (balance_start) and sum of cash transaction (total_entry_encoding)
1391+ Sum of starting balance (balance_start) and sum of cash transaction (total_entry_encoding)
1392 """
1393 if context is None:
1394 context = {}
1395@@ -263,7 +263,7 @@
1396 for st in self.browse(cr, uid, ids):
1397 amount = (st.balance_start or 0.0) + (st.total_entry_encoding or 0.0)
1398 res[st.id] = amount
1399- # Update next register opening balance
1400+ # Update next register starting balance
1401 if st.journal_id and st.journal_id.type == 'cash':
1402 next_st_ids = self.search(cr, uid, [('prev_reg_id', '=', st.id)])
1403 context.update({'update_next_reg_balance_start': True})
1404@@ -306,7 +306,7 @@
1405 'closing_gap': fields.function(_gap_compute, method=True, string='Gap'),
1406 'comments': fields.char('Comments', size=64, required=False, readonly=False),
1407 'msf_calculated_balance': fields.function(_msf_calculated_balance_compute, method=True, readonly=True, string='Calculated Balance',
1408- help="Opening balance + Cash Transaction"),
1409+ help="Starting Balance + Cash Transactions"),
1410 # Because of UTP-382, need to change store=True to FALSE for total_entry_encoding (which do not update fields at register line deletion/copy)
1411 'total_entry_encoding': fields.function(_get_sum_entry_encoding, method=True, store=False, string="Cash Transaction", help="Total cash transactions"),
1412 }
1413
1414=== modified file 'bin/addons/register_accounting/account_view.xml'
1415--- bin/addons/register_accounting/account_view.xml 2018-03-14 08:57:47 +0000
1416+++ bin/addons/register_accounting/account_view.xml 2018-10-16 13:04:48 +0000
1417@@ -342,12 +342,12 @@
1418 <field name="prev_reg_id" invisible="1"/>
1419 <group col="4" colspan="4">
1420 <field name="starting_details_ids" nolabel="1" colspan="2" attrs="{'invisible':['|',('state','!=','draft'),('prev_reg_id','!=',False)], 'readonly':['|',('state','!=','draft'),('prev_reg_id','!=',False)]}">
1421- <tree string = "Opening Balance" editable="bottom">
1422+ <tree string="Starting Balance" editable="bottom">
1423 <field name="pieces"/>
1424 <field name="number" on_change="on_change_sub(pieces,number, parent.balance_end)"/>
1425 <field name="subtotal" sum="Total"/>
1426 </tree>
1427- <form string = "Opening Balance">
1428+ <form string="Starting Balance">
1429 <field name="pieces"/>
1430 <field name="number" on_change="on_change_sub(pieces,number, parent.balance_end)"/>
1431 <field name="subtotal"/>
1432@@ -382,8 +382,8 @@
1433 <field name="closing_date" select="1" readonly="1"/>
1434 </group>
1435 <group col="2" colspan="2">
1436- <separator string="Opening Balance" colspan="4"/>
1437- <field name="balance_start" string="Opening Balance" readonly="True"/>
1438+ <separator string="Starting Balance" colspan="4"/>
1439+ <field name="balance_start" readonly="True"/>
1440 <field name="total_entry_encoding"/>
1441 <field name="msf_calculated_balance"/>
1442 <field name="open_advance_amount" attrs="{'readonly': [('state', 'not in',('draft', 'open'))]}"/>
1443@@ -798,6 +798,7 @@
1444 <field name="date" select="1" on_change="onchange_date(date)" attrs="{'readonly': ['|', ('state', '!=', 'draft'), ('prev_reg_id', '!=', False)]}"/>
1445 <field name="period_id" domain="[('state', '=', 'draft'),('special', '!=', True)]" attrs="{'readonly': ['|', ('state', '!=', 'draft'), ('prev_reg_id', '!=', False)]}"/>
1446 <field name="currency" readonly="1"/>
1447+ <field name="balance_end" string="Calculated Balance" readonly="1"/>
1448 <field name='company_id' widget="selection" groups="base.group_multi_company" invisible="1"/>
1449 <field name="virtual_id" invisible="1" readonly="1"/>
1450 <field name="prev_reg_id" invisible="1"/>
1451
1452=== modified file 'bin/addons/register_accounting/report/cash_inventory.rml'
1453--- bin/addons/register_accounting/report/cash_inventory.rml 2018-03-14 08:57:47 +0000
1454+++ bin/addons/register_accounting/report/cash_inventory.rml 2018-10-16 13:04:48 +0000
1455@@ -83,7 +83,7 @@
1456 <para style="text"><b>Cashbox</b></para>
1457 <blockTable colWidths="30mm,30mm,30mm,30mm,30mm,30mm" style="table_reconciliation_balance">
1458 <tr>
1459- <td><para style="center"><b>Opening balance</b></para></td>
1460+ <td><para style="center"><b>Starting balance</b></para></td>
1461 <td></td>
1462 <td></td>
1463 <td><para style="center"><b>Closing balance</b></para></td>
1464@@ -134,7 +134,7 @@
1465 <blockTable colWidths="90mm, 90mm" style="table_reconciliation">
1466 <tr>
1467 <td>
1468- <para>Opening balance: <b>[[ o.balance_start and o.balance_start or '0.0' ]]</b> [[ o.currency and o.currency.name or '' ]]</para>
1469+ <para>Starting balance: <b>[[ o.balance_start and o.balance_start or '0.0' ]]</b> [[ o.currency and o.currency.name or '' ]]</para>
1470 <para>Cash Transaction: <b>[[ o.total_entry_encoding and o.total_entry_encoding or '0.0' ]]</b> [[ o.currency and o.currency.name or '' ]]</para>
1471 <para>Calculated Balance: <b>[[ o.msf_calculated_balance and o.msf_calculated_balance or '0.0' ]]</b> [[ o.currency and o.currency.name or '' ]]</para>
1472 <para>Unrecorded Advances: <b>[[ o.open_advance_amount and o.open_advance_amount or '0.0' ]]</b> [[ o.currency and o.currency.name or '' ]]</para>
1473
1474=== modified file 'bin/addons/register_accounting/report/fully_report_xls.mako'
1475--- bin/addons/register_accounting/report/fully_report_xls.mako 2018-07-17 12:20:07 +0000
1476+++ bin/addons/register_accounting/report/fully_report_xls.mako 2018-10-16 13:04:48 +0000
1477@@ -503,12 +503,25 @@
1478 <Data ss:Type="Number">${o.balance_start or 0.0|x}</Data>
1479 </Cell>
1480 </Row>
1481+ <%
1482+ if o.journal_id.type == 'cash':
1483+ closing_bal_title = _('CashBox balance:')
1484+ closing_bal = o.balance_end_cash or 0.0
1485+ calculated_bal = o.msf_calculated_balance or 0.0
1486+ else:
1487+ if o.journal_id.type == 'bank':
1488+ closing_bal_title = _('Bank Statement balance:')
1489+ else:
1490+ closing_bal_title = _('Closing balance:')
1491+ closing_bal = o.balance_end_real or 0.0
1492+ calculated_bal = o.balance_end or 0.0
1493+ %>
1494 <Row ss:Height="14.5134">
1495 <Cell ss:StyleID="header_part">
1496- <Data ss:Type="String">${_('Closing balance:')|x} </Data>
1497+ <Data ss:Type="String">${closing_bal_title|x} </Data>
1498 </Cell>
1499 <Cell ss:StyleID="header_part_number">
1500- <Data ss:Type="Number">${o.balance_end_real or 0.0|x}</Data>
1501+ <Data ss:Type="Number">${closing_bal|x}</Data>
1502 </Cell>
1503 </Row>
1504 <Row ss:Height="14.5134">
1505@@ -516,7 +529,7 @@
1506 <Data ss:Type="String">${_('Calculated balance:')|x} </Data>
1507 </Cell>
1508 <Cell ss:StyleID="header_part_number">
1509- <Data ss:Type="Number">${o.balance_end or 0.0|x}</Data>
1510+ <Data ss:Type="Number">${calculated_bal|x}</Data>
1511 </Cell>
1512 </Row>
1513 <Row ss:Height="14.5134">
1514@@ -739,7 +752,7 @@
1515 </Row>
1516 % endfor
1517
1518-<!-- if there are Trade Payable Entries (automatically generated) -->
1519+<!-- if there are Trade Payable Entries (automatically generated) - until US-3874 -->
1520 <% partner_move_ids = line.partner_move_ids or False %>
1521 % if partner_move_ids:
1522 % for partner_move_id in sorted(partner_move_ids, key=lambda x: x.name):
1523@@ -874,7 +887,7 @@
1524 <Data ss:Type="String">${ana_line.general_account_id.code + ' ' + ana_line.general_account_id.name|x}</Data>
1525 </Cell>
1526 <Cell ss:StyleID="${line_color}_ana_left">
1527- <Data ss:Type="String"></Data>
1528+ <Data ss:Type="String">${ana_line.partner_txt or ''|x}</Data>
1529 </Cell>
1530 <Cell ss:StyleID="${line_color}_ana_left">
1531 <Data ss:Type="String"></Data>
1532@@ -943,7 +956,7 @@
1533 <Data ss:Type="String">${ana_line.general_account_id.code + ' ' + ana_line.general_account_id.name|x}</Data>
1534 </Cell>
1535 <Cell ss:StyleID="${line_color}_ana_left">
1536- <Data ss:Type="String"></Data>
1537+ <Data ss:Type="String">${ana_line.partner_txt or ''|x}</Data>
1538 </Cell>
1539 <Cell ss:StyleID="${line_color}_ana_left">
1540 <Data ss:Type="String"></Data>
1541@@ -1001,7 +1014,7 @@
1542 <Data ss:Type="String">${ana_line.general_account_id.code + ' ' + ana_line.general_account_id.name|x}</Data>
1543 </Cell>
1544 <Cell ss:StyleID="${line_color}_ana_left">
1545- <Data ss:Type="String"></Data>
1546+ <Data ss:Type="String">${ana_line.partner_txt or ''|x}</Data>
1547 </Cell>
1548 <Cell ss:StyleID="${line_color}_ana_left">
1549 <Data ss:Type="String"></Data>
1550@@ -1033,6 +1046,88 @@
1551 % endfor
1552 % endif
1553
1554+<!-- AUTOMATED ENTRIES linked to the register line -->
1555+<!-- Note: they are booked on accounts without AD -->
1556+<% partner_move_line_ids = line.partner_move_line_ids or [] %>
1557+% if partner_move_line_ids:
1558+ % for partner_aml in sorted(partner_move_line_ids, key=lambda x: x.partner_txt):
1559+ <Row ss:Height="14.5134">
1560+ <Cell ss:StyleID="left_bold">
1561+ <Data ss:Type="String">${_('Automated Entry')|x}</Data>
1562+ </Cell>
1563+ % if isDate(partner_aml.document_date):
1564+ <Cell ss:StyleID="date">
1565+ <Data ss:Type="DateTime">${partner_aml.document_date|n}T00:00:00.000</Data>
1566+ </Cell>
1567+ % else:
1568+ <Cell ss:StyleID="left_bold">
1569+ <Data ss:Type="String"></Data>
1570+ </Cell>
1571+ % endif
1572+ % if isDate(partner_aml.date):
1573+ <Cell ss:StyleID="date">
1574+ <Data ss:Type="DateTime">${partner_aml.date|n}T00:00:00.000</Data>
1575+ </Cell>
1576+ % else:
1577+ <Cell ss:StyleID="left_bold">
1578+ <Data ss:Type="String"></Data>
1579+ </Cell>
1580+ % endif
1581+ <Cell ss:StyleID="left_bold">
1582+ <!-- SEQUENCE -->
1583+ <Data ss:Type="String">${partner_aml.move_id.name|x}</Data>
1584+ </Cell>
1585+ <Cell ss:StyleID="left_bold">
1586+ <Data ss:Type="String">${partner_aml.name|x}</Data>
1587+ </Cell>
1588+ <Cell ss:StyleID="left_bold">
1589+ <Data ss:Type="String">${partner_aml.ref or ''|x}</Data>
1590+ </Cell>
1591+ <Cell ss:StyleID="left_bold">
1592+ <Data ss:Type="String"></Data>
1593+ </Cell>
1594+ % if o.journal_id.type == 'cheque':
1595+ <Cell ss:StyleID="left_bold">
1596+ <Data ss:Type="String"></Data>
1597+ </Cell>
1598+ % endif
1599+ <Cell ss:StyleID="left_bold">
1600+ <Data ss:Type="String">${"%s %s" % (partner_aml.account_id.code, partner_aml.account_id.name)|x}</Data>
1601+ </Cell>
1602+ <Cell ss:StyleID="left_bold">
1603+ <Data ss:Type="String">${partner_aml.partner_txt or ''|x}</Data>
1604+ </Cell>
1605+ <Cell ss:StyleID="amount_bold">
1606+ <Data ss:Type="Number">${partner_aml.credit_currency or 0.0}</Data>
1607+ </Cell>
1608+ <Cell ss:StyleID="amount_bold">
1609+ <Data ss:Type="Number">${partner_aml.debit_currency or 0.0}</Data>
1610+ </Cell>
1611+ <Cell ss:StyleID="left_bold">
1612+ <Data ss:Type="String">${_('FALSE')|x}</Data>
1613+ </Cell>
1614+ <Cell ss:StyleID="left_bold">
1615+ <Data ss:Type="String">${_('FALSE')|x}</Data>
1616+ </Cell>
1617+ <Cell ss:StyleID="left_bold">
1618+ <Data ss:Type="String">${_('FALSE')|x}</Data>
1619+ </Cell>
1620+ <Cell ss:StyleID="left_bold">
1621+ <Data ss:Type="String"></Data>
1622+ </Cell>
1623+ <Cell ss:StyleID="left_bold">
1624+ <Data ss:Type="String"></Data>
1625+ </Cell>
1626+ <Cell ss:StyleID="left_bold">
1627+ <Data ss:Type="String">${partner_aml.reconcile_id and 'X' or ''|x}</Data>
1628+ </Cell>
1629+ <Cell ss:StyleID="left_bold">
1630+ <Data ss:Type="String">${partner_aml.move_id.state and getSel(partner_aml.move_id, 'state') or ''|x}</Data>
1631+ </Cell>
1632+ </Row>
1633+ % endfor
1634+% endif
1635+
1636 % endfor
1637
1638 <!-- MANUAL ENTRIES -->
1639@@ -1129,7 +1224,7 @@
1640 <Data ss:Type="String">${"%s %s" % (manual_aal.general_account_id.code, manual_aal.general_account_id.name)|x}</Data>
1641 </Cell>
1642 <Cell ss:StyleID="${aal_color}_ana_left">
1643- <Data ss:Type="String"></Data>
1644+ <Data ss:Type="String">${manual_aal.partner_txt or ''|x}</Data>
1645 </Cell>
1646 <Cell ss:StyleID="${aal_color}_ana_left">
1647 <Data ss:Type="String"></Data>
1648@@ -1174,7 +1269,7 @@
1649 <Data ss:Type="String">${"%s %s" % (free_line.general_account_id.code, free_line.general_account_id.name)|x}</Data>
1650 </Cell>
1651 <Cell ss:StyleID="${aal_color}_ana_left">
1652- <Data ss:Type="String"></Data>
1653+ <Data ss:Type="String">${free_line.partner_txt or ''|x}</Data>
1654 </Cell>
1655 <Cell ss:StyleID="${aal_color}_ana_left">
1656 <Data ss:Type="String"></Data>
1657
1658=== modified file 'bin/addons/register_accounting/report/liquidity_position_pdf.rml'
1659--- bin/addons/register_accounting/report/liquidity_position_pdf.rml 2018-04-23 09:58:08 +0000
1660+++ bin/addons/register_accounting/report/liquidity_position_pdf.rml 2018-10-16 13:04:48 +0000
1661@@ -60,7 +60,7 @@
1662 <td><para style="text">Instance</para></td>
1663 <td><para style="text">Journal Code - Journal Name</para></td>
1664 <td><para style="text">State</para></td>
1665- <td><para style="text">Opening Balance</para></td>
1666+ <td><para style="text">Starting Balance</para></td>
1667 <td><para style="text">Calculated Balance</para></td>
1668 <td><para style="text">[[ reg_type == 'cash' and 'Cash Box Balance' or 'Bank Statement Balance']]</para></td>
1669 <td><para style="text">Reg. ccy</para></td>
1670
1671=== modified file 'bin/addons/register_accounting/report/liquidity_position_xls.mako'
1672--- bin/addons/register_accounting/report/liquidity_position_xls.mako 2018-04-23 09:58:08 +0000
1673+++ bin/addons/register_accounting/report/liquidity_position_xls.mako 2018-10-16 13:04:48 +0000
1674@@ -327,7 +327,7 @@
1675 <Data ss:Type="String">${_('Period')|x}</Data>
1676 </Cell>
1677 <Cell ss:StyleID="s34">
1678- <Data ss:Type="String">${_('Opening Balance in register currency')|x}</Data>
1679+ <Data ss:Type="String">${_('Starting Balance in register currency')|x}</Data>
1680 </Cell>
1681 <Cell ss:StyleID="s34">
1682 <Data ss:Type="String">${_('Calculated Balance in register currency')|x}</Data>
1683
1684=== modified file 'bin/addons/register_accounting/report/report_fully_report.py'
1685--- bin/addons/register_accounting/report/report_fully_report.py 2018-08-28 09:57:16 +0000
1686+++ bin/addons/register_accounting/report/report_fully_report.py 2018-10-16 13:04:48 +0000
1687@@ -237,10 +237,10 @@
1688 db = pooler.get_pool(self.cr.dbname)
1689 aji_obj = db.get('account.analytic.line')
1690 aji_ids = aji_obj.search(self.cr, self.uid, [('move_id', '=', aml.id), ('free_account', '=', free)])
1691- ajis = aji_obj.browse(self.cr, self.uid, aji_ids, context={'lang': self.localcontext.get('lang')})
1692- return [aji for aji in ajis]
1693+ # add the correction lines if any
1694+ return self.getAnalyticLines(aji_ids)
1695
1696- def getManualFreeLines(self, aml, free=False):
1697+ def getManualFreeLines(self, aml):
1698 """
1699 Returns of list of Free1/Free2 Lines linked to the manual JI in parameter
1700 """
1701
1702=== modified file 'bin/addons/register_accounting/report/report_liquidity_position.py'
1703--- bin/addons/register_accounting/report/report_liquidity_position.py 2018-04-23 10:09:26 +0000
1704+++ bin/addons/register_accounting/report/report_liquidity_position.py 2018-10-16 13:04:48 +0000
1705@@ -187,7 +187,7 @@
1706
1707 def getOpeningBalance(self, reg_type, cur):
1708 '''
1709- Returns the TOTAL of opening balance for the register type and the currency in parameters
1710+ Returns the TOTAL of starting balance for the register type and the currency in parameters
1711 '''
1712 reg_data = self.getRegisters()[reg_type]['registers']
1713 return sum([line['opening_balance'] or 0.0 for line in reg_data if line['currency'] == cur])
1714
1715=== modified file 'bin/addons/register_accounting/wizard/register_opening.py'
1716--- bin/addons/register_accounting/wizard/register_opening.py 2017-10-16 09:07:48 +0000
1717+++ bin/addons/register_accounting/wizard/register_opening.py 2018-10-16 13:04:48 +0000
1718@@ -31,8 +31,8 @@
1719
1720 def _get_opening_balance(self, cr, uid, ids, name, arg, context=None):
1721 """
1722- Returns a dict with key = id of the wizard, and value = amount of the opening balance of the related register
1723- The Opening Balance is:
1724+ Returns a dict with key = id of the wizard, and value = amount of the starting balance of the related register
1725+ The Starting Balance is:
1726 - equal to the value of "balance_start" for Bank Registers
1727 - based on the Cashbox lines for Cash Registers
1728 - always equal to 0.00 for Cheque Registers
1729@@ -60,13 +60,13 @@
1730 return self.pool.get('account.journal').get_journal_type(cr, uid, context=context)
1731
1732 _columns = {
1733- 'confirm_opening_balance': fields.boolean(string='Do you want to open the register with the following opening balance?',
1734+ 'confirm_opening_balance': fields.boolean(string='Do you want to open the register with the following starting balance?',
1735 required=False),
1736 'register_id': fields.many2one('account.bank.statement', 'Register', required=True, readonly=True),
1737 'register_type': fields.related('register_id', 'journal_id', 'type', string='Register Type', type='selection',
1738 selection=_get_journal_type, readonly=True),
1739 'opening_balance': fields.function(_get_opening_balance, method=True, type='float', readonly=True,
1740- string='Opening Balance'),
1741+ string='Starting Balance'),
1742 'confirm_opening_period': fields.boolean(string='Do you want to open the register on the following period?',
1743 required=False),
1744 'opening_period': fields.related('register_id', 'period_id', string='Opening Period', type='many2one',
1745
1746=== modified file 'bin/addons/register_accounting/wizard/register_opening.xml'
1747--- bin/addons/register_accounting/wizard/register_opening.xml 2017-10-13 08:20:44 +0000
1748+++ bin/addons/register_accounting/wizard/register_opening.xml 2018-10-16 13:04:48 +0000
1749@@ -8,7 +8,7 @@
1750 <field name='arch' type='xml'>
1751 <form string="Open Register Confirmation">
1752 <group colspan="4" attrs="{'invisible': [('register_type', '=', 'cheque')]}">
1753- <separator string="Register Opening Balance"/>
1754+ <separator string="Register Starting Balance"/>
1755 <field name="register_type" invisible="1"/>
1756 <field name="confirm_opening_balance"/>
1757 <field name="opening_balance"/>
1758
1759=== modified file 'bin/addons/register_accounting/wizard/wizard_cash_return.py'
1760--- bin/addons/register_accounting/wizard/wizard_cash_return.py 2018-07-17 14:03:52 +0000
1761+++ bin/addons/register_accounting/wizard/wizard_cash_return.py 2018-10-16 13:04:48 +0000
1762@@ -774,7 +774,9 @@
1763 if context is None:
1764 context = {}
1765 account_obj = self.pool.get('account.account')
1766+ absl_obj = self.pool.get('account.bank.statement.line')
1767 wizard = self.browse(cr, uid, ids[0], context=context)
1768+ curr_date = wizard.date
1769
1770 # US-672/2
1771 self.pool.get('account.invoice').check_accounts_for_partner(cr, uid,
1772@@ -930,35 +932,12 @@
1773 if st_currency and st_currency != wizard.advance_st_line_id.statement_id.company_id.currency_id.id:
1774 # change the amount_currency of the advance closing line in order to be negative (not done in create_move_line function)
1775 move_line_obj.write(cr, uid, [adv_closing_id], {'amount_currency': -(wizard.initial_amount + wizard.additional_amount)}, context=context)
1776- # make the move line in posted state
1777- #res_move_id = move_obj.write(cr, uid, [move_id], {'state': 'posted'}, context=context)
1778- res_move_id = move_obj.post(cr, uid, [move_id], context=context)
1779- # We create statement lines for invoices and advance closing ONLY IF the move is posted.
1780- # Verify that the posting has succeed
1781- if res_move_id == False:
1782- raise osv.except_osv(_('Error'), _('An error has occurred: The journal entries cannot be posted.'))
1783- # create the statement line for the invoices
1784- absl_obj = self.pool.get('account.bank.statement.line')
1785- curr_date = wizard.date
1786- # handle invoice lines
1787- for inv_move_line_data in inv_move_line_ids:
1788- self.create_st_line_from_move_line(cr, uid, ids, register.id, move_id, inv_move_line_data[0], invoice_id=inv_move_line_data[1], context=context)
1789- # search the invoice move line that come from invoice
1790- invoice_move_id = self.pool.get('account.invoice').read(cr, uid, inv_move_line_data[1], ['move_id'], context=context).get('move_id', None)
1791- inv_move_line_account_id = move_line_obj.read(cr, uid, inv_move_line_data[0], ['account_id'], context=context).get('account_id', None)
1792- if invoice_move_id and inv_move_line_account_id:
1793- ml_ids = move_line_obj.search(cr, uid, [('move_id', '=', invoice_move_id[0]), ('account_id', '=', inv_move_line_account_id[0])], context=context)
1794- if not ml_ids or len(ml_ids) > 1:
1795- raise osv.except_osv(_('Error'), _('An error occurred on invoice reconciliation: Invoice line not found.'))
1796- # reconcile invoice line (from cash return) with specified invoice line (from invoice)
1797- move_line_obj.reconcile_partial(cr, uid, [ml_ids[0], inv_move_line_data[0]])
1798- # handle advance lines
1799- for adv_move_line_id in adv_move_line_ids:
1800- self.create_st_line_from_move_line(cr, uid, ids, register.id, move_id, adv_move_line_id, context=context)
1801- # Have you filled in the supplier field ? If yes let's go for creating some moves for them !
1802+
1803+ # if advance lines have a Partner Third Party: create Payable Entries and add them to the advance closing JE
1804+ to_reconcile = {} # per partner
1805+ payable_lines = []
1806 if advances_with_supplier:
1807 wiz_adv_line_obj = self.pool.get('wizard.advance.line')
1808- supp_move_ids = [] # to store the ids of the account moves created
1809 # Browse suppliers
1810 for supplier_id in advances_with_supplier:
1811 total = 0.0
1812@@ -967,20 +946,11 @@
1813 data = wiz_adv_line_obj.read(cr, uid, s_id, ['amount'], context=context)
1814 if 'amount' in data:
1815 total += data.get('amount')
1816- # create the move with 2 move lines for the supplier
1817+ # create both move lines for the supplier
1818 if total > 0:
1819- # prepare the move
1820 supp_move_info = wiz_adv_line_obj.read(cr, uid, advances_with_supplier[supplier_id][0], ['description', 'document_date'], context=context)
1821 supp_move_name = supp_move_info.get('description', "/")
1822 supp_move_date = supp_move_info.get('document_date', curr_date)
1823- supp_move_vals = {
1824- 'journal_id': journal.id,
1825- 'period_id': period_id,
1826- 'date': wizard.date,
1827- 'document_date': wizard.date,
1828- #'name': supp_move_name, ## Deleted in UF-1959. Was asked since UTP-330 and UF-1542.
1829- 'partner_id': supplier_id,
1830- }
1831 # search account_id of the supplier
1832 account_id = self.pool.get('res.partner').read(cr, uid, supplier_id, ['property_account_payable'], context=context)
1833 if 'property_account_payable' in account_id and account_id.get('property_account_payable', False):
1834@@ -988,24 +958,49 @@
1835 else:
1836 raise osv.except_osv(_('Warning'), _('One supplier seems not to have a payable account. \
1837 Please contact an accountant administrator to resolve this problem.'))
1838- # Create the move
1839- supp_move_id = move_obj.create(cr, uid, supp_move_vals, context=context)
1840- supp_move_ids.append(supp_move_id)
1841 # Create move_lines
1842 supp_move_line_debit_id = self.create_move_line(cr, uid, ids, wizard.date, supp_move_date, supp_move_name, journal, register, supplier_id, False, \
1843- account_id, total, 0.0, adv_return_ref, supp_move_id, False, context=context)
1844+ account_id, total, 0.0, adv_return_ref, move_id, False, context=context)
1845 supp_move_line_credit_id = self.create_move_line(cr, uid, ids, wizard.date, supp_move_date, supp_move_name, journal, register, supplier_id, False, \
1846- account_id, 0.0, total, adv_return_ref, supp_move_id, False, context=context)
1847- # We hard post the move
1848- move_obj.post(cr, uid, [supp_move_id], context=context)
1849- # Verify that the posting has succeed
1850- if supp_move_id == False:
1851- raise osv.except_osv(_('Error'), _('An error has occurred: The journal entries cannot be posted.'))
1852- # Do reconciliation
1853- move_line_obj.reconcile_partial(cr, uid, [supp_move_line_debit_id, supp_move_line_credit_id])
1854- # Update the statement line with the partner move ids ("Payable entries")
1855- if 'statement_line_id' in context:
1856- absl_obj.write(cr, uid, context['statement_line_id'], {'partner_move_ids': [(6, 0, supp_move_ids)]}, context)
1857+ account_id, 0.0, total, adv_return_ref, move_id, False, context=context)
1858+ # mark the lines as to be reconciled, for each supplier
1859+ to_reconcile[supplier_id] = [supp_move_line_debit_id, supp_move_line_credit_id]
1860+ # store all payable lines created
1861+ payable_lines.append(supp_move_line_debit_id)
1862+ payable_lines.append(supp_move_line_credit_id)
1863+
1864+ # post the move
1865+ res_move_id = move_obj.post(cr, uid, [move_id], context=context)
1866+
1867+ # reconcile partner Payable Entries together if any
1868+ for supp_id in to_reconcile:
1869+ move_line_obj.reconcile_partial(cr, uid, to_reconcile[supp_id], context=context)
1870+
1871+ # Update the statement line with the partner_move_line_ids ("Automated entries")
1872+ if payable_lines and 'statement_line_id' in context:
1873+ absl_obj.write(cr, uid, context['statement_line_id'], {'partner_move_line_ids': [(6, 0, payable_lines)]},
1874+ context=context)
1875+
1876+ # Create statement lines for invoices and advance closing ONLY IF the move is posted
1877+ # Check that the posting has succeeded
1878+ if res_move_id == False:
1879+ raise osv.except_osv(_('Error'), _('An error has occurred: The journal entries cannot be posted.'))
1880+ # handle invoice lines
1881+ for inv_move_line_data in inv_move_line_ids:
1882+ self.create_st_line_from_move_line(cr, uid, ids, register.id, move_id, inv_move_line_data[0], invoice_id=inv_move_line_data[1], context=context)
1883+ # search the invoice move line that comes from the invoice
1884+ invoice_move_id = self.pool.get('account.invoice').read(cr, uid, inv_move_line_data[1], ['move_id'], context=context).get('move_id', None)
1885+ inv_move_line_account_id = move_line_obj.read(cr, uid, inv_move_line_data[0], ['account_id'], context=context).get('account_id', None)
1886+ if invoice_move_id and inv_move_line_account_id:
1887+ ml_ids = move_line_obj.search(cr, uid, [('move_id', '=', invoice_move_id[0]), ('account_id', '=', inv_move_line_account_id[0])], context=context)
1888+ if not ml_ids or len(ml_ids) > 1:
1889+ raise osv.except_osv(_('Error'), _('An error occurred on invoice reconciliation: Invoice line not found.'))
1890+ # reconcile invoice line (from cash return) with specified invoice line (from invoice)
1891+ move_line_obj.reconcile_partial(cr, uid, [ml_ids[0], inv_move_line_data[0]])
1892+ # handle advance lines
1893+ for adv_move_line_id in adv_move_line_ids:
1894+ self.create_st_line_from_move_line(cr, uid, ids, register.id, move_id, adv_move_line_id, context=context)
1895+
1896 # reconcile advance and advance return lines
1897 original_move_id = wizard.advance_st_line_id.move_ids[0]
1898 criteria = [('statement_id', '=', wizard.advance_st_line_id.statement_id.id), ('account_id', '=', adv_closing_acc_id), ('move_id', '=', original_move_id.id)]
1899
1900=== modified file 'bin/addons/vertical_integration/report/hq_report_ocb.py'
1901--- bin/addons/vertical_integration/report/hq_report_ocb.py 2018-09-18 07:25:26 +0000
1902+++ bin/addons/vertical_integration/report/hq_report_ocb.py 2018-10-16 13:04:48 +0000
1903@@ -678,7 +678,7 @@
1904 'query_params': (first_day_of_last_fy, last_day_of_period),
1905 },
1906 {
1907- 'headers': ['Instance', 'Code', 'Name', 'Period', 'Opening balance', 'Calculated balance', 'Closing balance', 'Currency'],
1908+ 'headers': ['Instance', 'Code', 'Name', 'Period', 'Starting balance', 'Calculated balance', 'Closing balance', 'Currency'],
1909 'filename': instance_name + '_' + year + month + '_Liquidity Balances.csv',
1910 'key': 'liquidity',
1911 'query_params': (tuple([period_yyyymm]), reg_types, first_day_of_period, reg_types, period.id, reg_types, last_day_of_period, tuple(instance_ids)),
1912
1913=== modified file 'bin/addons/vertical_integration/report/hq_report_ocg.py'
1914--- bin/addons/vertical_integration/report/hq_report_ocg.py 2018-09-18 07:25:26 +0000
1915+++ bin/addons/vertical_integration/report/hq_report_ocg.py 2018-10-16 13:04:48 +0000
1916@@ -103,7 +103,7 @@
1917 'Code',
1918 'Name',
1919 'Period',
1920- 'Opening balance',
1921+ 'Starting balance',
1922 'Calculated balance',
1923 'Closing balance',
1924 'Currency']
1925@@ -123,7 +123,7 @@
1926 'Account',
1927 'Account Name',
1928 'Period',
1929- 'Opening balance',
1930+ 'Starting balance',
1931 'Calculated balance',
1932 'Closing balance',
1933 'Booking Currency']
1934
1935=== modified file 'bin/addons/vertical_integration/report/hq_report_ocp.py'
1936--- bin/addons/vertical_integration/report/hq_report_ocp.py 2018-09-18 07:25:26 +0000
1937+++ bin/addons/vertical_integration/report/hq_report_ocp.py 2018-10-16 13:04:48 +0000
1938@@ -510,7 +510,7 @@
1939 'object': 'account.move.line',
1940 },
1941 {
1942- 'headers': ['Instance', 'Code', 'Name', 'Period', 'Opening balance', 'Calculated balance',
1943+ 'headers': ['Instance', 'Code', 'Name', 'Period', 'Starting balance', 'Calculated balance',
1944 'Closing balance', 'Currency'],
1945 'filename': liquidity_balance_filename,
1946 'key': 'liquidity',
1947@@ -520,7 +520,7 @@
1948 'fnct_params': context,
1949 },
1950 {
1951- 'headers': ['Instance', 'Account', 'Account Name', 'Period', 'Opening balance', 'Calculated balance',
1952+ 'headers': ['Instance', 'Account', 'Account Name', 'Period', 'Starting balance', 'Calculated balance',
1953 'Closing balance', 'Booking Currency'],
1954 'filename': account_balance_filename,
1955 'key': 'account_balances_per_currency',

Subscribers

People subscribed via source and target branches