mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-20 07:31:59 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
Copyright 2022 Camptocamp SA
|
||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
||||
*/
|
||||
odoo.define("pos_lot_selection.EditListPopup", function (require) {
|
||||
"use strict";
|
||||
|
||||
const EditListPopup = require("point_of_sale.EditListPopup");
|
||||
const Registries = require("point_of_sale.Registries");
|
||||
|
||||
const LotSelectEditListPopup = (OriginalEditListPopup) =>
|
||||
class extends OriginalEditListPopup {
|
||||
setup() {
|
||||
super.setup();
|
||||
if (this.props.title === this.env._t("Lot/Serial Number(s) Required")) {
|
||||
this.props.lots = this.env.session.lots;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Registries.Component.extend(EditListPopup, LotSelectEditListPopup);
|
||||
return EditListPopup;
|
||||
});
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
Copyright 2022 Camptocamp SA
|
||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
||||
*/
|
||||
odoo.define("pos_lot_selection.CustomOrderWidget", function (require) {
|
||||
"use strict";
|
||||
|
||||
const Registries = require("point_of_sale.Registries");
|
||||
const OrderWidget = require("point_of_sale.OrderWidget");
|
||||
|
||||
const CustomOrderWidget = (OriginalOrderWidget) =>
|
||||
class extends OriginalOrderWidget {
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
async _editPackLotLines(event) {
|
||||
const orderline = event.detail.orderline;
|
||||
this.env.session.lots = await this.env.pos.getProductLots(
|
||||
orderline.product
|
||||
);
|
||||
const res = await super._editPackLotLines(...arguments);
|
||||
this.env.session.lots = undefined;
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
Registries.Component.extend(OrderWidget, CustomOrderWidget);
|
||||
return OrderWidget;
|
||||
});
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
Copyright 2022 Camptocamp SA (https://www.camptocamp.com).
|
||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
*/
|
||||
odoo.define("pos_lot_selection.ProductScreen", function (require) {
|
||||
"use strict";
|
||||
|
||||
const ProductScreen = require("point_of_sale.ProductScreen");
|
||||
const Registries = require("point_of_sale.Registries");
|
||||
|
||||
const PosLotSaleProductScreen = (OriginalProductScreen) =>
|
||||
class extends OriginalProductScreen {
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
async _getAddProductOptions(product) {
|
||||
if (["serial", "lot"].includes(product.tracking)) {
|
||||
this.env.session.lots = await this.env.pos.getProductLots(product);
|
||||
}
|
||||
const res = await super._getAddProductOptions(...arguments);
|
||||
this.env.session.lots = undefined;
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
Registries.Component.extend(ProductScreen, PosLotSaleProductScreen);
|
||||
return ProductScreen;
|
||||
});
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
Copyright 2022 Camptocamp SA
|
||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
||||
*/
|
||||
odoo.define("pos_lot_selection.models", function (require) {
|
||||
"use strict";
|
||||
|
||||
const {PosGlobalState} = require("point_of_sale.models");
|
||||
const Registries = require("point_of_sale.Registries");
|
||||
|
||||
const LotSelectPosGlobalState = (OriginalPosGlobalState) =>
|
||||
class extends OriginalPosGlobalState {
|
||||
async getProductLots(product) {
|
||||
try {
|
||||
return await this.env.services.rpc(
|
||||
{
|
||||
model: "stock.lot",
|
||||
method: "get_available_lots_for_pos",
|
||||
kwargs: {
|
||||
product_id: product.id,
|
||||
company_id: this.env.session.company_id,
|
||||
},
|
||||
},
|
||||
{shadow: true}
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Registries.Model.extend(PosGlobalState, LotSelectPosGlobalState);
|
||||
return PosGlobalState;
|
||||
});
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!-- Copyright 2022 Camptocamp SA
|
||||
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). -->
|
||||
<templates id="template" xml:space="preserve">
|
||||
|
||||
<t t-inherit="point_of_sale.EditListPopup" t-inherit-mode="extension">
|
||||
<EditListInput position="attributes">
|
||||
<attribute name="lots">props.lots</attribute>
|
||||
</EditListInput>
|
||||
</t>
|
||||
|
||||
<t t-inherit="point_of_sale.EditListInput" t-inherit-mode="extension">
|
||||
<xpath expr="//input" position="attributes">
|
||||
<attribute name="list">prepared_lots</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//input" position="after">
|
||||
<datalist id="prepared_lots">
|
||||
<t t-if="props.lots">
|
||||
<option
|
||||
t-foreach="props.lots"
|
||||
t-as="lot"
|
||||
t-key="lot_index"
|
||||
t-att-value="lot"
|
||||
>
|
||||
<t t-esc="lot" />
|
||||
</option>
|
||||
</t>
|
||||
</datalist>
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
Loading…
Add table
Add a link
Reference in a new issue