[REF] stock, stock_account: no 'at date' on layers from picking

When accessing the stock valuation layers of a done picking through the
stat button "Valuation", do not display the inventory at date button. We
guard the visibility of this button through a context key named
"no_at_date".

task-59011
This commit is contained in:
Simon Lejeune
2019-08-07 14:11:21 +00:00
parent 90c055cd35
commit b65d4d4ca0
2 changed files with 14 additions and 1 deletions
@@ -13,11 +13,19 @@ var InventoryReportListController = ListController.extend({
// Public
// -------------------------------------------------------------------------
init: function (parent, model, renderer, params) {
this.context = renderer.state.getContext();
return this._super.apply(this, arguments);
},
/**
* @override
*/
renderButtons: function ($node) {
this._super.apply(this, arguments);
if (this.context.no_at_date) {
return;
}
var $buttonToDate = $(qweb.render('InventoryReport.Buttons'));
$buttonToDate.on('click', this._onOpenWizard.bind(this));
+6 -1
View File
@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from ast import literal_eval
from odoo import models
@@ -11,5 +13,8 @@ class StockPicking(models.Model):
self.ensure_one()
domain = [('id', 'in', self.move_lines.stock_valuation_layer_ids.ids)]
action = self.env.ref('stock_account.stock_valuation_layer_action').read()[0]
return dict(action, domain=domain)
context = literal_eval(action['context'])
context.update(self.env.context)
context['not_at_date'] = True
return dict(action, domain=domain, context=context)