Skip to content

Commit 7f44b00

Browse files
committed
[MIG] pos_partner_sale_warning: Migration to 17.0
1 parent f0f97ea commit 7f44b00

File tree

6 files changed

+151
-131
lines changed

6 files changed

+151
-131
lines changed

pos_partner_sale_warning/README.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ POS Partner Sale Warnings
1717
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1818
:alt: License: AGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github
20-
:target: https://github.com/OCA/pos/tree/16.0/pos_partner_sale_warning
20+
:target: https://github.com/OCA/pos/tree/17.0/pos_partner_sale_warning
2121
:alt: OCA/pos
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/pos-16-0/pos-16-0-pos_partner_sale_warning
23+
:target: https://translation.odoo-community.org/projects/pos-17-0/pos-17-0-pos_partner_sale_warning
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/pos&target_branch=16.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/pos&target_branch=17.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -74,7 +74,7 @@ Bug Tracker
7474
Bugs are tracked on `GitHub Issues <https://github.com/OCA/pos/issues>`_.
7575
In case of trouble, please check there if your issue has already been reported.
7676
If you spotted it first, help us to smash it by providing a detailed and welcomed
77-
`feedback <https://github.com/OCA/pos/issues/new?body=module:%20pos_partner_sale_warning%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
77+
`feedback <https://github.com/OCA/pos/issues/new?body=module:%20pos_partner_sale_warning%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
7878

7979
Do not contact contributors directly about support or help with technical issues.
8080

@@ -89,10 +89,10 @@ Authors
8989
Contributors
9090
------------
9191

92-
- Cetmix <cetmix.com>
92+
- Cetmix <cetmix.com>
9393

94-
- Ivan Sokolov
95-
- Maksim Shurupov
94+
- Ivan Sokolov
95+
- Maksim Shurupov
9696

9797
Maintainers
9898
-----------
@@ -107,6 +107,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
107107
mission is to support the collaborative development of Odoo features and
108108
promote its widespread use.
109109

110-
This module is part of the `OCA/pos <https://github.com/OCA/pos/tree/16.0/pos_partner_sale_warning>`_ project on GitHub.
110+
This module is part of the `OCA/pos <https://github.com/OCA/pos/tree/17.0/pos_partner_sale_warning>`_ project on GitHub.
111111

112112
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

