From b5971e417f304306a3be4d8bd0b1fe85ec381c1d Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Fri, 10 Feb 2017 11:49:05 +0100 Subject: [PATCH 1/3] [FIX] web: hide list readonly checkbox when entering edition Forward-port of https://github.com/odoo/enterprise/commit/8a55b3f9f7a7524583effb8198c03ebf695131bd There are multiple problems with the editable view list. It should be solved once and for all in the work-in-progress master. This commit fixes a bug with readonly checkboxes. When a field is readonly, the table cell gets the "o_readonly" class which changes its style and behavior. When entering edition, the cells are hidden except the ones with this "o_readonly" class so that their style are not affected. The "o_readonly" cell content however was hidden thanks to a "color: transparent;" rule to let the form readonly field show the value. The problem is that checkboxes... are not hidden with this "color: transparent;" rule. Also, the "o_readonly" class is not toggled during edition while the readonly status could be... so the right fix would be to get rid of this "o_readonly" class and let the inline form handle the behavior, but this would affect style and possibly break unknown behavior. This fix adds rules to handle the checkbox case correctly. --- addons/web/static/src/less/list_view.less | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/less/list_view.less b/addons/web/static/src/less/list_view.less index fd8a51d96be..cb447ea0446 100644 --- a/addons/web/static/src/less/list_view.less +++ b/addons/web/static/src/less/list_view.less @@ -135,6 +135,10 @@ &.o_readonly { visibility: visible; color: transparent; + + > .o_checkbox { + visibility: hidden; + } } } } @@ -155,7 +159,7 @@ max-width: 100%; // Fix a chrome bug where badge would not break on multiple lines } - &.o_readonly { + &.o_readonly:not(.o_checkbox) { background-color: transparent; padding: 5px; } From 4bdf91a02d0a1d5d7f02491e6e8835c786751831 Mon Sep 17 00:00:00 2001 From: qdp-odoo Date: Fri, 10 Feb 2017 14:35:32 +0100 Subject: [PATCH 2/3] [FIX] account: fix 'Unreconciled' filter on account.move.line search view. This revert commit 1e67069f608985d6d889fc1f6a592938bf6308db and correctly fix the use case it was addressing (exclude lines with debit=credit=0 in the filter). --- addons/account/views/account_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml index 64472a37f50..aeef38f5ffa 100644 --- a/addons/account/views/account_view.xml +++ b/addons/account/views/account_view.xml @@ -1209,7 +1209,7 @@ - + From 765dd38ec10831a5dd9110797a1f9a3497f900fb Mon Sep 17 00:00:00 2001 From: qdp-odoo Date: Fri, 10 Feb 2017 14:57:14 +0100 Subject: [PATCH 3/3] [FIX] account: manual reconciliation wizard in batch. Several fixes are addressed in this commit: - displayed value of writeoff amount now give proper result accordingly to the selection (but that selection may still be wrong!). This is still not ideal but at least it reflects what users can see in the list selection. - exclude from the reconciliation, entries that have already the boolean 'reconciled' set to True. They shouldn't be passed to reconcile() but are still needed to balance totally the reconciliation so users have to select them. - avoid crash if no writeoff needed on batch reconcile: Even though the wizard might declare that a writeoff is needed, in batch mode it might not be the case since the reconciliation is done in multiple passes for each currency. If no write-off is needed, no write-off move is created and the code tried to add a boolean variable to a recordset and raised a fruit-salad error (mixing apples-oranges). --- addons/account/wizard/account_reconcile.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/addons/account/wizard/account_reconcile.py b/addons/account/wizard/account_reconcile.py index 3ca9d5cc47f..c0d1b29d210 100644 --- a/addons/account/wizard/account_reconcile.py +++ b/addons/account/wizard/account_reconcile.py @@ -36,7 +36,7 @@ class AccountMoveLineReconcile(models.TransientModel): credit = debit = 0 lines = self.env['account.move.line'].browse(context.get('active_ids', [])) for line in lines: - if not line.reconciled: + if not line.full_reconcile_id: credit += line.credit debit += line.debit precision = self.env.user.company_id.currency_id.decimal_places @@ -64,9 +64,13 @@ class AccountMoveLineReconcile(models.TransientModel): if aml.currency_id.id == currency: continue raise UserError(_('Operation not allowed. You can only reconcile entries that share the same secondary currency or that don\'t have one. Edit your journal items or make another selection before proceeding any further.')) + #Don't consider entrires that are already reconciled + move_lines_filtered = move_lines.filtered(lambda aml: not aml.reconciled) #Because we are making a full reconcilition in batch, we need to consider use cases as defined in the test test_manual_reconcile_wizard_opw678153 - #So we force the reconciliation in company currency only at first, then in second pass the amounts in secondary currency. - move_lines.with_context(skip_full_reconcile_check='amount_currency_excluded', manual_full_reconcile_currency=currency).reconcile() + #So we force the reconciliation in company currency only at first + move_lines_filtered.with_context(skip_full_reconcile_check='amount_currency_excluded', manual_full_reconcile_currency=currency).reconcile() + + #then in second pass the amounts in secondary currency, only if some lines are still not fully reconciled move_lines_filtered = move_lines.filtered(lambda aml: not aml.reconciled) if move_lines_filtered: move_lines_filtered.with_context(skip_full_reconcile_check='amount_currency_only', manual_full_reconcile_currency=currency).reconcile() @@ -123,13 +127,18 @@ class AccountMoveLineReconcileWriteoff(models.TransientModel): if aml.currency_id.id == currency: continue raise UserError(_('Operation not allowed. You can only reconcile entries that share the same secondary currency or that don\'t have one. Edit your journal items or make another selection before proceeding any further.')) + #Don't consider entrires that are already reconciled + move_lines_filtered = move_lines.filtered(lambda aml: not aml.reconciled) #Because we are making a full reconcilition in batch, we need to consider use cases as defined in the test test_manual_reconcile_wizard_opw678153 - #So we force the reconciliation in company currency only at first, then in second pass the amounts in secondary currency. + #So we force the reconciliation in company currency only at first, context['skip_full_reconcile_check'] = 'amount_currency_excluded' context['manual_full_reconcile_currency'] = currency - writeoff = move_lines.with_context(context).reconcile(self.writeoff_acc_id, self.journal_id) + writeoff = move_lines_filtered.with_context(context).reconcile(self.writeoff_acc_id, self.journal_id) + #then in second pass the amounts in secondary currency, only if some lines are still not fully reconciled move_lines_filtered = move_lines.filtered(lambda aml: not aml.reconciled) if move_lines_filtered: move_lines_filtered.with_context(skip_full_reconcile_check='amount_currency_only', manual_full_reconcile_currency=currency).reconcile() - (move_lines + writeoff).compute_full_after_batch_reconcile() + if not isinstance(writeoff, bool): + move_lines += writeoff + move_lines.compute_full_after_batch_reconcile() return {'type': 'ir.actions.act_window_close'}