From 55c4a864683c9f6cf654bb3753f9bb99932beccc Mon Sep 17 00:00:00 2001 From: hveficent Date: Mon, 23 Dec 2019 12:52:02 +0100 Subject: [PATCH] [13.0][IMP] stock_quantity_history_location: Block location selection on Account Valuation --- .../__manifest__.py | 2 +- .../i18n/stock_quantity_history_location.pot | 7 ++++++ .../static/src/js/inventory_report.js | 23 +++++++++++++++++++ .../wizards/stock_quantity_history.py | 5 ---- .../wizards/stock_quantity_history.xml | 10 +++++++- 5 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 stock_quantity_history_location/static/src/js/inventory_report.js diff --git a/stock_quantity_history_location/__manifest__.py b/stock_quantity_history_location/__manifest__.py index 012495c..4230f79 100644 --- a/stock_quantity_history_location/__manifest__.py +++ b/stock_quantity_history_location/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Stock Quantity History Location", "summary": "Provides stock quantity by location on past date", - "version": "13.0.1.0.1", + "version": "13.0.1.1.0", "license": "AGPL-3", "author": "ForgeFlow," "Odoo Community Association (OCA)", "website": "https://github.com/OCA/stock-logistics-reporting", diff --git a/stock_quantity_history_location/i18n/stock_quantity_history_location.pot b/stock_quantity_history_location/i18n/stock_quantity_history_location.pot index c3f33ea..86435f3 100644 --- a/stock_quantity_history_location/i18n/stock_quantity_history_location.pot +++ b/stock_quantity_history_location/i18n/stock_quantity_history_location.pot @@ -18,6 +18,13 @@ msgstr "" msgid "Include child locations" msgstr "" +#. module: stock_quantity_history_location +#. openerp-web +#: code:addons/stock_quantity_history_location/static/src/js/inventory_report.js:0 +#, python-format +msgid "Inventory at Date & Location" +msgstr "" + #. module: stock_quantity_history_location #: model:ir.model.fields,field_description:stock_quantity_history_location.field_stock_quantity_history__location_id msgid "Location" diff --git a/stock_quantity_history_location/static/src/js/inventory_report.js b/stock_quantity_history_location/static/src/js/inventory_report.js new file mode 100644 index 0000000..f2e054f --- /dev/null +++ b/stock_quantity_history_location/static/src/js/inventory_report.js @@ -0,0 +1,23 @@ +odoo.define('stock.InventoryReportLocationListController', function (require) { +"use strict"; + +var core = require('web.core'); +var InventoryReportListController = require('stock.InventoryReportListController'); + +var qweb = core.qweb; +var _t = core._t; + + +var InventoryReportLocationListController = InventoryReportListController.include({ + + renderButtons: function ($node) { + this._super.apply(this, arguments); + if (this.context.no_at_date) { + return; + } + if (this.modelName === "stock.quant") { + $node.find('.o_list_buttons').find(".btn-primary").html(_t("Inventory at Date & Location")) + } + }, +}); +}); diff --git a/stock_quantity_history_location/wizards/stock_quantity_history.py b/stock_quantity_history_location/wizards/stock_quantity_history.py index 3ea6436..2d831bc 100644 --- a/stock_quantity_history_location/wizards/stock_quantity_history.py +++ b/stock_quantity_history_location/wizards/stock_quantity_history.py @@ -1,8 +1,6 @@ # Copyright 2019 ForgeFlow S.L. # Copyright 2019 Aleph Objects, Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -import ast - from odoo import fields, models @@ -17,9 +15,6 @@ class StockQuantityHistory(models.TransientModel): def open_at_date(self): action = super(StockQuantityHistory, self).open_at_date() ctx = action["context"] - if isinstance(ctx, str): - ctx = ast.literal_eval(ctx) - # If we are opening the current quants, filter by domain if self.location_id: ctx["location"] = self.location_id.id ctx["compute_child"] = self.include_child_locations diff --git a/stock_quantity_history_location/wizards/stock_quantity_history.xml b/stock_quantity_history_location/wizards/stock_quantity_history.xml index 12aa036..88b8e58 100644 --- a/stock_quantity_history_location/wizards/stock_quantity_history.xml +++ b/stock_quantity_history_location/wizards/stock_quantity_history.xml @@ -1,12 +1,20 @@ + + + Inventory Report stock.quantity.history - +