pos_partner_sale_warning/__manifest__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
{
55
"name": "POS Partner Sale Warnings",
6-
"version": "16.0.1.0.0",
6+
"version": "17.0.1.0.0",
77
"category": "Sales/Point of Sale",
88
"summary": "Show partner sales warning in POS",
99
"depends": ["sale_management", "point_of_sale"],
@@ -12,11 +12,11 @@
1212
"license": "AGPL-3",
1313
"data": [],
1414
"assets": {
15-
"point_of_sale.assets": [
15+
"point_of_sale._assets_pos": [
1616
"pos_partner_sale_warning/static/src/js/*.esm.js",
1717
],
1818
"web.assets_tests": [
19-
"pos_partner_sale_warning/static/src/tests/tours/PosPartnerSaleWarning.esm.tour.js",
19+
"pos_partner_sale_warning/static/src/tests/tours/PosPartnerSaleWarning.esm.js",
2020
],
2121
},
2222
"installable": True,

pos_partner_sale_warning/static/description/index.html

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<?xml version="1.0" encoding="utf-8"?>
21
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
32
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
43
<head>
@@ -9,10 +8,11 @@
98

109
/*
1110
:Author: David Goodger ([email protected])
12-
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
11+
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
1312
:Copyright: This stylesheet has been placed in the public domain.
1413
1514
Default cascading style sheet for the HTML output of Docutils.
15+
Despite the name, some widely supported CSS2 features are used.
1616
1717
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
1818
customize this style sheet.
@@ -275,7 +275,7 @@
275275
margin-left: 2em ;
276276
margin-right: 2em }
277277

278-
pre.code .ln { color: grey; } /* line numbers */
278+
pre.code .ln { color: gray; } /* line numbers */
279279
pre.code, code { background-color: #eeeeee }
280280
pre.code .comment, code .comment { color: #5C6576 }
281281
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@@ -301,7 +301,7 @@
301301
span.pre {
302302
white-space: pre }
303303

304-
span.problematic {
304+
span.problematic, pre.problematic {
305305
color: red }
306306

307307
span.section-subtitle {
@@ -369,7 +369,7 @@ <h1 class="title">POS Partner Sale Warnings</h1>
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370370
!! source digest: sha256:785171ea5bffb78bc4fdbf43155a0614913d7eca35d68963a7416c7264b5613d
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/pos/tree/16.0/pos_partner_sale_warning"><img alt="OCA/pos" src="https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/pos-16-0/pos-16-0-pos_partner_sale_warning"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/pos&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/pos/tree/17.0/pos_partner_sale_warning"><img alt="OCA/pos" src="https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/pos-17-0/pos-17-0-pos_partner_sale_warning"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/pos&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373373
<p>This module shows partner warnings when a partner is selected in POS.</p>
374374
<p><strong>Table of contents</strong></p>
375375
<div class="contents local topic" id="contents">
@@ -417,7 +417,7 @@ <h1><a class="toc-backref" href="#toc-entry-5">Bug Tracker</a></h1>
417417
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/pos/issues">GitHub Issues</a>.
418418
In case of trouble, please check there if your issue has already been reported.
419419
If you spotted it first, help us to smash it by providing a detailed and welcomed
420-
<a class="reference external" href="https://github.com/OCA/pos/issues/new?body=module:%20pos_partner_sale_warning%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
420+
<a class="reference external" href="https://github.com/OCA/pos/issues/new?body=module:%20pos_partner_sale_warning%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
421421
<p>Do not contact contributors directly about support or help with technical issues.</p>
422422
</div>
423423
<div class="section" id="credits">
@@ -441,11 +441,13 @@ <h2><a class="toc-backref" href="#toc-entry-8">Contributors</a></h2>
441441
<div class="section" id="maintainers">
442442
<h2><a class="toc-backref" href="#toc-entry-9">Maintainers</a></h2>
443443
<p>This module is maintained by the OCA.</p>
444-
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
444+
<a class="reference external image-reference" href="https://odoo-community.org">
445+
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
446+
</a>
445447
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
446448
mission is to support the collaborative development of Odoo features and
447449
promote its widespread use.</p>
448-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/pos/tree/16.0/pos_partner_sale_warning">OCA/pos</a> project on GitHub.</p>
450+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/pos/tree/17.0/pos_partner_sale_warning">OCA/pos</a> project on GitHub.</p>
449451
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
450452
</div>
451453
</div>
Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
11
/** @odoo-module **/
22

3-
import PartnerListScreen from "point_of_sale.PartnerListScreen";
4-
import Registries from "point_of_sale.Registries";
5-
import {sprintf} from "web.utils";
3+
import {ErrorPopup} from "@point_of_sale/app/errors/popups/error_popup";
4+
import {PartnerListScreen} from "@point_of_sale/app/screens/partner_list/partner_list";
5+
import {_t} from "@web/core/l10n/translation";
6+
import {patch} from "@web/core/utils/patch";
7+
import {sprintf} from "@web/core/utils/strings";
8+
import {useService} from "@web/core/utils/hooks";
69

7-
export const PartnerListScreenWarning = (PartnerListScreen) =>
8-
class extends PartnerListScreen {
9-
clickPartner(partner) {
10-
if (
11-
this.state.selectedPartner &&
12-
this.state.selectedPartner.id === partner.id
13-
) {
14-
return super.clickPartner(partner);
15-
}
16-
if (partner && partner.sale_warn && partner.sale_warn !== "no-message") {
17-
this.showPopup("ErrorPopup", {
18-
title: sprintf(this.env._t("Warning for %s"), partner.name),
19-
body: partner.sale_warn_msg,
20-
});
21-
if (partner.sale_warn === "block") {
22-
return;
23-
}
24-
}
10+
patch(PartnerListScreen.prototype, {
11+
setup() {
12+
super.setup();
13+
this.popup = useService("popup");
14+
},
15+
clickPartner(partner) {
16+
if (
17+
this.state.selectedPartner &&
18+
this.state.selectedPartner.id === partner.id
19+
) {
2520
return super.clickPartner(partner);
2621
}
27-
};
28-
29-
Registries.Component.extend(PartnerListScreen, PartnerListScreenWarning);
22+
if (partner && partner.sale_warn && partner.sale_warn !== "no-message") {
23+
this.popup.add(ErrorPopup, {
24+
title: sprintf(_t("Warning for %s"), partner.name),
25+
body: partner.sale_warn_msg,
26+
});
27+
if (partner.sale_warn === "block") {
28+
return;
29+
}
30+
}
31+
return super.clickPartner(partner);
32+
},
33+
});
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/** @odoo-module */
2+
import {registry} from "@web/core/registry";
3+
4+
const startSteps = [
5+
{
6+
content: "Test pos_partner_sale_warning: Waiting for loading to finish",
7+
trigger: "body:not(:has(.loader))",
8+
// eslint-disable-next-line no-empty-function
9+
run: () => {},
10+
},
11+
{
12+
content: "Test pos_partner_sale_warning: Close Opening cashbox popup",
13+
trigger: "div.opening-cash-control .button:contains('Open session')",
14+
},
15+
{
16+
content: "Test pos_partner_sale_warning: Click on 'Customer' Button",
17+
trigger: "button.set-partner",
18+
},
19+
{
20+
content: "Test pos_partner_sale_warning: Search partner 'Test Partner #1'",
21+
trigger: ".pos-search-bar input",
22+
run: "text 'Test Partner'",
23+
},
24+
];
25+
26+
const endSteps = [
27+
{
28+
content: "Test pos_partner_sale_warning: Open menu Point of Sale",
29+
trigger: "div.navbar-button.menu-button",
30+
run: "click",
31+
},
32+
{
33+
content:
34+
"Test pos_partner_sale_warning: Open modal confirm closing Point of Sale",
35+
trigger: "li.close-button",
36+
run: "click",
37+
},
38+
{
39+
content: "Test pos_partner_sale_warning: Confirm closing the frontend",
40+
extra_trigger: "div.popup.close-pos-popup",
41+
trigger: "button.button.highlight",
42+
run: "click",
43+
},
44+
];
45+
46+
registry.category("web_tour.tours").add("PosPartnerSaleWarning", {
47+
test: true,
48+
url: "/pos/ui",
49+
steps: () =>
50+
[
51+
...startSteps,
52+
{
53+
content: "Test pos_partner_sale_warning: Click in partner",
54+
trigger: "tr.partner-line:has(td b:contains('Test Partner #1'))",
55+
run: "click",
56+
},
57+
{
58+
content: "Test pos_partner_sale_warning: Check warning text",
59+
extra_trigger: ".modal-dialog",
60+
trigger: ".modal-dialog .title:contains('Warning for Test Partner #1')",
61+
},
62+
{
63+
content: "Test pos_partner_sale_warning: Check warning text",
64+
extra_trigger: ".modal-dialog",
65+
trigger: "main.modal-body:contains('Error Message Test Message')",
66+
// eslint-disable-next-line no-empty-function
67+
run: () => {},
68+
},
69+
{
70+
content:
71+
"Test pos_partner_sale_warning: Confirm popup click on 'Ok' Button",
72+
trigger: ".modal-dialog .modal-footer .button:contains('Ok')",
73+
run: "click",
74+
},
75+
{
76+
content: "Test pos_partner_sale_warning: Click on 'Test Partner #2'",
77+
trigger: "tr.partner-line:has(td b:contains('Test Partner #2'))",
78+
run: "click",
79+
},
80+
{
81+
content: "Test pos_partner_sale_warning: Check warning text",
82+
extra_trigger: ".modal-dialog",
83+
trigger: ".modal-dialog .title:contains('Warning for Test Partner #2')",
84+
// eslint-disable-next-line no-empty-function
85+
run: () => {},
86+
},
87+
{
88+
content: "Test pos_partner_sale_warning: Check warning text",
89+
extra_trigger: ".modal-dialog",
90+
trigger: "main.modal-body:contains('Warning Message Test Message')",
91+
// eslint-disable-next-line no-empty-function
92+
run: () => {},
93+
},
94+
{
95+
content: "Test pos_partner_sale_warning: Click on 'Customer' Button",
96+
trigger: "button.set-partner:contains('Test Partner #2')",
97+
// eslint-disable-next-line no-empty-function
98+
run: () => {},
99+
},
100+
...endSteps,
101+
].flat(),
102+
});

pos_partner_sale_warning/static/src/tests/tours/PosPartnerSaleWarning.esm.tour.js

Lines changed: 0 additions & 88 deletions
This file was deleted.

0 commit comments

Comments
 (0)