diff --git a/pos_ticket_salesman_firstname/__init__.py b/pos_ticket_salesman_firstname/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/pos_ticket_salesman_firstname/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/pos_ticket_salesman_firstname/__manifest__.py b/pos_ticket_salesman_firstname/__manifest__.py new file mode 100644 index 00000000..5eb35d19 --- /dev/null +++ b/pos_ticket_salesman_firstname/__manifest__.py @@ -0,0 +1,26 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Pos Ticket Salesman Firstname", + "category": "Point Of Sale", + "version": "12.0.1.0.0", + "author": "Druidoo, " + "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/pos", + "license": "AGPL-3", + "depends": [ + "point_of_sale", + "partner_firstname", + ], + "data": [ + "views/assets.xml", + "views/pos_config.xml", + ], + "qweb": [ + "static/src/xml/pos.xml", + ], + "maintainers": [ + "ivantodorovich", + ], + "installable": True, +} diff --git a/pos_ticket_salesman_firstname/models/__init__.py b/pos_ticket_salesman_firstname/models/__init__.py new file mode 100644 index 00000000..db8634ad --- /dev/null +++ b/pos_ticket_salesman_firstname/models/__init__.py @@ -0,0 +1 @@ +from . import pos_config diff --git a/pos_ticket_salesman_firstname/models/pos_config.py b/pos_ticket_salesman_firstname/models/pos_config.py new file mode 100644 index 00000000..73668ed2 --- /dev/null +++ b/pos_ticket_salesman_firstname/models/pos_config.py @@ -0,0 +1,10 @@ +from odoo import models, fields + + +class PosConfig(models.Model): + _inherit = 'pos.config' + + receipt_salesman_firstname = fields.Boolean( + "Print only the salesman's first name", + default=True, + ) diff --git a/pos_ticket_salesman_firstname/readme/CONFIGURE.rst b/pos_ticket_salesman_firstname/readme/CONFIGURE.rst new file mode 100644 index 00000000..afe2a8dc --- /dev/null +++ b/pos_ticket_salesman_firstname/readme/CONFIGURE.rst @@ -0,0 +1,3 @@ +#. Go to *Point of Sale > Configuration > Point of Sale*. +#. Edit the one you want to configure. +#. Enable *Print only the salesman's first name* diff --git a/pos_ticket_salesman_firstname/readme/CONTRIBUTORS.rst b/pos_ticket_salesman_firstname/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..998beab2 --- /dev/null +++ b/pos_ticket_salesman_firstname/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `Druidoo `_: + + * Iván Todorovich diff --git a/pos_ticket_salesman_firstname/readme/DESCRIPTION.rst b/pos_ticket_salesman_firstname/readme/DESCRIPTION.rst new file mode 100644 index 00000000..ce293c51 --- /dev/null +++ b/pos_ticket_salesman_firstname/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +On the POS ticket, prints only the salesman's first name. + +.. image:: ../static/description/receipt.png diff --git a/pos_ticket_salesman_firstname/readme/USAGE.rst b/pos_ticket_salesman_firstname/readme/USAGE.rst new file mode 100644 index 00000000..ce3ea19c --- /dev/null +++ b/pos_ticket_salesman_firstname/readme/USAGE.rst @@ -0,0 +1,3 @@ +#. Open a new PoS session. +#. Make an order and validate it. +#. You should see only the salesman's firstname on the receipt diff --git a/pos_ticket_salesman_firstname/static/description/icon.png b/pos_ticket_salesman_firstname/static/description/icon.png new file mode 100644 index 00000000..e060fb4a Binary files /dev/null and b/pos_ticket_salesman_firstname/static/description/icon.png differ diff --git a/pos_ticket_salesman_firstname/static/description/receipt.png b/pos_ticket_salesman_firstname/static/description/receipt.png new file mode 100644 index 00000000..0523fc5f Binary files /dev/null and b/pos_ticket_salesman_firstname/static/description/receipt.png differ diff --git a/pos_ticket_salesman_firstname/static/src/js/models.js b/pos_ticket_salesman_firstname/static/src/js/models.js new file mode 100644 index 00000000..9a62bbe8 --- /dev/null +++ b/pos_ticket_salesman_firstname/static/src/js/models.js @@ -0,0 +1,25 @@ +/* License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). */ + + +odoo.define("pos_ticket_salesman_firstname.models", function (require) { + "use strict"; + + var models = require("point_of_sale.models"); + + models.load_fields('res.users', ['firstname', 'lastname']); + + var _super_Order = models.Order.prototype; + models.Order = models.Order.extend({ + export_for_printing: function() { + var receipt = _super_Order.export_for_printing.apply(this, arguments); + if (this.pos.config.receipt_salesman_firstname) { + var cashier = this.pos.get_cashier(); + receipt.cashier = cashier ? cashier.firstname : null; + } + return receipt; + } + }); + + return models; + +}); diff --git a/pos_ticket_salesman_firstname/static/src/xml/pos.xml b/pos_ticket_salesman_firstname/static/src/xml/pos.xml new file mode 100644 index 00000000..8493dbfc --- /dev/null +++ b/pos_ticket_salesman_firstname/static/src/xml/pos.xml @@ -0,0 +1,16 @@ + + + + + + +
+ User: + + +
+
+
+
+ +
diff --git a/pos_ticket_salesman_firstname/views/assets.xml b/pos_ticket_salesman_firstname/views/assets.xml new file mode 100644 index 00000000..55fd823b --- /dev/null +++ b/pos_ticket_salesman_firstname/views/assets.xml @@ -0,0 +1,11 @@ + + + + +