[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:
@@ -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));
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user