Debian Codegraph @

addons/purchase_stock/static/src/stock_valuation/stock_valuation_report.js

raw symbols SCIP
1 import { _t } from "@web/core/l10n/translation";
2 import { patch } from "@web/core/utils/patch";
3
4 import { StockValuationReport } from "@stock_account/stock_valuation/stock_valuation_report";
5
6
7 patch(StockValuationReport.prototype, {
8 get accrual() {
9 const accrual = super.accrual;
10 const notInvoicedReceivedGoods = this.data.not_invoiced_received_goods;
11 notInvoicedReceivedGoods.display_name = _t("Goods Received Not Invoiced");
12 notInvoicedReceivedGoods.method = this.openPurchaseOrder.bind(this);
13 notInvoicedReceivedGoods.index = accrual.lines.length;
14 accrual.lines.push(this.data.not_invoiced_received_goods);
15 accrual.value += this.data.not_invoiced_received_goods.value;
16 this.purchaseOrderIds = notInvoicedReceivedGoods.lines.map((line) => line.id);
17 return accrual;
18 },
19
20 // Getters -----------------------------------------------------------------
21 get notInvoicedReceivedValuation() {
22 return this.formatMonetary(this.data.not_invoiced_received_goods.value);
23 },
24
25 // On Click Methods --------------------------------------------------------
26 openPurchaseOrder(line=false) {
27 const action = {
28 type: "ir.actions.act_window",
29 name: _t("Purchase Orders"),
30 res_model: "purchase.order",
31 views: [[false, "list"], [false, "form"]],
32 target: "current",
33 }
34 if (line?.id) {
35 action.views = [[false, "form"]],
36 action.res_id = line.id;
37 } else {
38 action.domain = [["id", "in", this.purchaseOrderIds]];
39 }
40 return this.actionService.doAction(action);
41 },
42 });