diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-10-09 02:08:17 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-10-09 02:08:17 +0200 |
| commit | d74b4518052066446e2a1975a91ce53c745ca75a (patch) | |
| tree | c08180f88a512d15e37fbec628931f02b3825f65 /addons/account/static | |
| parent | ec162dd0cb5622ab6e56db1a63dab5f531a96f4a (diff) | |
| parent | f4105eb9c7010f8693e5d2fd20c0bd9d9cc2e483 (diff) | |
[MERGE] forward port branch 13.0 up to f4105eb9c70
Diffstat (limited to 'addons/account/static')
7 files changed, 43 insertions, 24 deletions
diff --git a/addons/account/static/src/js/account_selection.js b/addons/account/static/src/js/account_selection.js index c000d5b6fd1..a43083867d8 100644 --- a/addons/account/static/src/js/account_selection.js +++ b/addons/account/static/src/js/account_selection.js @@ -29,10 +29,17 @@ odoo.define('account.hierarchy.selection', function (require) { 'name': _('Balance Sheet'), 'children': [ {'name': _t('Assets'), 'ids': _.map(_.filter(arg, v => v['internal_group'] == 'asset'), v => v['id'])}, - {'name': _t('Liabilities'), 'ids': _.map(_.filter(arg, v => v['internal_group'] == 'liability' || v['internal_group'] == 'equity'), v => v['id'])}, - ] + {'name': _t('Liabilities'), 'ids': _.map(_.filter(arg, v => v['internal_group'] == 'liability'), v => v['id'])}, + {'name': _t('Equity'), 'ids': _.map(_.filter(arg, v => v['internal_group'] == 'equity'), v => v['id'])}, + ], + }, + { + 'name': _t('Profit & Loss'), + 'children': [ + {'name': _t('Income'), 'ids': _.map(_.filter(arg, v => v['internal_group'] == 'income'), v => v['id'])}, + {'name': _t('Expense'), 'ids': _.map(_.filter(arg, v => v['internal_group'] == 'expense'), v => v['id'])}, + ], }, - {'name': _t('Profit & Loss'), 'ids': _.map(_.filter(arg, v => v['internal_group'] == 'income' || v['internal_group'] == 'expense'), v => v['id'])}, {'name': _t('Other'), 'ids': _.map(_.filter(arg, v => !['asset', 'liability', 'equity', 'income', 'expense'].includes(v['internal_group'])), v => v['id'])}, ] }); @@ -52,7 +59,7 @@ odoo.define('account.hierarchy.selection', function (require) { var self = this; _.each(group, function(item) { var optgroup = $('<optgroup/>').attr(({ - 'label': $('<div/>').html(' '.repeat(3 * level) + item['name']).text(), + 'label': $('<div/>').html(' '.repeat(6 * level) + item['name']).text(), })) _.each(item['ids'], function(id) { var value = _.find(self.values, v => v[0] == id) diff --git a/addons/account/static/src/js/reconciliation/reconciliation_model.js b/addons/account/static/src/js/reconciliation/reconciliation_model.js index d1331087cdc..2854ac4760b 100644 --- a/addons/account/static/src/js/reconciliation/reconciliation_model.js +++ b/addons/account/static/src/js/reconciliation/reconciliation_model.js @@ -1243,6 +1243,7 @@ var StatementModel = BasicModel.extend({ matching = matching[1].replace(new RegExp('\\D' + values.decimal_separator, 'g'), ''); matching = matching.replace(values.decimal_separator, '.'); amount = parseFloat(matching); + amount = line.balance.amount > 0 ? amount : -amount; } break; case 'fixed': diff --git a/addons/account/static/src/js/reconciliation/reconciliation_renderer.js b/addons/account/static/src/js/reconciliation/reconciliation_renderer.js index 079a2632b1e..d8291ddbef7 100644 --- a/addons/account/static/src/js/reconciliation/reconciliation_renderer.js +++ b/addons/account/static/src/js/reconciliation/reconciliation_renderer.js @@ -219,7 +219,7 @@ var LineRenderer = Widget.extend(FieldManagerMixin, { 'click .accounting_view tfoot': '_onChangeTab', 'click': '_onTogglePanel', 'click .o_field_widget': '_onStopPropagation', - 'keydown .o_input': '_onStopPropagation', + 'keydown .o_input, .edit_amount_input': '_onStopPropagation', 'click .o_notebook li a': '_onChangeTab', 'click .cell': '_onEditAmount', 'change input.filter': '_onFilterChange', diff --git a/addons/account/static/src/js/section_and_note_fields_backend.js b/addons/account/static/src/js/section_and_note_fields_backend.js index 2247afdfbe3..8bece6a09ba 100644 --- a/addons/account/static/src/js/section_and_note_fields_backend.js +++ b/addons/account/static/src/js/section_and_note_fields_backend.js @@ -76,7 +76,6 @@ var SectionAndNoteListRenderer = ListRenderer.extend({ // to be sure this custom code will only impact selected fields having the widget // and not applied to any other existing ListRenderer. var SectionAndNoteFieldOne2Many = FieldOne2Many.extend({ - description: "", /** * We want to use our custom renderer for the list. * diff --git a/addons/account/static/src/js/tax_group.js b/addons/account/static/src/js/tax_group.js index ff637b15b2f..9f9efe41f38 100644 --- a/addons/account/static/src/js/tax_group.js +++ b/addons/account/static/src/js/tax_group.js @@ -32,26 +32,38 @@ odoo.define('account.tax_group', function (require) { var self = this; // Search for the first tax line with the same tax group and modify its value var line_id = self.record.data.line_ids.data.find(elem => elem.data.tax_group_id && elem.data.tax_group_id.data.id === taxGroupId); + var debitAmount = 0; var creditAmount = 0; - if (line_id.data.debit > 0) { - debitAmount = line_id.data.debit - deltaAmount; + var amount_currency = 0; + if (line_id.data.currency_id) { // If multi currency enable + if (this.record.data.type === "in_invoice") { + amount_currency = line_id.data.amount_currency - deltaAmount; + } else { + amount_currency = line_id.data.amount_currency + deltaAmount; + } } else { - creditAmount = -line_id.data.credit - deltaAmount; - } - // If debitAmount is negative, the value is added to the credit. - if (debitAmount < 0) { - creditAmount = Math.abs(debitAmount); - debitAmount = 0; - } else if (creditAmount > 0) { - debitAmount = Math.abs(creditAmount); - creditAmount = 0; + var balance = line_id.data.price_subtotal; + balance -= deltaAmount; + if (this.record.data.type === "in_invoice") { // For vendor bill + if (balance > 0) { + debitAmount = balance; + } else if (balance < 0) { + creditAmount = -balance; + } + } else { // For refund + if (balance > 0) { + creditAmount = balance; + } else if (balance < 0) { + debitAmount = -balance; + } + } } // Trigger ORM self.trigger_up('field_changed', { dataPointID: self.record.id, - changes: { line_ids: { operation: "UPDATE", id: line_id.id, data: { debit: debitAmount, credit: creditAmount } } }, // account.move change - initialEvent: { dataPointID: line_id.id, changes: { debit: debitAmount, credit: creditAmount }, }, // account.move.line change + changes: { line_ids: { operation: "UPDATE", id: line_id.id, data: { amount_currency: amount_currency, debit: debitAmount, credit: creditAmount } } }, // account.move change + initialEvent: { dataPointID: line_id.id, changes: { amount_currency: amount_currency, debit: debitAmount, credit: creditAmount }, }, // account.move.line change }); }, @@ -111,7 +123,7 @@ odoo.define('account.tax_group', function (require) { return; } var oldValue = $input.data('originalValue'); - if (newValue === oldValue) { + if (newValue === oldValue || newValue === 0) { return this._render(); } var taxGroupId = $input.parents('.oe_tax_group_editable').data('taxGroupId'); diff --git a/addons/account/static/src/xml/bills_tree_upload_views.xml b/addons/account/static/src/xml/bills_tree_upload_views.xml index 93502ee9136..adb6fdab487 100644 --- a/addons/account/static/src/xml/bills_tree_upload_views.xml +++ b/addons/account/static/src/xml/bills_tree_upload_views.xml @@ -7,8 +7,8 @@ <t t-set="multi_upload" t-value="true"/> <t t-set="fileupload_id" t-value="widget.fileUploadID"/> <t t-set="fileupload_action" t-translation="off">/web/binary/upload_attachment</t> - <input type="hidden" name="model" t-att-value="'account.move'"/> - <input type="hidden" name="id" t-att-value="0"/> + <input type="hidden" name="model" value=""/> + <input type="hidden" name="id" value="0"/> </t> </div> </t> diff --git a/addons/account/static/tests/tours/reconciliation.js b/addons/account/static/tests/tours/reconciliation.js index 6566c55e09f..f100e0d1a0e 100644 --- a/addons/account/static/tests/tours/reconciliation.js +++ b/addons/account/static/tests/tours/reconciliation.js @@ -86,11 +86,11 @@ Tour.register('bank_statement_reconciliation', { { content: "enter an account", trigger: '.o_reconciliation_line:nth-child(2) .o_field_many2one[name="account_id"] input', - run: 'text 100000' + run: 'text 151000' }, { content: "select the first account", - trigger: '.ui-autocomplete:visible li:last:contains(100000)', + trigger: '.ui-autocomplete:visible li:last:contains(151000)', }, { content: "reconcile the line with the write-off", |
