-
-
Notifications
You must be signed in to change notification settings - Fork 617
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb66c4d
commit af7c8b8
Showing
24 changed files
with
289 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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 models |
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,33 @@ | ||
# Copyright (C) 2022-Today GRAP (http://www.grap.coop) | ||
# @author Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
{ | ||
"name": "Point of Sale - Cashier Comment", | ||
"summary": "Display Customer comment in the PoS front office and allow" | ||
" to edit and save it by the cashier", | ||
"version": "16.0.1.0.0", | ||
"category": "Point of Sale", | ||
"maintainers": ["legalsylvain"], | ||
"author": "GRAP,Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/pos", | ||
"license": "AGPL-3", | ||
"depends": ["point_of_sale"], | ||
"data": [ | ||
"views/view_res_partner.xml", | ||
], | ||
"assets": { | ||
"point_of_sale.assets": [ | ||
"pos_customer_comment/static/src/css/pos_customer_comment.scss", | ||
"pos_customer_comment/static/src/xml/PartnerDetailsEdit.xml", | ||
"pos_customer_comment/static/src/xml/PartnerLine.xml", | ||
], | ||
"web.assets_tests": [ | ||
"pos_customer_comment/tests/tours/PosCustomerComment.tour.js", | ||
], | ||
}, | ||
"demo": [ | ||
"demo/res_partner.xml", | ||
], | ||
"installable": True, | ||
} |
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,13 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- | ||
Copyright (C) 2022-Today GRAP (http://www.grap.coop) | ||
@author Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
--> | ||
<odoo> | ||
<record id="base.res_partner_address_31" model="res.partner"> | ||
<field | ||
name="pos_comment" | ||
>Important information to display in Point of Sale</field> | ||
</record> | ||
</odoo> |
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,2 @@ | ||
from . import pos_session | ||
from . import res_partner |
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,14 @@ | ||
# Copyright (C) 2022-Today GRAP (http://www.grap.coop) | ||
# @author Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from odoo import models | ||
|
||
|
||
class PosSession(models.Model): | ||
_inherit = "pos.session" | ||
|
||
def _loader_params_res_partner(self): | ||
res = super()._loader_params_res_partner() | ||
res["search_params"]["fields"].append("pos_comment") | ||
return res |
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,15 @@ | ||
# Copyright (C) 2022-Today GRAP (http://www.grap.coop) | ||
# @author Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class ResPartner(models.Model): | ||
_inherit = "res.partner" | ||
|
||
pos_comment = fields.Text( | ||
string="Cashier Comment", | ||
help="Comment that will be visible and editable in the" | ||
" Point of Sale for the cashiers", | ||
) |
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 @@ | ||
* Sylvain LE GAL (https://twitter.com/legalsylvain) |
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 @@ | ||
The development of this module has been financially supported by: | ||
|
||
* UGESS, Union Nationale des Groupements des épiceries Sociales et Solidaires (https://ugess.org/) |
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,2 @@ | ||
This module extends the functionality of point of sale module, to allow display and edit | ||
customer note field in the point of sale UI for the cashier. |
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 @@ | ||
For the time being, there is no HTML widget available in the point of sale. | ||
For that reason, the Cashier comment (``pos_comment``) is a simple Text field. | ||
If a widget is available in odoo, it could be great to switch to a HTML field text. |
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,14 @@ | ||
* Go to your partner view and write or edit new PoS comments | ||
|
||
.. figure:: ../static/description/res_partner_form.png | ||
|
||
* Then Open your Point of sale | ||
|
||
in the customer tree view, a new icon is available to mention that the customer | ||
has a PoS Comment to read: | ||
|
||
.. figure:: ../static/description/pos_customer_tree.png | ||
|
||
It is possible to see or edit the comment in the customer form view: | ||
|
||
.. figure:: ../static/description/pos_customer_form.png |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions
22
pos_customer_comment/static/src/css/pos_customer_comment.scss
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,22 @@ | ||
/* | ||
Copyright (C) 2022-Today GRAP (http://www.grap.coop) | ||
@author Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
*/ | ||
|
||
.pos .partnerlist-screen .partner-details textarea { | ||
padding: 4px; | ||
border-radius: 3px; | ||
border: solid 1px #cecbcb; | ||
margin-bottom: 4px; | ||
background: white; | ||
font-family: "Lato", "Lucida Grande", Helvetica, Verdana, Arial; | ||
color: #555555; | ||
width: 340px; | ||
font-size: 14px; | ||
box-sizing: border-box; | ||
} | ||
|
||
.pos .partnerlist-screen .partner-details span.label { | ||
vertical-align: top; | ||
} |
30 changes: 30 additions & 0 deletions
30
pos_customer_comment/static/src/xml/PartnerDetailsEdit.xml
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,30 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!-- | ||
Copyright (C) 2022-Today GRAP (http://www.grap.coop) | ||
@author Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
--> | ||
<templates id="template" xml:space="preserve"> | ||
|
||
<t | ||
t-name="PartnerDetailsEdit" | ||
t-inherit="point_of_sale.PartnerDetailsEdit" | ||
t-inherit-mode="extension" | ||
owl="1" | ||
> | ||
<xpath expr="//select[@name='country_id']/.." position="after"> | ||
<div class="partner-detail partner-detail-pos-comment"> | ||
<span class="label">Comment</span> | ||
<textarea | ||
class="detail" | ||
name="pos_comment" | ||
style="height: 100px;" | ||
t-on-change="captureChange" | ||
t-att-value="props.partner.pos_comment || ''" | ||
placeholder="Comment" | ||
/> | ||
</div> | ||
</xpath> | ||
</t> | ||
|
||
</templates> |
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,27 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!-- | ||
Copyright (C) 2022-Today GRAP (http://www.grap.coop) | ||
@author Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
--> | ||
<templates id="template" xml:space="preserve"> | ||
|
||
<t | ||
t-name="PartnerLine" | ||
t-inherit="point_of_sale.PartnerLine" | ||
t-inherit-mode="extension" | ||
owl="1" | ||
> | ||
<xpath expr="//button[@class='edit-partner-button']" position="after"> | ||
<div t-if="props.partner.pos_comment != ''"> | ||
<i | ||
class="fa fa-comment" | ||
role="img" | ||
aria-label="Has PoS Comment" | ||
title="Has PoS Comment" | ||
/> | ||
</div> | ||
</xpath> | ||
</t> | ||
|
||
</templates> |
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_module |
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,23 @@ | ||
# Copyright (C) 2022-Today GRAP (http://www.grap.coop) | ||
# @author Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
|
||
from odoo.tests import tagged | ||
|
||
from odoo.addons.point_of_sale.tests.test_frontend import TestPointOfSaleHttpCommon | ||
|
||
|
||
@tagged("post_install", "-at_install") | ||
class TestUi(TestPointOfSaleHttpCommon): | ||
def test_pos_customer_comment(self): | ||
self.main_pos_config.open_ui() | ||
self.main_pos_config.current_session_id.set_cashbox_pos(0, None) | ||
|
||
self.start_tour( | ||
f"/pos/ui?config_id={self.main_pos_config.id}", | ||
"PosCustomerCommentTour", | ||
login="accountman", | ||
) | ||
customer = self.env.ref("base.res_partner_address_31") | ||
self.assertEqual(customer.pos_comment, "New Comment") |
56 changes: 56 additions & 0 deletions
56
pos_customer_comment/tests/tours/PosCustomerComment.tour.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,56 @@ | ||
/* | ||
Copyright (C) 2022-Today GRAP (http://www.grap.coop) | ||
@author Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
*/ | ||
odoo.define("pos_customer_comment.tour.PosCustomerComment", function (require) { | ||
"use strict"; | ||
|
||
const Tour = require("web_tour.tour"); | ||
|
||
var steps = [ | ||
{ | ||
content: "Test pos_customer_content: Waiting for loading to finish", | ||
trigger: "body:not(:has(.loader))", | ||
}, | ||
{ | ||
content: "Test pos_customer_content: open customer list", | ||
trigger: "button.set-partner", | ||
}, | ||
{ | ||
content: "Test pos_customer_content: select 'Addison Olson' Customer", | ||
trigger: ".partner-line:contains('Addison Olson') .edit-partner-button", | ||
}, | ||
{ | ||
content: "Test pos_customer_content: Check if value is correctly loaded", | ||
trigger: "textarea[name='pos_comment']", | ||
run: () => { | ||
var content = $("textarea[name='pos_comment']"); | ||
if (!content.val().includes("Important")) { | ||
throw new Error("the PoS comment was not loaded in the frontend"); | ||
} | ||
}, | ||
}, | ||
{ | ||
content: "Test pos_customer_content: Write new text in PoS Comment field", | ||
trigger: "textarea[name='pos_comment']", | ||
run: "text New Comment", | ||
}, | ||
{ | ||
content: "Test pos_customer_content: Save Customer changes", | ||
trigger: ".partnerlist-screen .button.highlight", | ||
}, | ||
{ | ||
content: "Test pos_customer_content: Close the Point of Sale frontend", | ||
trigger: ".header-button", | ||
}, | ||
{ | ||
content: "Test pos_customer_content: Confirm closing the frontend", | ||
trigger: ".header-button", | ||
}, | ||
]; | ||
|
||
Tour.register("PosCustomerCommentTour", {test: true, url: "/pos/ui"}, steps); | ||
}); | ||
|
||
/* */ |
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,22 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- | ||
Copyright (C) 2022-Today GRAP (http://www.grap.coop) | ||
@author Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
--> | ||
<odoo> | ||
<record id="view_res_partner_form" model="ir.ui.view"> | ||
<field name="model">res.partner</field> | ||
<field name="inherit_id" ref="base.view_partner_form" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//notebook" position="inside"> | ||
<page name="page_pos_comment" string="Cashier Comment"> | ||
<field | ||
name="pos_comment" | ||
placeholder="Comment that will be visible and editable in the Point of Sale for the cashiers" | ||
/> | ||
</page> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
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 @@ | ||
../../../../pos_customer_comment |
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,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |