diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 181b2eff61e..5479949a2d4 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1607,7 +1607,8 @@ class AccountMove(models.Model): 'move_id': line.move_id.id, 'position': move.currency_id.position, 'digits': [69, move.currency_id.decimal_places], - 'payment_date': fields.Date.to_string(line.date), + 'date': fields.Date.to_string(line.date), + 'account_payment_id': line.payment_id.id, }) if not payments_widget_vals['content']: diff --git a/addons/account/static/src/css/account.css b/addons/account/static/src/css/account.css index 486b8225bfa..84f2a2c0863 100644 --- a/addons/account/static/src/css/account.css +++ b/addons/account/static/src/css/account.css @@ -27,16 +27,31 @@ .oe_invoice_outstanding_credits_debits { clear: both; float: right; - min-width: 350px; -} - -@media (max-width: 767.98px) { - .oe_invoice_outstanding_credits_debits { - min-width: initial; - width: 100%; - } + min-width: 260px; + padding-top: 20px; } .oe_account_terms { flex: auto !important; } + +@media (max-width: 991.98px) { + /* The purpose is to put the narration below the totals in the tab 'Invoice Lines' + instead of above for the mobile view */ + .o_form_view .oe_invoice_lines_tab { + display: flex; + flex-direction: column-reverse; + } + + .o_form_view .oe_invoice_lines_tab .oe_invoice_outstanding_credits_debits { + min-width: initial; + width: 50%; + } +} + +@media (max-width: 767.98px) { + .o_form_view .oe_invoice_lines_tab .oe_invoice_outstanding_credits_debits { + min-width: initial; + width: 100%; + } +} diff --git a/addons/account/static/src/js/account_payment_field.js b/addons/account/static/src/js/account_payment_field.js index fa56d1a1858..8fe3a9bc568 100644 --- a/addons/account/static/src/js/account_payment_field.js +++ b/addons/account/static/src/js/account_payment_field.js @@ -12,6 +12,7 @@ var _t = core._t; var ShowPaymentLineWidget = AbstractField.extend({ events: _.extend({ 'click .outstanding_credit_assign': '_onOutstandingCreditAssign', + 'click .open_account_move': '_onOpenPaymentOrMove', }, AbstractField.prototype.events), supportedFieldTypes: ['char'], @@ -36,6 +37,7 @@ var ShowPaymentLineWidget = AbstractField.extend({ * @override */ _render: function() { + this.viewAlreadyOpened = false; var self = this; var info = JSON.parse(this.value); if (!info) { @@ -62,7 +64,7 @@ var ShowPaymentLineWidget = AbstractField.extend({ var $content = $(QWeb.render('PaymentPopOver', content)); var unreconcile_button = $content.filter('.js_unreconcile_payment').on('click', self._onRemoveMoveReconcile.bind(self)); - $content.filter('.js_open_payment').on('click', self._onOpenPayment.bind(self)); + $content.filter('.js_open_payment').on('click', self._onOpenPaymentOrMove.bind(self)); return $content; }, html: true, @@ -85,23 +87,26 @@ var ShowPaymentLineWidget = AbstractField.extend({ * @override * @param {MouseEvent} event */ - _onOpenPayment: function (event) { + _onOpenPaymentOrMove: function (event) { var paymentId = parseInt($(event.target).attr('payment-id')); var moveId = parseInt($(event.target).attr('move-id')); - var res_model; + var resModel; var id; if (paymentId !== undefined && !isNaN(paymentId)){ - res_model = "account.payment"; + resModel = "account.payment"; id = paymentId; } else if (moveId !== undefined && !isNaN(moveId)){ - res_model = "account.move"; + resModel = "account.move"; id = moveId; } //Open form view of account.move with id = move_id - if (res_model && id) { + //viewAlreadyopened is a flag to prevent the user from clicking on another account.move/account.payment + //while the first one he clicked on is loading + if (!this.viewAlreadyOpened && resModel && id) { + this.viewAlreadyOpened = true; this.do_action({ type: 'ir.actions.act_window', - res_model: res_model, + res_model: resModel, res_id: id, views: [[false, 'form']], target: 'current' diff --git a/addons/account/static/src/xml/account_payment.xml b/addons/account/static/src/xml/account_payment.xml index c752f838123..01670e5b25d 100644 --- a/addons/account/static/src/xml/account_payment.xml +++ b/addons/account/static/src/xml/account_payment.xml @@ -6,7 +6,7 @@
| - Add + Add | -- + | + | - + |
Paid on | |
| Payment Journal: | +Journal: |