-
-
Notifications
You must be signed in to change notification settings - Fork 618
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] pos_lot_selection: Migration to 17.0
- Loading branch information
1 parent
273888f
commit 5f4f759
Showing
16 changed files
with
247 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,13 @@ Authors | |
* Tecnativa | ||
* Camptocamp | ||
|
||
Contributors | ||
------------ | ||
|
||
- Tecnativa | ||
- Camptocamp | ||
- Nguyen Minh Chien <[email protected]> | ||
|
||
Maintainers | ||
----------- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
- Tecnativa | ||
- Camptocamp | ||
- Nguyen Minh Chien \<<[email protected]>\> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** @odoo-module */ | ||
|
||
/* | ||
Copyright 2022 Camptocamp SA | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) | ||
*/ | ||
import {EditListPopup} from "@point_of_sale/app/store/select_lot_popup/select_lot_popup"; | ||
import {_t} from "@web/core/l10n/translation"; | ||
import {patch} from "@web/core/utils/patch"; | ||
import {session} from "@web/session"; | ||
|
||
patch(EditListPopup.prototype, { | ||
setup() { | ||
super.setup(...arguments); | ||
if (this.props.title === _t("Lot/Serial Number(s) Required")) { | ||
this.props.lots = session.lots; | ||
} | ||
}, | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** @odoo-module */ | ||
|
||
/* | ||
Copyright 2022 Camptocamp SA | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) | ||
*/ | ||
import {Orderline} from "@point_of_sale/app/store/models"; | ||
import {patch} from "@web/core/utils/patch"; | ||
import {session} from "@web/session"; | ||
|
||
patch(Orderline.prototype, { | ||
async editPackLotLines() { | ||
session.lots = await this.pos.getProductLots(this.product); | ||
const res = await super.editPackLotLines(...arguments); | ||
session.lots = undefined; | ||
return res; | ||
}, | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** @odoo-module */ | ||
|
||
/* | ||
Copyright 2022 Camptocamp SA (https://www.camptocamp.com). | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
*/ | ||
import {Product} from "@point_of_sale/app/store/models"; | ||
import {patch} from "@web/core/utils/patch"; | ||
import {session} from "@web/session"; | ||
|
||
patch(Product.prototype, { | ||
async getAddProductOptions(code) { | ||
if (["serial", "lot"].includes(this.tracking)) { | ||
session.lots = await this.pos.getProductLots(this); | ||
} | ||
const res = await super.getAddProductOptions(code); | ||
session.lots = undefined; | ||
return res; | ||
}, | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** @odoo-module */ | ||
|
||
/* | ||
Copyright 2022 Camptocamp SA | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) | ||
*/ | ||
|
||
import {PosStore} from "@point_of_sale/app/store/pos_store"; | ||
import {patch} from "@web/core/utils/patch"; | ||
import {session} from "@web/session"; | ||
|
||
patch(PosStore.prototype, { | ||
async getProductLots(product) { | ||
try { | ||
return await this.orm.silent.call( | ||
"stock.lot", | ||
"get_available_lots_for_pos", | ||
[product.id, session.user_companies.current_company] | ||
); | ||
} catch (error) { | ||
console.error(error); | ||
return []; | ||
} | ||
}, | ||
}); |
This file was deleted.
Oops, something went wrong.
67 changes: 67 additions & 0 deletions
67
pos_lot_selection/static/tests/tours/LotSelection.tour.esm.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** @odoo-module */ | ||
|
||
import * as Chrome from "@point_of_sale/../tests/tours/helpers/ChromeTourMethods"; | ||
import * as ReceiptScreen from "@point_of_sale/../tests/tours/helpers/ReceiptScreenTourMethods"; | ||
import * as PaymentScreen from "@point_of_sale/../tests/tours/helpers/PaymentScreenTourMethods"; | ||
import * as ProductScreen from "@point_of_sale/../tests/tours/helpers/ProductScreenTourMethods"; | ||
import {registry} from "@web/core/registry"; | ||
|
||
export function selectLotNumber(number) { | ||
return [ | ||
{ | ||
content: `check lot '${number}'`, | ||
trigger: ".list-line-input:first()", | ||
run: () => { | ||
const lot = $(`datalist option:contains("${number}")`); | ||
if (lot.length === 0) { | ||
throw new Error(`Lot ${number} not found`); | ||
} | ||
}, | ||
}, | ||
{ | ||
content: "set lot input", | ||
trigger: ".list-line-input:first()", | ||
run: "text " + number, | ||
}, | ||
{ | ||
content: "click validate lot number", | ||
trigger: ".popup .button.confirm", | ||
}, | ||
]; | ||
} | ||
|
||
registry.category("web_tour.tours").add("LotSelectionTour", { | ||
test: true, | ||
url: "/pos/ui", | ||
steps: () => | ||
[ | ||
ProductScreen.confirmOpeningPopup(), | ||
ProductScreen.clickHomeCategory(), | ||
ProductScreen.clickDisplayedProduct("Lot Product 1"), | ||
selectLotNumber("10120000515"), | ||
ProductScreen.selectedOrderlineHas("Lot Product 1"), | ||
ProductScreen.clickPayButton(), | ||
PaymentScreen.clickPaymentMethod("Cash"), | ||
PaymentScreen.clickValidate(), | ||
ReceiptScreen.trackingMethodIsLot(), | ||
Chrome.endTour(), | ||
].flat(), | ||
}); | ||
|
||
registry.category("web_tour.tours").add("ClickLotIconTour", { | ||
test: true, | ||
url: "/pos/ui", | ||
steps: () => | ||
[ | ||
ProductScreen.clickHomeCategory(), | ||
ProductScreen.clickDisplayedProduct("Lot Product 1"), | ||
ProductScreen.enterLotNumber("10120000515"), | ||
ProductScreen.clickLotIcon(), | ||
selectLotNumber("10120000516"), | ||
ProductScreen.clickPayButton(), | ||
PaymentScreen.clickPaymentMethod("Cash"), | ||
PaymentScreen.clickValidate(), | ||
ReceiptScreen.trackingMethodIsLot(), | ||
Chrome.endTour(), | ||
].flat(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import test_frontend |
Oops, something went wrong.