From 2b1bb387c8af89fde6fa253ed77ec25626cdd3a2 Mon Sep 17 00:00:00 2001 From: Ajmalcybrosys Date: Mon, 21 Oct 2019 08:57:07 +0530 Subject: [PATCH] [CHG] src file changed 'base_accounting_kit' --- .../static/src/js/account_asset.js | 87 +++++++++++++++++++ .../static/src/scss/account_asset.scss | 9 ++ .../views/account_asset_templates.xml | 4 +- 3 files changed, 98 insertions(+), 2 deletions(-) create mode 100644 base_accounting_kit/static/src/js/account_asset.js create mode 100644 base_accounting_kit/static/src/scss/account_asset.scss diff --git a/base_accounting_kit/static/src/js/account_asset.js b/base_accounting_kit/static/src/js/account_asset.js new file mode 100644 index 000000000..99de3180b --- /dev/null +++ b/base_accounting_kit/static/src/js/account_asset.js @@ -0,0 +1,87 @@ +odoo.define('om_account_asset.widget', function(require) { +"use strict"; + +/** + * The purpose of this widget is to shows a toggle button on depreciation and + * installment lines for posted/unposted line. When clicked, it calls the method + * create_move on the object account.asset.depreciation.line. + * Note that this widget can only work on the account.asset.depreciation.line + * model as some of its fields are harcoded. + */ + +var AbstractField = require('web.AbstractField'); +var core = require('web.core'); +var registry = require('web.field_registry'); + +var _t = core._t; + +var AccountAssetWidget = AbstractField.extend({ + events: _.extend({}, AbstractField.prototype.events, { + 'click': '_onClick', + }), + description: "", + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + /** + * @override + */ + isSet: function () { + return true; // it should always be displayed, whatever its value + }, + + //-------------------------------------------------------------------------- + // Private + //-------------------------------------------------------------------------- + + /** + * @override + * @private + */ + _render: function () { + var className = ''; + var disabled = true; + var title; + if (this.recordData.move_posted_check) { + className = 'o_is_posted'; + title = _t('Posted'); + } else if (this.recordData.move_check) { + className = 'o_unposted'; + title = _t('Accounting entries waiting for manual verification'); + } else { + disabled = false; + title = _t('Unposted'); + } + var $button = $('