[13.0][IMP] stock_quantity_history_location: Block location selection on Account Valuation

This commit is contained in:
hveficent
2019-12-23 12:52:02 +01:00
committed by GuillemCForgeFlow
parent d040e05195
commit 55c4a86468
5 changed files with 40 additions and 7 deletions

View File

@@ -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",

View File

@@ -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"

View File

@@ -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"))
}
},
});
});

View File

@@ -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

View File

@@ -1,12 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="stock_quantity_history_location_assets_backend" name="mrp_workorder assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/stock_quantity_history_location/static/src/js/inventory_report.js"></script>
</xpath>
</template>
<record id="view_stock_quantity_history_location" model="ir.ui.view">
<field name="name">Inventory Report</field>
<field name="model">stock.quantity.history</field>
<field name="inherit_id" ref="stock.view_stock_quantity_history"/>
<field name="arch" type="xml">
<field name="inventory_datetime" position="before">
<field name="location_id"/>
<field name="location_id"
invisible="context.get('active_model') == 'stock.valuation.layer'"/>
<field name="include_child_locations"
attrs="{'invisible': [('location_id', '=', False)]}"/>
</field>