From 3d0a714f5fc30de96e3b7baf127e2d7a12975859 Mon Sep 17 00:00:00 2001
From: RaghuGadam
Date: Thu, 12 Sep 2019 11:50:03 +0200
Subject: [PATCH 01/13] [MIG]Migration to 12.0: email_pos_receipt
---
pos_ticket_send_by_mail/README.rst | 34 ++
pos_ticket_send_by_mail/__init__.py | 6 +
pos_ticket_send_by_mail/__manifest__.py | 27 ++
.../data/email_template_data.xml | 25 ++
pos_ticket_send_by_mail/data/ir_cron_data.xml | 16 +
.../i18n/email_pos_receipt.pot | 105 ++++++
pos_ticket_send_by_mail/i18n/fr.po | 96 +++++
pos_ticket_send_by_mail/models/__init__.py | 8 +
pos_ticket_send_by_mail/models/pos_order.py | 47 +++
.../models/res_config_settings.py | 45 +++
pos_ticket_send_by_mail/models/res_partner.py | 16 +
.../security/ir.model.access.csv | 1 +
.../static/src/js/pos_model.js | 24 ++
.../static/src/js/receipt_screen_widget.js | 47 +++
.../static/src/xml/templates.xml | 13 +
pos_ticket_send_by_mail/tests/__init__.py | 2 +
.../tests/test_pos_ticket_mail.py | 327 ++++++++++++++++++
.../views/report_paperformat.xml | 20 ++
.../views/report_receipt.xml | 105 ++++++
.../views/view_pos_config_settings.xml | 39 +++
.../views/view_res_partner.xml | 15 +
21 files changed, 1018 insertions(+)
create mode 100644 pos_ticket_send_by_mail/README.rst
create mode 100644 pos_ticket_send_by_mail/__init__.py
create mode 100644 pos_ticket_send_by_mail/__manifest__.py
create mode 100644 pos_ticket_send_by_mail/data/email_template_data.xml
create mode 100644 pos_ticket_send_by_mail/data/ir_cron_data.xml
create mode 100644 pos_ticket_send_by_mail/i18n/email_pos_receipt.pot
create mode 100644 pos_ticket_send_by_mail/i18n/fr.po
create mode 100644 pos_ticket_send_by_mail/models/__init__.py
create mode 100644 pos_ticket_send_by_mail/models/pos_order.py
create mode 100644 pos_ticket_send_by_mail/models/res_config_settings.py
create mode 100644 pos_ticket_send_by_mail/models/res_partner.py
create mode 100644 pos_ticket_send_by_mail/security/ir.model.access.csv
create mode 100644 pos_ticket_send_by_mail/static/src/js/pos_model.js
create mode 100644 pos_ticket_send_by_mail/static/src/js/receipt_screen_widget.js
create mode 100644 pos_ticket_send_by_mail/static/src/xml/templates.xml
create mode 100644 pos_ticket_send_by_mail/tests/__init__.py
create mode 100644 pos_ticket_send_by_mail/tests/test_pos_ticket_mail.py
create mode 100755 pos_ticket_send_by_mail/views/report_paperformat.xml
create mode 100755 pos_ticket_send_by_mail/views/report_receipt.xml
create mode 100644 pos_ticket_send_by_mail/views/view_pos_config_settings.xml
create mode 100644 pos_ticket_send_by_mail/views/view_res_partner.xml
diff --git a/pos_ticket_send_by_mail/README.rst b/pos_ticket_send_by_mail/README.rst
new file mode 100644
index 0000000000..433d8c493c
--- /dev/null
+++ b/pos_ticket_send_by_mail/README.rst
@@ -0,0 +1,34 @@
+.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
+ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
+ :alt: License: AGPL-3
+
+=======================
+POS Ticket Send By Mail
+=======================
+
+This module allow to send the mail to customer from point of sale
+base on configuration.
+
+Credits
+=======
+
+Authors
+~~~~~~~
+
+* Druidoo
+
+Contributors
+~~~~~~~~~~~~
+
+* Iván Todorovich
+
+Maintainers
+~~~~~~~~~~~
+
+.. |maintainer-ivantodorovich| image:: https://github.com/ivantodorovich.png?size=40px
+ :target: https://github.com/ivantodorovich
+ :alt: ivantodorovich
+
+Current maintainer:
+
+|maintainer-ivantodorovich|
diff --git a/pos_ticket_send_by_mail/__init__.py b/pos_ticket_send_by_mail/__init__.py
new file mode 100644
index 0000000000..11e0198d26
--- /dev/null
+++ b/pos_ticket_send_by_mail/__init__.py
@@ -0,0 +1,6 @@
+# Copyright (C) 2016-Today: La Louve ()
+# Copyright (C) 2019-Today: Druidoo ()
+# @author: La Louve
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html
+
+from . import models
diff --git a/pos_ticket_send_by_mail/__manifest__.py b/pos_ticket_send_by_mail/__manifest__.py
new file mode 100644
index 0000000000..6eff25f9fa
--- /dev/null
+++ b/pos_ticket_send_by_mail/__manifest__.py
@@ -0,0 +1,27 @@
+# Copyright (C) 2016-Today: La Louve ()
+# Copyright (C) 2019-Today: Druidoo ()
+# @author: La Louve
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html
+
+{
+ 'name': 'POS Receipt By Email',
+ 'version': '12.0.1.0.0',
+ 'category': 'Custom',
+ 'author': 'Druidoo',
+ 'website': 'https://www.druidoo.io',
+ 'license': 'AGPL-3',
+ 'depends': [
+ 'point_of_sale',
+ ],
+ 'data': [
+ 'security/ir.model.access.csv',
+ 'views/report_paperformat.xml',
+ 'views/view_pos_config_settings.xml',
+ 'data/email_template_data.xml',
+ 'data/ir_cron_data.xml',
+ 'views/view_res_partner.xml',
+ 'views/report_receipt.xml',
+ 'static/src/xml/templates.xml',
+ ],
+ 'installable': True,
+}
diff --git a/pos_ticket_send_by_mail/data/email_template_data.xml b/pos_ticket_send_by_mail/data/email_template_data.xml
new file mode 100644
index 0000000000..8d08912d32
--- /dev/null
+++ b/pos_ticket_send_by_mail/data/email_template_data.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+ Send Received
+ ticket@${object.user_id.company_id.email.split('@')[1] or ''|safe}
+ ${object.user_id.company_id.name} Received ${object.pos_reference.split(' ')[1]}
+ ${object.partner_id.id}
+
+
+
+ Ticket ${object.pos_reference}
+ ${object.partner_id.lang}
+ Thank you for your visit !
+ You will find your receipt ${object.pos_reference.split(' ')[1]} attached.
+ Sincerely,
+ The team of the cooperative
+ ]]>
+
+
+
+
+
diff --git a/pos_ticket_send_by_mail/data/ir_cron_data.xml b/pos_ticket_send_by_mail/data/ir_cron_data.xml
new file mode 100644
index 0000000000..18d0c06cea
--- /dev/null
+++ b/pos_ticket_send_by_mail/data/ir_cron_data.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ Send Reciept via Email
+ 1
+ minutes
+ -1
+
+
+ model._send_order_cron()
+ code
+
+
+
+
diff --git a/pos_ticket_send_by_mail/i18n/email_pos_receipt.pot b/pos_ticket_send_by_mail/i18n/email_pos_receipt.pot
new file mode 100644
index 0000000000..bfb61e15ef
--- /dev/null
+++ b/pos_ticket_send_by_mail/i18n/email_pos_receipt.pot
@@ -0,0 +1,105 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * pos_ticket_send_by_mail
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 9.0c\n"
+"Report-Msgid-Bugs-To: \n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: pos_ticket_send_by_mail
+#: model:mail.template,body_html:pos_ticket_send_by_mail.email_send_pos_receipt
+msgid "\n"
+"Thank you for your visit !
\n"
+"You will find your receipt ${object.pos_reference.split(' ')[1]} attached.
\n"
+"Sincerely,
\n"
+"The team of the cooperative
\n"
+" "
+msgstr "\n"
+"Merci de votre visite !
\n"
+"Vous trouverez votre reçu ${object.pos_reference.split(' ')[1]} en pièce-jointe.
\n"
+"Amicalement,
\n"
+"L'équipe de la coopérative
\n"
+" "
+
+#. module: pos_ticket_send_by_mail
+#: model:mail.template,subject:pos_ticket_send_by_mail.email_send_pos_receipt
+msgid "${object.user_id.company_id.name} Received ${object.pos_reference.split(' ')[1]}"
+msgstr "${object.user_id.company_id.name} Reçu ${object.pos_reference.split(' ')[1]}"
+
+#. module: pos_ticket_send_by_mail
+#: selection:pos.order,email_status:0
+msgid "Do not Send"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: selection:pos.config.settings,receipt_options:0
+msgid "Do not send receipt via email"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_partner_pos_ticket_send_by_mail
+msgid "E-receipt"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: selection:pos.config.settings,receipt_options:0
+msgid "Email receipt and print it"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: selection:pos.config.settings,receipt_options:0
+msgid "Email receipt and print it unless configured on user that he only receives electronically"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model.fields,help:pos_ticket_send_by_mail.field_res_partner_pos_ticket_send_by_mail
+msgid "If you tick this box and option 3 is selected for 'Receipt' in point of sale settings, the user will only receive e-receipt"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model,name:pos_ticket_send_by_mail.model_res_partner
+msgid "Partner"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model,name:pos_ticket_send_by_mail.model_pos_order
+msgid "Point of Sale"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_pos_config_settings_receipt_options
+msgid "Receipt"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_pos_order_email_status
+msgid "Send Status"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: selection:pos.order,email_status:0
+msgid "Sent"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:mail.template,report_name:pos_ticket_send_by_mail.email_send_pos_receipt
+msgid "Ticket ${object.pos_reference}"
+msgstr "Billet ${object.pos_reference}"
+
+#. module: pos_ticket_send_by_mail
+#: selection:pos.order,email_status:0
+msgid "To send"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model,name:pos_ticket_send_by_mail.model_pos_config_settings
+msgid "pos.config.settings"
+msgstr ""
+
diff --git a/pos_ticket_send_by_mail/i18n/fr.po b/pos_ticket_send_by_mail/i18n/fr.po
new file mode 100644
index 0000000000..23e6847f7e
--- /dev/null
+++ b/pos_ticket_send_by_mail/i18n/fr.po
@@ -0,0 +1,96 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * pos_ticket_send_by_mail
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 9.0c\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2018-08-17 09:04+0000\n"
+"PO-Revision-Date: 2018-08-17 09:04+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: pos_ticket_send_by_mail
+#: selection:pos.order,email_status:0
+msgid "Do not Send"
+msgstr "Do not Send"
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model,name:pos_ticket_send_by_mail.model_res_partner
+msgid "Partner"
+msgstr "Partenaire"
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model,name:pos_ticket_send_by_mail.model_pos_order
+msgid "Point of Sale"
+msgstr "Point de vente"
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_pos_config_is_print_receipt
+msgid "Print receipt when not sent email"
+msgstr "Ne pas imprimer de ticket s’il est envoyé par par email"
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_pos_order_email_status
+msgid "Send Status"
+msgstr "Send Status"
+
+#. module: pos_ticket_send_by_mail
+#: selection:pos.order,email_status:0
+msgid "Sent"
+msgstr "Sent"
+
+#. module: pos_ticket_send_by_mail
+#: model:mail.template,report_name:pos_ticket_send_by_mail.email_send_pos_receipt
+msgid "Ticket ${object.pos_reference}"
+msgstr "Billet ${object.pos_reference}"
+
+#. module: pos_ticket_send_by_mail
+#: selection:pos.order,email_status:0
+msgid "To send"
+msgstr "To send"
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model,name:pos_ticket_send_by_mail.model_pos_config
+msgid "pos.config"
+msgstr "pos.config"
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_pos_config_is_print_receipt
+msgid "Print receipt when not sent email"
+msgstr "Ne pas imprimer de ticket s’il est envoyé par par email"
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_pos_config_settings_receipt_options
+msgid "Receipt"
+msgstr "Reçu"
+
+#. module: pos_ticket_send_by_mail
+#: selection:pos.config.settings,receipt_options:0
+msgid "Do not send receipt via email"
+msgstr "Ne pas envoyer le reçu par email"
+
+#. module: pos_ticket_send_by_mail
+#: selection:pos.config.settings,receipt_options:0
+msgid "Email receipt and print it"
+msgstr "Envoyer le reçu par email et l'imprimer"
+
+#. module: pos_ticket_send_by_mail
+#: selection:pos.config.settings,receipt_options:0
+msgid "Email receipt and print it unless configured on user that he only receives electronically"
+msgstr "Envoyer le reçu par email et l'imprimer sauf si ce partenaire est configuré pour recevoir uniquement le reçu électronique"
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model.fields,help:pos_ticket_send_by_mail.field_res_partner_pos_ticket_send_by_mail
+msgid "If you tick this box and option 3 is selected for 'Receipt' in point of sale settings, the user will only receive e-receipt"
+msgstr "Si vous cochez cette case et que l'option 3 est sélectionnée dans la configuration générale du point de vente, ce partenaire recevra uniquement le reçu électronique"
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_partner_pos_ticket_send_by_mail
+msgid "E-receipt"
+msgstr "Reçu électronique"
diff --git a/pos_ticket_send_by_mail/models/__init__.py b/pos_ticket_send_by_mail/models/__init__.py
new file mode 100644
index 0000000000..37a95e46ac
--- /dev/null
+++ b/pos_ticket_send_by_mail/models/__init__.py
@@ -0,0 +1,8 @@
+# Copyright (C) 2016-Today: La Louve ()
+# Copyright (C) 2019-Today: Druidoo ()
+# @author: La Louve
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html
+
+from . import res_partner
+from . import pos_order
+from . import res_config_settings
diff --git a/pos_ticket_send_by_mail/models/pos_order.py b/pos_ticket_send_by_mail/models/pos_order.py
new file mode 100644
index 0000000000..e8b2080133
--- /dev/null
+++ b/pos_ticket_send_by_mail/models/pos_order.py
@@ -0,0 +1,47 @@
+# Copyright (C) 2016-Today: La Louve ()
+# Copyright (C) 2019-Today: Druidoo ()
+# @author: La Louve
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html
+
+from odoo import models, fields, api
+import logging
+_logger = logging.getLogger(__name__)
+
+
+class PosOrder(models.Model):
+
+ _inherit = 'pos.order'
+
+ email_status = fields.Selection([
+ ('no_send', 'Do not Send'),
+ ('to_send', 'To send'),
+ ('sent', 'Sent')],
+ default="no_send", string="Send Status")
+
+ @api.model
+ def _send_order_cron(self):
+ _logger.info("------------------------------------------------------")
+ mail_template = self.env.ref(
+ "pos_ticket_send_by_mail.email_send_pos_receipt")
+ _logger.info("Start to send ticket")
+ for order in self.search([('email_status', '=', 'to_send')]):
+ mail_template.send_mail(order.id, force_send=True)
+ order.email_status = 'sent'
+ # Make sure we commit the change to not send ticket twice
+ self.env.cr.commit()
+
+ @api.multi
+ def action_pos_order_paid(self):
+ # Send e-receipt for the partner.
+ # It depends on value of the field `receipt_option`
+ # that we config in pos.config.settings
+ # receipt_option = 1: Don't send e-receipt
+ # receipt_option = 2 or 3: Send e-receipt
+ res = super(PosOrder, self).action_pos_order_paid()
+ icp_sudo = self.env['ir.config_parameter'].sudo()
+ receipt_options = icp_sudo.get_param('point_of_sale.receipt_options')
+ receipt_options = receipt_options and int(receipt_options) or False
+ for order in self:
+ if receipt_options in [2, 3] and order.partner_id.email:
+ order.email_status = 'to_send'
+ return res
diff --git a/pos_ticket_send_by_mail/models/res_config_settings.py b/pos_ticket_send_by_mail/models/res_config_settings.py
new file mode 100644
index 0000000000..0d98727eaa
--- /dev/null
+++ b/pos_ticket_send_by_mail/models/res_config_settings.py
@@ -0,0 +1,45 @@
+# Copyright (C) 2016-Today: La Louve ()
+# Copyright (C) 2019-Today: Druidoo ()
+# @author: La Louve
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html
+
+from odoo import models, fields, api
+
+
+class ResConfigSettings(models.TransientModel):
+ _inherit = 'res.config.settings'
+
+ receipt_options = fields.Selection(
+ [
+ ('1', 'Do not send receipt via email'),
+ ('2', 'Email receipt and print it'),
+ ('3', 'Email receipt and print it unless configured on user that \
+ he only receives electronically')
+ ], string="Receipt",
+ config_parameter='point_of_sale.receipt_options'
+ )
+
+ @api.model
+ def get_values(self):
+ res = super(ResConfigSettings, self).get_values()
+ icp_sudo = self.env['ir.config_parameter'].sudo()
+ receipt_options = icp_sudo.get_param('point_of_sale.receipt_options')
+ res.update(
+ receipt_options=receipt_options
+ )
+ return res
+
+ @api.model
+ def get_default_receipt_options(self):
+ receipt_options = self.env['ir.values'].get_default(
+ 'res.config.settings', 'receipt_options')
+ return {
+ 'receipt_options': receipt_options,
+ }
+
+ @api.multi
+ def set_default_receipt_options(self):
+ self.ensure_one()
+ return self.env['ir.values'].sudo().set_default(
+ 'res.config.settings', 'receipt_options',
+ self.receipt_options or None)
diff --git a/pos_ticket_send_by_mail/models/res_partner.py b/pos_ticket_send_by_mail/models/res_partner.py
new file mode 100644
index 0000000000..d913468c25
--- /dev/null
+++ b/pos_ticket_send_by_mail/models/res_partner.py
@@ -0,0 +1,16 @@
+# Copyright (C) 2016-Today: La Louve ()
+# Copyright (C) 2019-Today: Druidoo ()
+# @author: La Louve
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html
+
+from odoo import fields, models
+
+
+class ResPartner(models.Model):
+ _inherit = "res.partner"
+
+ email_pos_receipt = fields.Boolean(
+ string="E-receipt",
+ default=False,
+ help="If you tick this box and option 3 is selected for 'Receipt'\
+ in point of sale settings, the user will only receive e-receipt ")
diff --git a/pos_ticket_send_by_mail/security/ir.model.access.csv b/pos_ticket_send_by_mail/security/ir.model.access.csv
new file mode 100644
index 0000000000..97dd8b917b
--- /dev/null
+++ b/pos_ticket_send_by_mail/security/ir.model.access.csv
@@ -0,0 +1 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
diff --git a/pos_ticket_send_by_mail/static/src/js/pos_model.js b/pos_ticket_send_by_mail/static/src/js/pos_model.js
new file mode 100644
index 0000000000..82e76384e8
--- /dev/null
+++ b/pos_ticket_send_by_mail/static/src/js/pos_model.js
@@ -0,0 +1,24 @@
+/*
+# Copyright (C) 2016-Today: La Louve ()
+# Copyright (C) 2019-Today: Druidoo ()
+# @author: La Louve
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html
+
+*/
+
+odoo.define('pos_ticket_send_by_mail.pos_model', function (require) {
+ "use strict";
+ var pos_model = require('point_of_sale.models');
+ pos_model.load_fields("res.partner", "email_pos_receipt");
+ pos_model.load_models([{
+ model: "res.config.settings",
+ fields: ["receipt_options"],
+ loaded: function(self, config_settings){
+ const config_setting = config_settings.length > 0 ? config_settings.reduce(function(prev, current) {
+ return (prev.id > current.id) ? prev : current
+ }) : false; //returns object
+ self.config_settings = config_setting;
+ }
+ }]);
+
+});
diff --git a/pos_ticket_send_by_mail/static/src/js/receipt_screen_widget.js b/pos_ticket_send_by_mail/static/src/js/receipt_screen_widget.js
new file mode 100644
index 0000000000..6fa0622394
--- /dev/null
+++ b/pos_ticket_send_by_mail/static/src/js/receipt_screen_widget.js
@@ -0,0 +1,47 @@
+/*
+
+# Copyright (C) 2016-Today: La Louve ()
+# Copyright (C) 2019-Today: Druidoo ()
+# @author: La Louve
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html
+
+*/
+
+odoo.define('pos_ticket_send_by_mail.receipt_screen_widget', function (require) {
+
+ "use strict";
+ var models = require('point_of_sale.models');
+ var screens = require('point_of_sale.screens');
+ var core = require('web.core');
+ var gui = require('point_of_sale.gui');
+ var _t = core._t;
+
+ screens.ReceiptScreenWidget.include({
+
+ print_web: function() {
+ var client = this.pos.get_client();
+ var email_pos_receipt = client ? client.email_pos_receipt: false;
+ var receipt_options = this.pos.config_settings ? this.pos.config_settings.receipt_options : false;
+ if (receipt_options && receipt_options == '3' && email_pos_receipt) {
+ console.log("Skip print receipt by web");
+ return
+ } else {
+ console.log("1 print receipt by web");
+ return this._super();
+ }
+ },
+
+ print_xml: function() {
+ var client = this.pos.get_client();
+ var email_pos_receipt = client ? client.email_pos_receipt: false;
+ var receipt_options = this.pos.config_settings ? this.pos.config_settings.receipt_options : false;
+ if (receipt_options && receipt_options == '3' && email_pos_receipt) {
+ console.log("Skip print receipt by web");
+ return
+ } else {
+ console.log(" print receipt by web");
+ return this._super();
+ }
+ },
+ });
+});
diff --git a/pos_ticket_send_by_mail/static/src/xml/templates.xml b/pos_ticket_send_by_mail/static/src/xml/templates.xml
new file mode 100644
index 0000000000..50bcca4be7
--- /dev/null
+++ b/pos_ticket_send_by_mail/static/src/xml/templates.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pos_ticket_send_by_mail/tests/__init__.py b/pos_ticket_send_by_mail/tests/__init__.py
new file mode 100644
index 0000000000..626af5595d
--- /dev/null
+++ b/pos_ticket_send_by_mail/tests/__init__.py
@@ -0,0 +1,2 @@
+
+from . import test_pos_ticket_mail
diff --git a/pos_ticket_send_by_mail/tests/test_pos_ticket_mail.py b/pos_ticket_send_by_mail/tests/test_pos_ticket_mail.py
new file mode 100644
index 0000000000..4228e498cf
--- /dev/null
+++ b/pos_ticket_send_by_mail/tests/test_pos_ticket_mail.py
@@ -0,0 +1,327 @@
+from odoo.tests.common import TransactionCase
+from odoo import fields
+
+
+class PosTicketMailTest(TransactionCase):
+
+ def setUp(self):
+ super(PosTicketMailTest, self).setUp()
+
+ self.ir_config_parameter = self.env['ir.config_parameter']
+ self.PosOrder = self.env['pos.order']
+ self.partner1 = self.env.ref('base.res_partner_1')
+ self.pos_config = self.env['pos.config'].create({
+ 'name': 'test_pos_email',
+ })
+ self.res_users = self.env['res.users']
+ self.pos_user = self.res_users.search([
+ ('login', '=', 'pos_test_email')
+ ], limit=1)
+ if not self.pos_user:
+ self.pos_user = self.res_users.create({
+ 'name': 'pos_test_email',
+ 'login': 'pos_test_email',
+ 'email': 'pos_test_email@mail.com'
+ })
+ self.pos_session = self.env['pos.session']
+ self.PosSession = self.pos_session.search([
+ ('user_id', '=', self.pos_user.id)
+ ])
+ if not self.PosSession:
+ self.PosSession = self.env['pos.session'].create({
+ 'user_id': self.pos_user.id,
+ 'config_id': self.pos_config.id
+ })
+ self.led_lamp = self.env.ref('point_of_sale.led_lamp')
+ self.whiteboard_pen = self.env.ref('point_of_sale.whiteboard_pen')
+ self.newspaper_rack = self.env.ref('point_of_sale.newspaper_rack')
+ self.partner_3 = self.env.ref('base.res_partner_3')
+ self.pos_sale_journal = self.env['account.journal'].search([
+ ('type', '=', 'cash')
+ ])
+ self.pos_config.journal_ids = [self.pos_sale_journal[0].id]
+
+ def test_01_pos_config_no_mail_sent(self):
+ """
+ POS config do not send email
+ """
+ def compute_tax(product, price, qty=1, taxes=None):
+ if not taxes:
+ taxes = product.taxes_id.filtered(
+ lambda t: t.company_id.id == self.env.user.id)
+ currency = self.pos_config.pricelist_id.currency_id
+ res = taxes.compute_all(price, currency, qty, product=product)
+ untax = res['total_excluded']
+ return untax, sum(tax.get('amount', 0.0) for tax in res['taxes'])
+ self.ir_config_parameter.set_param('point_of_sale.receipt_options',
+ '1')
+ open_session = self.PosSession.search([
+ ('state', '!=', 'closed'),
+ ('config_id', '=', self.pos_config.id),
+ ('rescue', '=', False)
+ ])
+ if open_session:
+ current_session = open_session
+ else:
+ self.pos_config.open_session_cb()
+ current_session = self.pos_config.current_session_id
+ untax, atax = compute_tax(self.led_lamp, 0.9)
+ carrot_order = {
+ 'data': {
+ 'amount_paid': untax + atax,
+ 'amount_return': 0,
+ 'amount_tax': atax,
+ 'amount_total': untax + atax,
+ 'creation_date': fields.Datetime.to_string(
+ fields.Datetime.now()
+ ),
+ 'fiscal_position_id': False,
+ 'pricelist_id': self.pos_config.available_pricelist_ids[0].id,
+ 'lines': [[0, 0, {
+ 'discount': 0,
+ 'id': 42,
+ 'pack_lot_ids': [],
+ 'price_unit': 0.9,
+ 'product_id': self.led_lamp.id,
+ 'price_subtotal': 0.9,
+ 'price_subtotal_incl': 1.04,
+ 'qty': 1,
+ 'tax_ids': [(6, 0, self.led_lamp.taxes_id.ids)]}]],
+ 'name': 'Order 00042-003-0014',
+ 'partner_id': False,
+ 'pos_session_id': current_session.id,
+ 'sequence_number': 2,
+ 'statement_ids': [[0, 0, {
+ 'account_id': self.env.user.partner_id.
+ property_account_receivable_id.id,
+ 'amount': untax + atax,
+ 'journal_id': self.pos_sale_journal[0].id,
+ 'name': fields.Datetime.now(),
+ 'statement_id': current_session.statement_ids[0].id}]],
+ 'uid': '00042-003-0014',
+ 'user_id': self.env.uid
+ },
+ 'id': '00042-003-0014',
+ 'to_invoice': False
+ }
+ untax, atax = compute_tax(self.whiteboard_pen, 1.2)
+ self.PosOrder01 = self.PosOrder.browse(
+ self.PosOrder.create_from_ui([carrot_order]))
+ self.PosOrder01.action_pos_order_paid()
+ current_session.action_pos_session_closing_control()
+
+ def test_02_pos_config_mail_sent_print_no_partner(self):
+ """
+ POS config Email receipt and print it
+ No Partner
+ """
+ def compute_tax(product, price, qty=1, taxes=None):
+ if not taxes:
+ taxes = product.taxes_id.filtered(
+ lambda t: t.company_id.id == self.env.user.id)
+ currency = self.pos_config.pricelist_id.currency_id
+ res = taxes.compute_all(price, currency, qty, product=product)
+ untax = res['total_excluded']
+ return untax, sum(tax.get('amount', 0.0) for tax in res['taxes'])
+ self.ir_config_parameter.set_param(
+ 'point_of_sale.receipt_options',
+ '2'
+ )
+ open_session = self.PosSession.search([
+ ('state', '!=', 'closed'),
+ ('config_id', '=', self.pos_config.id),
+ ('rescue', '=', False)
+ ])
+ if open_session:
+ current_session = open_session
+ else:
+ self.pos_config.open_session_cb()
+ current_session = self.pos_config.current_session_id
+ untax, atax = compute_tax(self.led_lamp, 0.9)
+ carrot_order = {
+ 'data': {
+ 'amount_paid': untax + atax,
+ 'amount_return': 0,
+ 'amount_tax': atax,
+ 'amount_total': untax + atax,
+ 'creation_date': fields.Datetime.to_string(
+ fields.Datetime.now()
+ ),
+ 'fiscal_position_id': False,
+ 'pricelist_id': self.pos_config.available_pricelist_ids[0].id,
+ 'lines': [[0, 0, {
+ 'discount': 0,
+ 'id': 43,
+ 'pack_lot_ids': [],
+ 'price_unit': 0.9,
+ 'product_id': self.led_lamp.id,
+ 'price_subtotal': 0.9,
+ 'price_subtotal_incl': 1.04,
+ 'qty': 1,
+ 'tax_ids': [(6, 0, self.led_lamp.taxes_id.ids)]}]],
+ 'name': 'Order 00042-003-0024',
+ 'partner_id': False,
+ 'pos_session_id': current_session.id,
+ 'sequence_number': 3,
+ 'statement_ids': [[0, 0, {
+ 'account_id': self.env.user.partner_id.
+ property_account_receivable_id.id,
+ 'amount': untax + atax,
+ 'journal_id': self.pos_sale_journal[0].id,
+ 'name': fields.Datetime.now(),
+ 'statement_id': current_session.statement_ids[0].id}]],
+ 'uid': '00042-003-0028',
+ 'user_id': self.env.uid
+ },
+ 'id': '00042-003-0028',
+ 'to_invoice': False
+ }
+ untax, atax = compute_tax(self.whiteboard_pen, 1.2)
+ self.PosOrder02 = self.PosOrder.browse(
+ self.PosOrder.create_from_ui([carrot_order]))
+ self.PosOrder.action_pos_order_paid()
+ self.PosOrder02._send_order_cron()
+ current_session.action_pos_session_closing_control()
+
+ def test_03_pos_config_mail_sent_print_partner(self):
+ """
+ POS config Email receipt and print it
+ Set Partner
+ """
+ def compute_tax(product, price, qty=1, taxes=None):
+ if not taxes:
+ taxes = product.taxes_id.filtered(
+ lambda t: t.company_id.id == self.env.user.id)
+ currency = self.pos_config.pricelist_id.currency_id
+ res = taxes.compute_all(price, currency, qty, product=product)
+ untax = res['total_excluded']
+ return untax, sum(tax.get('amount', 0.0) for tax in res['taxes'])
+ self.ir_config_parameter.set_param('point_of_sale.receipt_options',
+ '2')
+ open_session = self.PosSession.search([
+ ('state', '!=', 'closed'),
+ ('config_id', '=', self.pos_config.id),
+ ('rescue', '=', False)
+ ])
+ if open_session:
+ current_session = open_session
+ else:
+ self.pos_config.open_session_cb()
+ current_session = self.pos_config.current_session_id
+ untax, atax = compute_tax(self.led_lamp, 0.9)
+ carrot_order = {
+ 'data': {
+ 'amount_paid': untax + atax,
+ 'amount_return': 0,
+ 'amount_tax': atax,
+ 'amount_total': untax + atax,
+ 'creation_date': fields.Datetime.to_string(
+ fields.Datetime.now()
+ ),
+ 'fiscal_position_id': False,
+ 'pricelist_id': self.pos_config.available_pricelist_ids[0].id,
+ 'lines': [[0, 0, {
+ 'discount': 0,
+ 'id': 44,
+ 'pack_lot_ids': [],
+ 'price_unit': 0.9,
+ 'product_id': self.led_lamp.id,
+ 'price_subtotal': 0.9,
+ 'price_subtotal_incl': 1.04,
+ 'qty': 1,
+ 'tax_ids': [(6, 0, self.led_lamp.taxes_id.ids)]}]],
+ 'name': 'Order 00042-003-0044',
+ 'partner_id': self.partner1.id,
+ 'pos_session_id': current_session.id,
+ 'sequence_number': 4,
+ 'statement_ids': [[0, 0, {
+ 'account_id': self.env.user.partner_id.
+ property_account_receivable_id.id,
+ 'amount': untax + atax,
+ 'journal_id': self.pos_sale_journal[0].id,
+ 'name': fields.Datetime.now(),
+ 'statement_id': current_session.statement_ids[0].id}]],
+ 'uid': '00042-003-0129',
+ 'user_id': self.env.uid
+ },
+ 'id': '00042-003-0129',
+ 'to_invoice': False
+ }
+ untax, atax = compute_tax(self.whiteboard_pen, 1.2)
+ self.PosOrder03 = self.PosOrder.browse(
+ self.PosOrder.create_from_ui([carrot_order]))
+ self.PosOrder.action_pos_order_paid()
+ self.PosOrder._send_order_cron()
+ current_session.action_pos_session_closing_control()
+
+ def test_04_pos_config_mail_print_partner_e_ticket(self):
+ """
+ POS config Email receipt and print it
+ Set Partner and also e-receipt
+ """
+ def compute_tax(product, price, qty=1, taxes=None):
+ if not taxes:
+ taxes = product.taxes_id.filtered(
+ lambda t: t.company_id.id == self.env.user.id)
+ currency = self.pos_config.pricelist_id.currency_id
+ res = taxes.compute_all(price, currency, qty, product=product)
+ untax = res['total_excluded']
+ return untax, sum(tax.get('amount', 0.0) for tax in res['taxes'])
+ self.ir_config_parameter.set_param('point_of_sale.receipt_options',
+ '2')
+ self.partner_3.email_pos_receipt = True
+ open_session = self.PosSession.search([
+ ('state', '!=', 'closed'),
+ ('config_id', '=', self.pos_config.id),
+ ('rescue', '=', False)
+ ])
+ if open_session:
+ current_session = open_session
+ else:
+ self.pos_config.open_session_cb()
+ current_session = self.pos_config.current_session_id
+ untax, atax = compute_tax(self.led_lamp, 0.9)
+ carrot_order = {
+ 'data': {
+ 'amount_paid': untax + atax,
+ 'amount_return': 0,
+ 'amount_tax': atax,
+ 'amount_total': untax + atax,
+ 'creation_date': fields.Datetime.to_string(
+ fields.Datetime.now()
+ ),
+ 'fiscal_position_id': False,
+ 'pricelist_id': self.pos_config.available_pricelist_ids[0].id,
+ 'lines': [[0, 0, {
+ 'discount': 0,
+ 'id': 45,
+ 'pack_lot_ids': [],
+ 'price_unit': 0.9,
+ 'product_id': self.led_lamp.id,
+ 'price_subtotal': 0.9,
+ 'price_subtotal_incl': 1.04,
+ 'qty': 1,
+ 'tax_ids': [(6, 0, self.led_lamp.taxes_id.ids)]}]],
+ 'name': 'Order 00042-003-0051',
+ 'partner_id': self.partner_3.id,
+ 'pos_session_id': current_session.id,
+ 'sequence_number': 4,
+ 'statement_ids': [[0, 0, {
+ 'account_id': self.env.user.partner_id.
+ property_account_receivable_id.id,
+ 'amount': untax + atax,
+ 'journal_id': self.pos_sale_journal[0].id,
+ 'name': fields.Datetime.now(),
+ 'statement_id': current_session.statement_ids[0].id}]],
+ 'uid': '00042-003-0151',
+ 'user_id': self.env.uid
+ },
+ 'id': '00042-003-0151',
+ 'to_invoice': False
+ }
+ untax, atax = compute_tax(self.whiteboard_pen, 1.2)
+ self.PosOrder04 = self.PosOrder.browse(
+ self.PosOrder.create_from_ui([carrot_order]))
+ self.PosOrder04.action_pos_order_paid()
+ self.PosOrder._send_order_cron()
+ current_session.action_pos_session_closing_control()
diff --git a/pos_ticket_send_by_mail/views/report_paperformat.xml b/pos_ticket_send_by_mail/views/report_paperformat.xml
new file mode 100755
index 0000000000..07a9c7010d
--- /dev/null
+++ b/pos_ticket_send_by_mail/views/report_paperformat.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ Point Of Sale Receipt
+
+ custom
+ 150
+ 60
+ Portrait
+ 3
+ 3
+ 3
+ 3
+
+ 3
+ 130
+
+
+
diff --git a/pos_ticket_send_by_mail/views/report_receipt.xml b/pos_ticket_send_by_mail/views/report_receipt.xml
new file mode 100755
index 0000000000..80d28420cb
--- /dev/null
+++ b/pos_ticket_send_by_mail/views/report_receipt.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+
+
+
+
+
+ User:
+
+
+ Date:
+
+
+
+
+
+
+
+
+
+ | Description |
+ Quantity |
+ Price |
+
+
+
+
+ |
+
+ |
+
+
+
+
+ |
+
+
+
+
+
+
+ %
+
+ |
+
+
+
+
+
+
+
+ |
+ Taxes
+ |
+
+
+ |
+
+
+ |
+ Total
+ |
+
+
+ |
+
+
+
+
+
+
+
+ | Payment Mode |
+ Amount |
+
+
+
+
+ |
+
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
diff --git a/pos_ticket_send_by_mail/views/view_pos_config_settings.xml b/pos_ticket_send_by_mail/views/view_pos_config_settings.xml
new file mode 100644
index 0000000000..aebb088e0d
--- /dev/null
+++ b/pos_ticket_send_by_mail/views/view_pos_config_settings.xml
@@ -0,0 +1,39 @@
+
+
+
+
+ res.config.settings.view.form.inherit.pos_ticket_send_by_mail
+
+ res.config.settings
+
+
+
+ Receipt Options
+
+
+
+
+
+
+ Select one of the receipting options for point of sales.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pos_ticket_send_by_mail/views/view_res_partner.xml b/pos_ticket_send_by_mail/views/view_res_partner.xml
new file mode 100644
index 0000000000..9576b07a9e
--- /dev/null
+++ b/pos_ticket_send_by_mail/views/view_res_partner.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ view_partner_form_inherit
+ res.partner
+
+
+
+
+
+
+
+
+
From a93580bd139f3f11d518dca100a3118da460e4e2 Mon Sep 17 00:00:00 2001
From: Chetan
Date: Tue, 3 Mar 2020 18:52:46 +0530
Subject: [PATCH 02/13] [FIX] pos_ticket_send_by_mail: Solve test case issue
Update fr.po
[UPD] Update pos_ticket_send_by_mail.pot
---
pos_ticket_send_by_mail/i18n/fr.po | 198 ++++++++++++++----
.../i18n/pos_ticket_send_by_mail.pot | 172 +++++++++++++++
.../tests/test_pos_ticket_mail.py | 13 +-
3 files changed, 336 insertions(+), 47 deletions(-)
create mode 100644 pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot
diff --git a/pos_ticket_send_by_mail/i18n/fr.po b/pos_ticket_send_by_mail/i18n/fr.po
index 23e6847f7e..dbda853ed9 100644
--- a/pos_ticket_send_by_mail/i18n/fr.po
+++ b/pos_ticket_send_by_mail/i18n/fr.po
@@ -1,6 +1,6 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
-# * pos_ticket_send_by_mail
+# * pos_ticket_send_by_mail
#
msgid ""
msgstr ""
@@ -10,87 +10,199 @@ msgstr ""
"PO-Revision-Date: 2018-08-17 09:04+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
+"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
+#. module: pos_ticket_send_by_mail
+#: model:mail.template,body_html:pos_ticket_send_by_mail.email_send_pos_receipt
+msgid ""
+"\n"
+" Thank you for your visit !
\n"
+" You will find your receipt ${object.pos_reference.split(' ')"
+"[1]} attached.
\n"
+" Sincerely,
\n"
+" The team of the cooperative
\n"
+" \n"
+" "
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:mail.template,subject:pos_ticket_send_by_mail.email_send_pos_receipt
+msgid ""
+"${object.user_id.company_id.name} Received ${object.pos_reference.split(' ')"
+"[1]}"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+msgid ""
+"
\n"
+" Date:"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+msgid "Taxes"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+msgid "Total"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+msgid "Amount"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model,name:pos_ticket_send_by_mail.model_res_config_settings
+msgid "Config Settings"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model,name:pos_ticket_send_by_mail.model_res_partner
+msgid "Contact"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+msgid "Description"
+msgstr ""
+
#. module: pos_ticket_send_by_mail
#: selection:pos.order,email_status:0
msgid "Do not Send"
msgstr "Do not Send"
#. module: pos_ticket_send_by_mail
-#: model:ir.model,name:pos_ticket_send_by_mail.model_res_partner
-msgid "Partner"
-msgstr "Partenaire"
+#: selection:res.config.settings,receipt_options:0
+msgid "Do not send receipt via email"
+msgstr "Ne pas envoyer le reçu par email"
#. module: pos_ticket_send_by_mail
-#: model:ir.model,name:pos_ticket_send_by_mail.model_pos_order
-msgid "Point of Sale"
-msgstr "Point de vente"
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_partner__email_pos_receipt
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_users__email_pos_receipt
+msgid "E-receipt"
+msgstr "Reçu électronique"
#. module: pos_ticket_send_by_mail
-#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_pos_config_is_print_receipt
-msgid "Print receipt when not sent email"
-msgstr "Ne pas imprimer de ticket s’il est envoyé par par email"
+#: selection:res.config.settings,receipt_options:0
+msgid "Email receipt and print it"
+msgstr "Envoyer le reçu par email et l'imprimer"
#. module: pos_ticket_send_by_mail
-#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_pos_order_email_status
-msgid "Send Status"
-msgstr "Send Status"
+#: selection:res.config.settings,receipt_options:0
+#, fuzzy
+msgid ""
+"Email receipt and print it unless configured on user that "
+"he only receives electronically"
+msgstr ""
+"Envoyer le reçu par email et l'imprimer sauf si ce partenaire est configuré "
+"pour recevoir uniquement le reçu électronique"
#. module: pos_ticket_send_by_mail
-#: selection:pos.order,email_status:0
-msgid "Sent"
-msgstr "Sent"
+#: model:ir.model.fields,help:pos_ticket_send_by_mail.field_res_partner__email_pos_receipt
+#: model:ir.model.fields,help:pos_ticket_send_by_mail.field_res_users__email_pos_receipt
+#, fuzzy
+msgid ""
+"If you tick this box and option 3 is selected for 'Receipt' in point "
+"of sale settings, the user will only receive e-receipt "
+msgstr ""
+"Si vous cochez cette case et que l'option 3 est sélectionnée dans la "
+"configuration générale du point de vente, ce partenaire recevra uniquement "
+"le reçu électronique"
#. module: pos_ticket_send_by_mail
-#: model:mail.template,report_name:pos_ticket_send_by_mail.email_send_pos_receipt
-msgid "Ticket ${object.pos_reference}"
-msgstr "Billet ${object.pos_reference}"
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+msgid "Payment Mode"
+msgstr ""
#. module: pos_ticket_send_by_mail
-#: selection:pos.order,email_status:0
-msgid "To send"
-msgstr "To send"
+#: model:ir.model,name:pos_ticket_send_by_mail.model_pos_order
+#, fuzzy
+msgid "Point of Sale Orders"
+msgstr "Point de vente"
#. module: pos_ticket_send_by_mail
-#: model:ir.model,name:pos_ticket_send_by_mail.model_pos_config
-msgid "pos.config"
-msgstr "pos.config"
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+msgid "Price"
+msgstr ""
#. module: pos_ticket_send_by_mail
-#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_pos_config_is_print_receipt
-msgid "Print receipt when not sent email"
-msgstr "Ne pas imprimer de ticket s’il est envoyé par par email"
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+msgid "Quantity"
+msgstr ""
#. module: pos_ticket_send_by_mail
-#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_pos_config_settings_receipt_options
+#: model:ir.actions.report,name:pos_ticket_send_by_mail.action_report_pos_receipt
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_config_settings__receipt_options
msgid "Receipt"
msgstr "Reçu"
#. module: pos_ticket_send_by_mail
-#: selection:pos.config.settings,receipt_options:0
-msgid "Do not send receipt via email"
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.view_res_config_settings_form_pos_inherit
+#, fuzzy
+msgid "Receipt Options"
+msgstr "Reçu"
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.view_res_config_settings_form_pos_inherit
+msgid "Select one of the receipting options for point of sales."
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.actions.server,name:pos_ticket_send_by_mail.ir_cron_sent_pos_ticket_ir_actions_server
+#: model:ir.cron,cron_name:pos_ticket_send_by_mail.ir_cron_sent_pos_ticket
+#: model:ir.cron,name:pos_ticket_send_by_mail.ir_cron_sent_pos_ticket
+#, fuzzy
+msgid "Send Reciept via Email"
msgstr "Ne pas envoyer le reçu par email"
#. module: pos_ticket_send_by_mail
-#: selection:pos.config.settings,receipt_options:0
-msgid "Email receipt and print it"
-msgstr "Envoyer le reçu par email et l'imprimer"
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_pos_order__email_status
+msgid "Send Status"
+msgstr "Send Status"
#. module: pos_ticket_send_by_mail
-#: selection:pos.config.settings,receipt_options:0
-msgid "Email receipt and print it unless configured on user that he only receives electronically"
-msgstr "Envoyer le reçu par email et l'imprimer sauf si ce partenaire est configuré pour recevoir uniquement le reçu électronique"
+#: selection:pos.order,email_status:0
+msgid "Sent"
+msgstr "Sent"
#. module: pos_ticket_send_by_mail
-#: model:ir.model.fields,help:pos_ticket_send_by_mail.field_res_partner_pos_ticket_send_by_mail
-msgid "If you tick this box and option 3 is selected for 'Receipt' in point of sale settings, the user will only receive e-receipt"
-msgstr "Si vous cochez cette case et que l'option 3 est sélectionnée dans la configuration générale du point de vente, ce partenaire recevra uniquement le reçu électronique"
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.view_res_config_settings_form_pos_inherit
+#, fuzzy
+msgid ""
+"There are three ways of obtaining a receipt: 1.Do not send receipt via email "
+"2.Email receipt and print it 3. Email receipt and print it unless configured "
+"on user that he only receives electronically"
+msgstr ""
+"Envoyer le reçu par email et l'imprimer sauf si ce partenaire est configuré "
+"pour recevoir uniquement le reçu électronique"
#. module: pos_ticket_send_by_mail
-#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_partner_pos_ticket_send_by_mail
-msgid "E-receipt"
-msgstr "Reçu électronique"
+#: model:mail.template,report_name:pos_ticket_send_by_mail.email_send_pos_receipt
+msgid "Ticket ${object.pos_reference}"
+msgstr "Billet ${object.pos_reference}"
+
+#. module: pos_ticket_send_by_mail
+#: selection:pos.order,email_status:0
+msgid "To send"
+msgstr "To send"
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+msgid "User:"
+msgstr ""
+
+#~ msgid "Partner"
+#~ msgstr "Partenaire"
+
+#~ msgid "Print receipt when not sent email"
+#~ msgstr "Ne pas imprimer de ticket s’il est envoyé par par email"
+
+#~ msgid "pos.config"
+#~ msgstr "pos.config"
diff --git a/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot b/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot
new file mode 100644
index 0000000000..8945f0ca09
--- /dev/null
+++ b/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot
@@ -0,0 +1,172 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * pos_ticket_send_by_mail
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 12.0\n"
+"Report-Msgid-Bugs-To: \n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: pos_ticket_send_by_mail
+#: model:mail.template,body_html:pos_ticket_send_by_mail.email_send_pos_receipt
+msgid "\n"
+" Thank you for your visit !
\n"
+" You will find your receipt ${object.pos_reference.split(' ')[1]} attached.
\n"
+" Sincerely,
\n"
+" The team of the cooperative
\n"
+" \n"
+" "
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:mail.template,subject:pos_ticket_send_by_mail.email_send_pos_receipt
+msgid "${object.user_id.company_id.name} Received ${object.pos_reference.split(' ')[1]}"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+msgid "
\n"
+" Date:"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+msgid "Taxes"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+msgid "Total"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+msgid "Amount"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model,name:pos_ticket_send_by_mail.model_res_config_settings
+msgid "Config Settings"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model,name:pos_ticket_send_by_mail.model_res_partner
+msgid "Contact"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+msgid "Description"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: selection:pos.order,email_status:0
+msgid "Do not Send"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: selection:res.config.settings,receipt_options:0
+msgid "Do not send receipt via email"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_partner__email_pos_receipt
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_users__email_pos_receipt
+msgid "E-receipt"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: selection:res.config.settings,receipt_options:0
+msgid "Email receipt and print it"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: selection:res.config.settings,receipt_options:0
+msgid "Email receipt and print it unless configured on user that he only receives electronically"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model.fields,help:pos_ticket_send_by_mail.field_res_partner__email_pos_receipt
+#: model:ir.model.fields,help:pos_ticket_send_by_mail.field_res_users__email_pos_receipt
+msgid "If you tick this box and option 3 is selected for 'Receipt' in point of sale settings, the user will only receive e-receipt "
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+msgid "Payment Mode"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model,name:pos_ticket_send_by_mail.model_pos_order
+msgid "Point of Sale Orders"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+msgid "Price"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+msgid "Quantity"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.actions.report,name:pos_ticket_send_by_mail.action_report_pos_receipt
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_config_settings__receipt_options
+msgid "Receipt"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.view_res_config_settings_form_pos_inherit
+msgid "Receipt Options"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.view_res_config_settings_form_pos_inherit
+msgid "Select one of the receipting options for point of sales."
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.actions.server,name:pos_ticket_send_by_mail.ir_cron_sent_pos_ticket_ir_actions_server
+#: model:ir.cron,cron_name:pos_ticket_send_by_mail.ir_cron_sent_pos_ticket
+#: model:ir.cron,name:pos_ticket_send_by_mail.ir_cron_sent_pos_ticket
+msgid "Send Reciept via Email"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_pos_order__email_status
+msgid "Send Status"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: selection:pos.order,email_status:0
+msgid "Sent"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.view_res_config_settings_form_pos_inherit
+msgid "There are three ways of obtaining a receipt: 1.Do not send receipt via email 2.Email receipt and print it 3. Email receipt and print it unless configured on user that he only receives electronically"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model:mail.template,report_name:pos_ticket_send_by_mail.email_send_pos_receipt
+msgid "Ticket ${object.pos_reference}"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: selection:pos.order,email_status:0
+msgid "To send"
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+msgid "User:"
+msgstr ""
+
diff --git a/pos_ticket_send_by_mail/tests/test_pos_ticket_mail.py b/pos_ticket_send_by_mail/tests/test_pos_ticket_mail.py
index 4228e498cf..782c12ae04 100644
--- a/pos_ticket_send_by_mail/tests/test_pos_ticket_mail.py
+++ b/pos_ticket_send_by_mail/tests/test_pos_ticket_mail.py
@@ -10,9 +10,14 @@ def setUp(self):
self.ir_config_parameter = self.env['ir.config_parameter']
self.PosOrder = self.env['pos.order']
self.partner1 = self.env.ref('base.res_partner_1')
- self.pos_config = self.env['pos.config'].create({
- 'name': 'test_pos_email',
- })
+ self.posconfig = self.env['pos.config']
+ self.pos_config = self.posconfig.search([
+ ('name', '=', 'test_pos_email')
+ ], limit=1)
+ if not self.pos_config:
+ self.pos_config = self.posconfig.create({
+ 'name': 'test_pos_email',
+ })
self.res_users = self.env['res.users']
self.pos_user = self.res_users.search([
('login', '=', 'pos_test_email')
@@ -26,7 +31,7 @@ def setUp(self):
self.pos_session = self.env['pos.session']
self.PosSession = self.pos_session.search([
('user_id', '=', self.pos_user.id)
- ])
+ ], limit=1)
if not self.PosSession:
self.PosSession = self.env['pos.session'].create({
'user_id': self.pos_user.id,
From 539e511ce4deeff672602b3ffae81cc48851fda0 Mon Sep 17 00:00:00 2001
From: Chetan
Date: Thu, 5 Mar 2020 12:07:30 +0530
Subject: [PATCH 03/13] Optimise the code
---
pos_ticket_send_by_mail/data/ir_cron_data.xml | 1 -
pos_ticket_send_by_mail/models/pos_order.py | 1 -
2 files changed, 2 deletions(-)
diff --git a/pos_ticket_send_by_mail/data/ir_cron_data.xml b/pos_ticket_send_by_mail/data/ir_cron_data.xml
index 18d0c06cea..c83c932b8e 100644
--- a/pos_ticket_send_by_mail/data/ir_cron_data.xml
+++ b/pos_ticket_send_by_mail/data/ir_cron_data.xml
@@ -10,7 +10,6 @@
model._send_order_cron()
code
-
diff --git a/pos_ticket_send_by_mail/models/pos_order.py b/pos_ticket_send_by_mail/models/pos_order.py
index e8b2080133..30674e1160 100644
--- a/pos_ticket_send_by_mail/models/pos_order.py
+++ b/pos_ticket_send_by_mail/models/pos_order.py
@@ -9,7 +9,6 @@
class PosOrder(models.Model):
-
_inherit = 'pos.order'
email_status = fields.Selection([
From acd1da16d985b88f05dd1742888ece9f3d64ce28 Mon Sep 17 00:00:00 2001
From: druidoo-transbot
Date: Thu, 9 Apr 2020 07:49:17 +0000
Subject: [PATCH 04/13] [UPD] Update pos_ticket_send_by_mail.pot
---
pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot b/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot
index 8945f0ca09..983b6db644 100644
--- a/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot
+++ b/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot
@@ -72,6 +72,7 @@ msgstr ""
#. module: pos_ticket_send_by_mail
#: selection:res.config.settings,receipt_options:0
+#: selection:user.config.settings,receipt_options:0
msgid "Do not send receipt via email"
msgstr ""
@@ -83,11 +84,13 @@ msgstr ""
#. module: pos_ticket_send_by_mail
#: selection:res.config.settings,receipt_options:0
+#: selection:user.config.settings,receipt_options:0
msgid "Email receipt and print it"
msgstr ""
#. module: pos_ticket_send_by_mail
#: selection:res.config.settings,receipt_options:0
+#: selection:user.config.settings,receipt_options:0
msgid "Email receipt and print it unless configured on user that he only receives electronically"
msgstr ""
@@ -120,6 +123,7 @@ msgstr ""
#. module: pos_ticket_send_by_mail
#: model:ir.actions.report,name:pos_ticket_send_by_mail.action_report_pos_receipt
#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_config_settings__receipt_options
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_user_config_settings__receipt_options
msgid "Receipt"
msgstr ""
From c97407f0e365420045538c478d5483f0b15e3b47 Mon Sep 17 00:00:00 2001
From: siddharth
Date: Sun, 19 Apr 2020 12:29:31 +0530
Subject: [PATCH 05/13] [IMP] pos_ticket_send_by_mail: email templates are
no_update = True
---
pos_ticket_send_by_mail/data/email_template_data.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pos_ticket_send_by_mail/data/email_template_data.xml b/pos_ticket_send_by_mail/data/email_template_data.xml
index 8d08912d32..cfee34d3c8 100644
--- a/pos_ticket_send_by_mail/data/email_template_data.xml
+++ b/pos_ticket_send_by_mail/data/email_template_data.xml
@@ -1,5 +1,5 @@
-
+
From 11c2faa55899e24fff533815e62c8ba142ed8e13 Mon Sep 17 00:00:00 2001
From: Chetan
Date: Thu, 23 Apr 2020 10:47:30 +0530
Subject: [PATCH 06/13] Solve tranlsation issue.
---
pos_ticket_send_by_mail/i18n/email_pos_receipt.pot | 8 ++++++--
pos_ticket_send_by_mail/i18n/fr.po | 4 +---
.../i18n/pos_ticket_send_by_mail.pot | 11 +++++++----
3 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/pos_ticket_send_by_mail/i18n/email_pos_receipt.pot b/pos_ticket_send_by_mail/i18n/email_pos_receipt.pot
index bfb61e15ef..c9ed316fca 100644
--- a/pos_ticket_send_by_mail/i18n/email_pos_receipt.pot
+++ b/pos_ticket_send_by_mail/i18n/email_pos_receipt.pot
@@ -54,9 +54,13 @@ msgid "Email receipt and print it"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: selection:pos.config.settings,receipt_options:0
-msgid "Email receipt and print it unless configured on user that he only receives electronically"
+#: selection:res.config.settings,receipt_options:0
+msgid ""
+"Email receipt and print it unless configured on user that "
+"he only receives electronically"
msgstr ""
+"Envoyer le reçu par email et l'imprimer sauf si ce partenaire est configuré "
+"pour recevoir uniquement le reçu électronique"
#. module: pos_ticket_send_by_mail
#: model:ir.model.fields,help:pos_ticket_send_by_mail.field_res_partner_pos_ticket_send_by_mail
diff --git a/pos_ticket_send_by_mail/i18n/fr.po b/pos_ticket_send_by_mail/i18n/fr.po
index dbda853ed9..19486b0979 100644
--- a/pos_ticket_send_by_mail/i18n/fr.po
+++ b/pos_ticket_send_by_mail/i18n/fr.po
@@ -96,7 +96,6 @@ msgstr "Envoyer le reçu par email et l'imprimer"
#. module: pos_ticket_send_by_mail
#: selection:res.config.settings,receipt_options:0
-#, fuzzy
msgid ""
"Email receipt and print it unless configured on user that "
"he only receives electronically"
@@ -145,14 +144,13 @@ msgstr "Reçu"
#. module: pos_ticket_send_by_mail
#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.view_res_config_settings_form_pos_inherit
-#, fuzzy
msgid "Receipt Options"
msgstr "Reçu"
#. module: pos_ticket_send_by_mail
#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.view_res_config_settings_form_pos_inherit
msgid "Select one of the receipting options for point of sales."
-msgstr ""
+msgstr "Sélectionnez une des options de reçu pour le point de vente"
#. module: pos_ticket_send_by_mail
#: model:ir.actions.server,name:pos_ticket_send_by_mail.ir_cron_sent_pos_ticket_ir_actions_server
diff --git a/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot b/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot
index 983b6db644..fcd4d05331 100644
--- a/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot
+++ b/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot
@@ -90,9 +90,12 @@ msgstr ""
#. module: pos_ticket_send_by_mail
#: selection:res.config.settings,receipt_options:0
-#: selection:user.config.settings,receipt_options:0
-msgid "Email receipt and print it unless configured on user that he only receives electronically"
+msgid ""
+"Email receipt and print it unless configured on user that "
+"he only receives electronically"
msgstr ""
+"Envoyer le reçu par email et l'imprimer sauf si ce partenaire est configuré "
+"pour recevoir uniquement le reçu électronique"
#. module: pos_ticket_send_by_mail
#: model:ir.model.fields,help:pos_ticket_send_by_mail.field_res_partner__email_pos_receipt
@@ -130,12 +133,12 @@ msgstr ""
#. module: pos_ticket_send_by_mail
#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.view_res_config_settings_form_pos_inherit
msgid "Receipt Options"
-msgstr ""
+msgstr "Reçu"
#. module: pos_ticket_send_by_mail
#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.view_res_config_settings_form_pos_inherit
msgid "Select one of the receipting options for point of sales."
-msgstr ""
+msgstr "Sélectionnez une des options de reçu pour le point de vente"
#. module: pos_ticket_send_by_mail
#: model:ir.actions.server,name:pos_ticket_send_by_mail.ir_cron_sent_pos_ticket_ir_actions_server
From 07c196e4e54d4a603bcc892346df167568ec45d1 Mon Sep 17 00:00:00 2001
From: druidoo-transbot
Date: Thu, 23 Apr 2020 07:18:14 +0000
Subject: [PATCH 07/13] [UPD] Update pos_ticket_send_by_mail.pot
---
.../i18n/pos_ticket_send_by_mail.pot | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot b/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot
index fcd4d05331..983b6db644 100644
--- a/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot
+++ b/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot
@@ -90,12 +90,9 @@ msgstr ""
#. module: pos_ticket_send_by_mail
#: selection:res.config.settings,receipt_options:0
-msgid ""
-"Email receipt and print it unless configured on user that "
-"he only receives electronically"
+#: selection:user.config.settings,receipt_options:0
+msgid "Email receipt and print it unless configured on user that he only receives electronically"
msgstr ""
-"Envoyer le reçu par email et l'imprimer sauf si ce partenaire est configuré "
-"pour recevoir uniquement le reçu électronique"
#. module: pos_ticket_send_by_mail
#: model:ir.model.fields,help:pos_ticket_send_by_mail.field_res_partner__email_pos_receipt
@@ -133,12 +130,12 @@ msgstr ""
#. module: pos_ticket_send_by_mail
#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.view_res_config_settings_form_pos_inherit
msgid "Receipt Options"
-msgstr "Reçu"
+msgstr ""
#. module: pos_ticket_send_by_mail
#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.view_res_config_settings_form_pos_inherit
msgid "Select one of the receipting options for point of sales."
-msgstr "Sélectionnez une des options de reçu pour le point de vente"
+msgstr ""
#. module: pos_ticket_send_by_mail
#: model:ir.actions.server,name:pos_ticket_send_by_mail.ir_cron_sent_pos_ticket_ir_actions_server
From 2de8d9afe142ebdea184887133506cd9ec88df29 Mon Sep 17 00:00:00 2001
From: druidoo-transbot
Date: Wed, 29 Apr 2020 09:36:51 +0000
Subject: [PATCH 08/13] [UPD] pos_ticket_send_by_mail: Update
pos_ticket_send_by_mail.pot
[FIX] pos_ticket_send_by_mail: ir.config_paramenter access error
[IMP] pos_ticket_send_by_mail
[UPD] pos_ticket_send_by_mail: Translated using Weblate (French)
Currently translated at 44.8% (13 of 29 strings)
Translation: foodcoops-12.0/foodcoops-12.0-pos_ticket_send_by_mail
Translate-URL: http://example.com/projects/foodcoops-12-0/foodcoops-12-0-pos_ticket_send_by_mail/fr/
[ADD] pos_ticket_send_by_mail: icon.png
---
pos_ticket_send_by_mail/i18n/fr.po | 14 ++++++++------
.../i18n/pos_ticket_send_by_mail.pot | 4 ----
.../static/description/icon.png | Bin 0 -> 9673 bytes
.../tests/test_pos_ticket_mail.py | 2 +-
.../views/view_res_partner.xml | 2 +-
5 files changed, 10 insertions(+), 12 deletions(-)
create mode 100644 pos_ticket_send_by_mail/static/description/icon.png
diff --git a/pos_ticket_send_by_mail/i18n/fr.po b/pos_ticket_send_by_mail/i18n/fr.po
index 19486b0979..42dc11840d 100644
--- a/pos_ticket_send_by_mail/i18n/fr.po
+++ b/pos_ticket_send_by_mail/i18n/fr.po
@@ -7,14 +7,16 @@ msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-08-17 09:04+0000\n"
-"PO-Revision-Date: 2018-08-17 09:04+0000\n"
-"Last-Translator: <>\n"
-"Language-Team: \n"
-"Language: \n"
+"PO-Revision-Date: 2020-06-17 09:04+0000\n"
+"Last-Translator: Weblate Admin \n"
+"Language-Team: French \n"
+"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
-"Plural-Forms: \n"
+"Plural-Forms: nplurals=2; plural=n > 1;\n"
+"X-Generator: Weblate 3.8\n"
#. module: pos_ticket_send_by_mail
#: model:mail.template,body_html:pos_ticket_send_by_mail.email_send_pos_receipt
@@ -56,7 +58,7 @@ msgstr ""
#. module: pos_ticket_send_by_mail
#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
msgid "Amount"
-msgstr ""
+msgstr "Montant"
#. module: pos_ticket_send_by_mail
#: model:ir.model,name:pos_ticket_send_by_mail.model_res_config_settings
diff --git a/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot b/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot
index 983b6db644..8945f0ca09 100644
--- a/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot
+++ b/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot
@@ -72,7 +72,6 @@ msgstr ""
#. module: pos_ticket_send_by_mail
#: selection:res.config.settings,receipt_options:0
-#: selection:user.config.settings,receipt_options:0
msgid "Do not send receipt via email"
msgstr ""
@@ -84,13 +83,11 @@ msgstr ""
#. module: pos_ticket_send_by_mail
#: selection:res.config.settings,receipt_options:0
-#: selection:user.config.settings,receipt_options:0
msgid "Email receipt and print it"
msgstr ""
#. module: pos_ticket_send_by_mail
#: selection:res.config.settings,receipt_options:0
-#: selection:user.config.settings,receipt_options:0
msgid "Email receipt and print it unless configured on user that he only receives electronically"
msgstr ""
@@ -123,7 +120,6 @@ msgstr ""
#. module: pos_ticket_send_by_mail
#: model:ir.actions.report,name:pos_ticket_send_by_mail.action_report_pos_receipt
#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_config_settings__receipt_options
-#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_user_config_settings__receipt_options
msgid "Receipt"
msgstr ""
diff --git a/pos_ticket_send_by_mail/static/description/icon.png b/pos_ticket_send_by_mail/static/description/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..fd60220fbe2d7465dd81af8ca6d5af032879c144
GIT binary patch
literal 9673
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
-
+
From 4a713177ba81a4f459274becfe44dc194cd281d9 Mon Sep 17 00:00:00 2001
From: Simon Mas
Date: Wed, 1 Jul 2020 09:24:09 +0000
Subject: [PATCH 09/13] Translated using Weblate (French)
Currently translated at 51.7% (15 of 29 strings)
Translation: foodcoops-12.0/foodcoops-12.0-pos_ticket_send_by_mail
Translate-URL: https://translate.druidoo.io/projects/foodcoops-12-0/foodcoops-12-0-pos_ticket_send_by_mail/fr/
---
pos_ticket_send_by_mail/i18n/fr.po | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/pos_ticket_send_by_mail/i18n/fr.po b/pos_ticket_send_by_mail/i18n/fr.po
index 42dc11840d..69da6a5c6a 100644
--- a/pos_ticket_send_by_mail/i18n/fr.po
+++ b/pos_ticket_send_by_mail/i18n/fr.po
@@ -7,9 +7,9 @@ msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-08-17 09:04+0000\n"
-"PO-Revision-Date: 2020-06-17 09:04+0000\n"
-"Last-Translator: Weblate Admin \n"
-"Language-Team: French \n"
+"Language-Team: French \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
@@ -53,7 +53,7 @@ msgstr ""
#. module: pos_ticket_send_by_mail
#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
msgid "Total"
-msgstr ""
+msgstr "Total"
#. module: pos_ticket_send_by_mail
#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
@@ -131,7 +131,7 @@ msgstr "Point de vente"
#. module: pos_ticket_send_by_mail
#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
msgid "Price"
-msgstr ""
+msgstr "Prix"
#. module: pos_ticket_send_by_mail
#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
From f21a713faf94f8438b4a36587106d1abfdbb4af7 Mon Sep 17 00:00:00 2001
From: Nguyen Minh Chien
Date: Mon, 23 Aug 2021 02:17:50 +0000
Subject: [PATCH 10/13] [UPD] pos_ticket_send_by_mail: Help with test of mass
mailing
---
pos_ticket_send_by_mail/data/email_template_data.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pos_ticket_send_by_mail/data/email_template_data.xml b/pos_ticket_send_by_mail/data/email_template_data.xml
index cfee34d3c8..fdcde00e93 100644
--- a/pos_ticket_send_by_mail/data/email_template_data.xml
+++ b/pos_ticket_send_by_mail/data/email_template_data.xml
@@ -5,7 +5,7 @@
Send Received
ticket@${object.user_id.company_id.email.split('@')[1] or ''|safe}
- ${object.user_id.company_id.name} Received ${object.pos_reference.split(' ')[1]}
+ ${object.user_id.company_id.name} Received ${object.pos_reference and object.pos_reference.split(' ')[1] or ''}
${object.partner_id.id}
@@ -14,7 +14,7 @@
${object.partner_id.lang}
Thank you for your visit !
- You will find your receipt ${object.pos_reference.split(' ')[1]} attached.
+ You will find your receipt ${object.pos_reference and object.pos_reference.split(' ')[1] or ''} attached.
Sincerely,
The team of the cooperative
]]>
From e2827b3f8b50b459c6cc39939e1efe03a70542e2 Mon Sep 17 00:00:00 2001
From: Nguyen Minh Chien
Date: Mon, 24 Apr 2023 02:13:47 +0000
Subject: [PATCH 11/13] [ADD] pos_ticket_send_by_mail: Automatic POS receipt by
mail, except for specific members
[UPD] pos_ticket_send_by_mail: Product Returns and Refunds on POS
---
pos_ticket_send_by_mail/i18n/fr.po | 11 +++++++++++
.../i18n/pos_ticket_send_by_mail.pot | 11 +++++++++++
pos_ticket_send_by_mail/models/pos_order.py | 10 +++++++---
.../models/res_config_settings.py | 3 ++-
pos_ticket_send_by_mail/models/res_partner.py | 14 ++++++++++++++
pos_ticket_send_by_mail/views/view_res_partner.xml | 8 +++++++-
6 files changed, 52 insertions(+), 5 deletions(-)
diff --git a/pos_ticket_send_by_mail/i18n/fr.po b/pos_ticket_send_by_mail/i18n/fr.po
index 69da6a5c6a..90958129c4 100644
--- a/pos_ticket_send_by_mail/i18n/fr.po
+++ b/pos_ticket_send_by_mail/i18n/fr.po
@@ -91,6 +91,11 @@ msgstr "Ne pas envoyer le reçu par email"
msgid "E-receipt"
msgstr "Reçu électronique"
+#. module: pos_ticket_send_by_mail
+#: selection:res.config.settings,receipt_options:0
+msgid "Email receipt"
+msgstr "Envoyer le reçu par email"
+
#. module: pos_ticket_send_by_mail
#: selection:res.config.settings,receipt_options:0
msgid "Email receipt and print it"
@@ -117,6 +122,12 @@ msgstr ""
"configuration générale du point de vente, ce partenaire recevra uniquement "
"le reçu électronique"
+#. module: pos_ticket_send_by_mail
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_partner__no_email_pos_receipt
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_users__no_email_pos_receipt
+msgid "No E-receipt"
+msgstr "Pas Reçu électronique"
+
#. module: pos_ticket_send_by_mail
#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
msgid "Payment Mode"
diff --git a/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot b/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot
index 8945f0ca09..3e897cda8d 100644
--- a/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot
+++ b/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot
@@ -81,6 +81,11 @@ msgstr ""
msgid "E-receipt"
msgstr ""
+#. module: pos_ticket_send_by_mail
+#: selection:res.config.settings,receipt_options:0
+msgid "Email receipt"
+msgstr ""
+
#. module: pos_ticket_send_by_mail
#: selection:res.config.settings,receipt_options:0
msgid "Email receipt and print it"
@@ -97,6 +102,12 @@ msgstr ""
msgid "If you tick this box and option 3 is selected for 'Receipt' in point of sale settings, the user will only receive e-receipt "
msgstr ""
+#. module: pos_ticket_send_by_mail
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_partner__no_email_pos_receipt
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_users__no_email_pos_receipt
+msgid "No E-receipt"
+msgstr ""
+
#. module: pos_ticket_send_by_mail
#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
msgid "Payment Mode"
diff --git a/pos_ticket_send_by_mail/models/pos_order.py b/pos_ticket_send_by_mail/models/pos_order.py
index 30674e1160..3773bcd49f 100644
--- a/pos_ticket_send_by_mail/models/pos_order.py
+++ b/pos_ticket_send_by_mail/models/pos_order.py
@@ -15,7 +15,7 @@ class PosOrder(models.Model):
('no_send', 'Do not Send'),
('to_send', 'To send'),
('sent', 'Sent')],
- default="no_send", string="Send Status")
+ default="no_send", copy=False, string="Send Status")
@api.model
def _send_order_cron(self):
@@ -37,10 +37,14 @@ def action_pos_order_paid(self):
# receipt_option = 1: Don't send e-receipt
# receipt_option = 2 or 3: Send e-receipt
res = super(PosOrder, self).action_pos_order_paid()
+ self._set_order_to_send()
+ return res
+
+ def _set_order_to_send(self):
icp_sudo = self.env['ir.config_parameter'].sudo()
receipt_options = icp_sudo.get_param('point_of_sale.receipt_options')
receipt_options = receipt_options and int(receipt_options) or False
for order in self:
- if receipt_options in [2, 3] and order.partner_id.email:
+ if receipt_options in [2, 3, 4] and order.partner_id.email and \
+ not order.partner_id.no_email_pos_receipt:
order.email_status = 'to_send'
- return res
diff --git a/pos_ticket_send_by_mail/models/res_config_settings.py b/pos_ticket_send_by_mail/models/res_config_settings.py
index 0d98727eaa..362fa88b1a 100644
--- a/pos_ticket_send_by_mail/models/res_config_settings.py
+++ b/pos_ticket_send_by_mail/models/res_config_settings.py
@@ -14,7 +14,8 @@ class ResConfigSettings(models.TransientModel):
('1', 'Do not send receipt via email'),
('2', 'Email receipt and print it'),
('3', 'Email receipt and print it unless configured on user that \
- he only receives electronically')
+ he only receives electronically'),
+ ('4', 'Email receipt')
], string="Receipt",
config_parameter='point_of_sale.receipt_options'
)
diff --git a/pos_ticket_send_by_mail/models/res_partner.py b/pos_ticket_send_by_mail/models/res_partner.py
index d913468c25..802ff89181 100644
--- a/pos_ticket_send_by_mail/models/res_partner.py
+++ b/pos_ticket_send_by_mail/models/res_partner.py
@@ -14,3 +14,17 @@ class ResPartner(models.Model):
default=False,
help="If you tick this box and option 3 is selected for 'Receipt'\
in point of sale settings, the user will only receive e-receipt ")
+ no_email_pos_receipt = fields.Boolean(
+ string="No E-receipt",
+ default=False,
+ help="If you tick this box, the user will not receive e-receipt ")
+ config_receipt_options = fields.Integer(
+ compute="_compute_config_receipt_options"
+ )
+
+ def _compute_config_receipt_options(self):
+ icp_sudo = self.env['ir.config_parameter'].sudo()
+ receipt_options = icp_sudo.get_param('point_of_sale.receipt_options')
+ receipt_options = receipt_options and int(receipt_options) or 0
+ for record in self:
+ record.config_receipt_options = receipt_options
diff --git a/pos_ticket_send_by_mail/views/view_res_partner.xml b/pos_ticket_send_by_mail/views/view_res_partner.xml
index 8417a574ff..3806343c6b 100644
--- a/pos_ticket_send_by_mail/views/view_res_partner.xml
+++ b/pos_ticket_send_by_mail/views/view_res_partner.xml
@@ -7,7 +7,13 @@
-
+
+
+
From f8194090cf9161b4b16ea6fca25c364d49ac6f83 Mon Sep 17 00:00:00 2001
From: phucph
Date: Thu, 16 Oct 2025 10:25:21 +0700
Subject: [PATCH 12/13] [IMP] pos_ticket_send_by_mail: pre-commit auto fixes
---
pos_ticket_send_by_mail/__manifest__.py | 36 +-
.../data/email_template_data.xml | 22 +-
pos_ticket_send_by_mail/data/ir_cron_data.xml | 6 +-
pos_ticket_send_by_mail/models/pos_order.py | 39 +-
.../models/res_config_settings.py | 49 +-
pos_ticket_send_by_mail/models/res_partner.py | 12 +-
pos_ticket_send_by_mail/pyproject.toml | 3 +
.../static/src/js/pos_model.js | 30 +-
.../static/src/js/receipt_screen_widget.js | 48 +-
.../static/src/xml/templates.xml | 16 +-
pos_ticket_send_by_mail/tests/__init__.py | 1 -
.../tests/test_pos_ticket_mail.py | 522 ++++++++++--------
.../views/report_paperformat.xml | 4 +-
.../views/report_receipt.xml | 40 +-
.../views/view_pos_config_settings.xml | 29 +-
.../views/view_res_partner.xml | 14 +-
16 files changed, 484 insertions(+), 387 deletions(-)
create mode 100644 pos_ticket_send_by_mail/pyproject.toml
diff --git a/pos_ticket_send_by_mail/__manifest__.py b/pos_ticket_send_by_mail/__manifest__.py
index 6eff25f9fa..03a070ee55 100644
--- a/pos_ticket_send_by_mail/__manifest__.py
+++ b/pos_ticket_send_by_mail/__manifest__.py
@@ -4,24 +4,24 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html
{
- 'name': 'POS Receipt By Email',
- 'version': '12.0.1.0.0',
- 'category': 'Custom',
- 'author': 'Druidoo',
- 'website': 'https://www.druidoo.io',
- 'license': 'AGPL-3',
- 'depends': [
- 'point_of_sale',
+ "name": "POS Receipt By Email",
+ "version": "12.0.1.0.0",
+ "category": "Custom",
+ "author": "Druidoo",
+ "website": "https://github.com/OCA/pos",
+ "license": "AGPL-3",
+ "depends": [
+ "point_of_sale",
],
- 'data': [
- 'security/ir.model.access.csv',
- 'views/report_paperformat.xml',
- 'views/view_pos_config_settings.xml',
- 'data/email_template_data.xml',
- 'data/ir_cron_data.xml',
- 'views/view_res_partner.xml',
- 'views/report_receipt.xml',
- 'static/src/xml/templates.xml',
+ "data": [
+ "security/ir.model.access.csv",
+ "views/report_paperformat.xml",
+ "views/view_pos_config_settings.xml",
+ "data/email_template_data.xml",
+ "data/ir_cron_data.xml",
+ "views/view_res_partner.xml",
+ "views/report_receipt.xml",
+ "static/src/xml/templates.xml",
],
- 'installable': True,
+ "installable": True,
}
diff --git a/pos_ticket_send_by_mail/data/email_template_data.xml b/pos_ticket_send_by_mail/data/email_template_data.xml
index fdcde00e93..3f02bb77a9 100644
--- a/pos_ticket_send_by_mail/data/email_template_data.xml
+++ b/pos_ticket_send_by_mail/data/email_template_data.xml
@@ -1,18 +1,26 @@
-
+
-
Send Received
- ticket@${object.user_id.company_id.email.split('@')[1] or ''|safe}
- ${object.user_id.company_id.name} Received ${object.pos_reference and object.pos_reference.split(' ')[1] or ''}
+ ticket@${object.user_id.company_id.email.split('@')[1] or ''|safe}
+ ${object.user_id.company_id.name} Received ${object.pos_reference and object.pos_reference.split(' ')[1] or ''}
${object.partner_id.id}
-
+
Ticket ${object.pos_reference}
${object.partner_id.lang}
- Thank you for your visit !
You will find your receipt ${object.pos_reference and object.pos_reference.split(' ')[1] or ''} attached.
Sincerely,
@@ -20,6 +28,4 @@
]]>
-
-
diff --git a/pos_ticket_send_by_mail/data/ir_cron_data.xml b/pos_ticket_send_by_mail/data/ir_cron_data.xml
index c83c932b8e..1858551025 100644
--- a/pos_ticket_send_by_mail/data/ir_cron_data.xml
+++ b/pos_ticket_send_by_mail/data/ir_cron_data.xml
@@ -1,15 +1,13 @@
-
+
-
Send Reciept via Email
1
minutes
-1
-
+
model._send_order_cron()
code
-
diff --git a/pos_ticket_send_by_mail/models/pos_order.py b/pos_ticket_send_by_mail/models/pos_order.py
index 3773bcd49f..8895bef5fa 100644
--- a/pos_ticket_send_by_mail/models/pos_order.py
+++ b/pos_ticket_send_by_mail/models/pos_order.py
@@ -3,29 +3,31 @@
# @author: La Louve
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html
-from odoo import models, fields, api
import logging
+
+from odoo import api, fields, models
+
_logger = logging.getLogger(__name__)
class PosOrder(models.Model):
- _inherit = 'pos.order'
+ _inherit = "pos.order"
- email_status = fields.Selection([
- ('no_send', 'Do not Send'),
- ('to_send', 'To send'),
- ('sent', 'Sent')],
- default="no_send", copy=False, string="Send Status")
+ email_status = fields.Selection(
+ [("no_send", "Do not Send"), ("to_send", "To send"), ("sent", "Sent")],
+ default="no_send",
+ copy=False,
+ string="Send Status",
+ )
@api.model
def _send_order_cron(self):
_logger.info("------------------------------------------------------")
- mail_template = self.env.ref(
- "pos_ticket_send_by_mail.email_send_pos_receipt")
+ mail_template = self.env.ref("pos_ticket_send_by_mail.email_send_pos_receipt")
_logger.info("Start to send ticket")
- for order in self.search([('email_status', '=', 'to_send')]):
+ for order in self.search([("email_status", "=", "to_send")]):
mail_template.send_mail(order.id, force_send=True)
- order.email_status = 'sent'
+ order.email_status = "sent"
# Make sure we commit the change to not send ticket twice
self.env.cr.commit()
@@ -36,15 +38,18 @@ def action_pos_order_paid(self):
# that we config in pos.config.settings
# receipt_option = 1: Don't send e-receipt
# receipt_option = 2 or 3: Send e-receipt
- res = super(PosOrder, self).action_pos_order_paid()
+ res = super().action_pos_order_paid()
self._set_order_to_send()
return res
def _set_order_to_send(self):
- icp_sudo = self.env['ir.config_parameter'].sudo()
- receipt_options = icp_sudo.get_param('point_of_sale.receipt_options')
+ icp_sudo = self.env["ir.config_parameter"].sudo()
+ receipt_options = icp_sudo.get_param("point_of_sale.receipt_options")
receipt_options = receipt_options and int(receipt_options) or False
for order in self:
- if receipt_options in [2, 3, 4] and order.partner_id.email and \
- not order.partner_id.no_email_pos_receipt:
- order.email_status = 'to_send'
+ if (
+ receipt_options in [2, 3, 4]
+ and order.partner_id.email
+ and not order.partner_id.no_email_pos_receipt
+ ):
+ order.email_status = "to_send"
diff --git a/pos_ticket_send_by_mail/models/res_config_settings.py b/pos_ticket_send_by_mail/models/res_config_settings.py
index 362fa88b1a..928f8159e3 100644
--- a/pos_ticket_send_by_mail/models/res_config_settings.py
+++ b/pos_ticket_send_by_mail/models/res_config_settings.py
@@ -3,44 +3,51 @@
# @author: La Louve
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html
-from odoo import models, fields, api
+from odoo import api, fields, models
class ResConfigSettings(models.TransientModel):
- _inherit = 'res.config.settings'
+ _inherit = "res.config.settings"
receipt_options = fields.Selection(
[
- ('1', 'Do not send receipt via email'),
- ('2', 'Email receipt and print it'),
- ('3', 'Email receipt and print it unless configured on user that \
- he only receives electronically'),
- ('4', 'Email receipt')
- ], string="Receipt",
- config_parameter='point_of_sale.receipt_options'
+ ("1", "Do not send receipt via email"),
+ ("2", "Email receipt and print it"),
+ (
+ "3",
+ "Email receipt and print it unless configured on user that \
+ he only receives electronically",
+ ),
+ ("4", "Email receipt"),
+ ],
+ string="Receipt",
+ config_parameter="point_of_sale.receipt_options",
)
@api.model
def get_values(self):
- res = super(ResConfigSettings, self).get_values()
- icp_sudo = self.env['ir.config_parameter'].sudo()
- receipt_options = icp_sudo.get_param('point_of_sale.receipt_options')
- res.update(
- receipt_options=receipt_options
- )
+ res = super().get_values()
+ icp_sudo = self.env["ir.config_parameter"].sudo()
+ receipt_options = icp_sudo.get_param("point_of_sale.receipt_options")
+ res.update(receipt_options=receipt_options)
return res
@api.model
def get_default_receipt_options(self):
- receipt_options = self.env['ir.values'].get_default(
- 'res.config.settings', 'receipt_options')
+ receipt_options = self.env["ir.values"].get_default(
+ "res.config.settings", "receipt_options"
+ )
return {
- 'receipt_options': receipt_options,
+ "receipt_options": receipt_options,
}
@api.multi
def set_default_receipt_options(self):
self.ensure_one()
- return self.env['ir.values'].sudo().set_default(
- 'res.config.settings', 'receipt_options',
- self.receipt_options or None)
+ return (
+ self.env["ir.values"]
+ .sudo()
+ .set_default(
+ "res.config.settings", "receipt_options", self.receipt_options or None
+ )
+ )
diff --git a/pos_ticket_send_by_mail/models/res_partner.py b/pos_ticket_send_by_mail/models/res_partner.py
index 802ff89181..0ea5c3832e 100644
--- a/pos_ticket_send_by_mail/models/res_partner.py
+++ b/pos_ticket_send_by_mail/models/res_partner.py
@@ -13,18 +13,18 @@ class ResPartner(models.Model):
string="E-receipt",
default=False,
help="If you tick this box and option 3 is selected for 'Receipt'\
- in point of sale settings, the user will only receive e-receipt ")
+ in point of sale settings, the user will only receive e-receipt ",
+ )
no_email_pos_receipt = fields.Boolean(
string="No E-receipt",
default=False,
- help="If you tick this box, the user will not receive e-receipt ")
- config_receipt_options = fields.Integer(
- compute="_compute_config_receipt_options"
+ help="If you tick this box, the user will not receive e-receipt ",
)
+ config_receipt_options = fields.Integer(compute="_compute_config_receipt_options")
def _compute_config_receipt_options(self):
- icp_sudo = self.env['ir.config_parameter'].sudo()
- receipt_options = icp_sudo.get_param('point_of_sale.receipt_options')
+ icp_sudo = self.env["ir.config_parameter"].sudo()
+ receipt_options = icp_sudo.get_param("point_of_sale.receipt_options")
receipt_options = receipt_options and int(receipt_options) or 0
for record in self:
record.config_receipt_options = receipt_options
diff --git a/pos_ticket_send_by_mail/pyproject.toml b/pos_ticket_send_by_mail/pyproject.toml
new file mode 100644
index 0000000000..4231d0cccb
--- /dev/null
+++ b/pos_ticket_send_by_mail/pyproject.toml
@@ -0,0 +1,3 @@
+[build-system]
+requires = ["whool"]
+build-backend = "whool.buildapi"
diff --git a/pos_ticket_send_by_mail/static/src/js/pos_model.js b/pos_ticket_send_by_mail/static/src/js/pos_model.js
index 82e76384e8..dd217574e5 100644
--- a/pos_ticket_send_by_mail/static/src/js/pos_model.js
+++ b/pos_ticket_send_by_mail/static/src/js/pos_model.js
@@ -6,19 +6,23 @@
*/
-odoo.define('pos_ticket_send_by_mail.pos_model', function (require) {
+odoo.define("pos_ticket_send_by_mail.pos_model", function (require) {
"use strict";
- var pos_model = require('point_of_sale.models');
+ var pos_model = require("point_of_sale.models");
pos_model.load_fields("res.partner", "email_pos_receipt");
- pos_model.load_models([{
- model: "res.config.settings",
- fields: ["receipt_options"],
- loaded: function(self, config_settings){
- const config_setting = config_settings.length > 0 ? config_settings.reduce(function(prev, current) {
- return (prev.id > current.id) ? prev : current
- }) : false; //returns object
- self.config_settings = config_setting;
- }
- }]);
-
+ pos_model.load_models([
+ {
+ model: "res.config.settings",
+ fields: ["receipt_options"],
+ loaded: function (self, config_settings) {
+ const config_setting =
+ config_settings.length > 0
+ ? config_settings.reduce(function (prev, current) {
+ return prev.id > current.id ? prev : current;
+ })
+ : false; // Returns object
+ self.config_settings = config_setting;
+ },
+ },
+ ]);
});
diff --git a/pos_ticket_send_by_mail/static/src/js/receipt_screen_widget.js b/pos_ticket_send_by_mail/static/src/js/receipt_screen_widget.js
index 6fa0622394..ee2812c1ee 100644
--- a/pos_ticket_send_by_mail/static/src/js/receipt_screen_widget.js
+++ b/pos_ticket_send_by_mail/static/src/js/receipt_screen_widget.js
@@ -7,41 +7,43 @@
*/
-odoo.define('pos_ticket_send_by_mail.receipt_screen_widget', function (require) {
-
+odoo.define("pos_ticket_send_by_mail.receipt_screen_widget", function (require) {
"use strict";
- var models = require('point_of_sale.models');
- var screens = require('point_of_sale.screens');
- var core = require('web.core');
- var gui = require('point_of_sale.gui');
+ var models = require("point_of_sale.models");
+ var screens = require("point_of_sale.screens");
+ var core = require("web.core");
+ var gui = require("point_of_sale.gui");
var _t = core._t;
screens.ReceiptScreenWidget.include({
-
- print_web: function() {
+ print_web: function () {
var client = this.pos.get_client();
- var email_pos_receipt = client ? client.email_pos_receipt: false;
- var receipt_options = this.pos.config_settings ? this.pos.config_settings.receipt_options : false;
- if (receipt_options && receipt_options == '3' && email_pos_receipt) {
+ var email_pos_receipt = client ? client.email_pos_receipt : false;
+ var receipt_options = this.pos.config_settings
+ ? this.pos.config_settings.receipt_options
+ : false;
+ if (receipt_options && receipt_options == "3" && email_pos_receipt) {
console.log("Skip print receipt by web");
- return
- } else {
- console.log("1 print receipt by web");
- return this._super();
+ return;
}
+ console.log("1 print receipt by web");
+ return this._super();
+
},
- print_xml: function() {
+ print_xml: function () {
var client = this.pos.get_client();
- var email_pos_receipt = client ? client.email_pos_receipt: false;
- var receipt_options = this.pos.config_settings ? this.pos.config_settings.receipt_options : false;
- if (receipt_options && receipt_options == '3' && email_pos_receipt) {
+ var email_pos_receipt = client ? client.email_pos_receipt : false;
+ var receipt_options = this.pos.config_settings
+ ? this.pos.config_settings.receipt_options
+ : false;
+ if (receipt_options && receipt_options == "3" && email_pos_receipt) {
console.log("Skip print receipt by web");
- return
- } else {
- console.log(" print receipt by web");
- return this._super();
+ return;
}
+ console.log(" print receipt by web");
+ return this._super();
+
},
});
});
diff --git a/pos_ticket_send_by_mail/static/src/xml/templates.xml b/pos_ticket_send_by_mail/static/src/xml/templates.xml
index 50bcca4be7..4e0b58d0c6 100644
--- a/pos_ticket_send_by_mail/static/src/xml/templates.xml
+++ b/pos_ticket_send_by_mail/static/src/xml/templates.xml
@@ -1,13 +1,15 @@
-
+
-
-
-
+
+
-
diff --git a/pos_ticket_send_by_mail/tests/__init__.py b/pos_ticket_send_by_mail/tests/__init__.py
index 626af5595d..7361e0bb80 100644
--- a/pos_ticket_send_by_mail/tests/__init__.py
+++ b/pos_ticket_send_by_mail/tests/__init__.py
@@ -1,2 +1 @@
-
from . import test_pos_ticket_mail
diff --git a/pos_ticket_send_by_mail/tests/test_pos_ticket_mail.py b/pos_ticket_send_by_mail/tests/test_pos_ticket_mail.py
index 5eb2102d15..5dafebabed 100644
--- a/pos_ticket_send_by_mail/tests/test_pos_ticket_mail.py
+++ b/pos_ticket_send_by_mail/tests/test_pos_ticket_mail.py
@@ -1,70 +1,76 @@
-from odoo.tests.common import TransactionCase
from odoo import fields
+from odoo.tests.common import TransactionCase
class PosTicketMailTest(TransactionCase):
-
def setUp(self):
- super(PosTicketMailTest, self).setUp()
+ super().setUp()
- self.ir_config_parameter = self.env['ir.config_parameter'].sudo()
- self.PosOrder = self.env['pos.order']
- self.partner1 = self.env.ref('base.res_partner_1')
- self.posconfig = self.env['pos.config']
- self.pos_config = self.posconfig.search([
- ('name', '=', 'test_pos_email')
- ], limit=1)
+ self.ir_config_parameter = self.env["ir.config_parameter"].sudo()
+ self.PosOrder = self.env["pos.order"]
+ self.partner1 = self.env.ref("base.res_partner_1")
+ self.posconfig = self.env["pos.config"]
+ self.pos_config = self.posconfig.search(
+ [("name", "=", "test_pos_email")], limit=1
+ )
if not self.pos_config:
- self.pos_config = self.posconfig.create({
- 'name': 'test_pos_email',
- })
- self.res_users = self.env['res.users']
- self.pos_user = self.res_users.search([
- ('login', '=', 'pos_test_email')
- ], limit=1)
+ self.pos_config = self.posconfig.create(
+ {
+ "name": "test_pos_email",
+ }
+ )
+ self.res_users = self.env["res.users"]
+ self.pos_user = self.res_users.search(
+ [("login", "=", "pos_test_email")], limit=1
+ )
if not self.pos_user:
- self.pos_user = self.res_users.create({
- 'name': 'pos_test_email',
- 'login': 'pos_test_email',
- 'email': 'pos_test_email@mail.com'
- })
- self.pos_session = self.env['pos.session']
- self.PosSession = self.pos_session.search([
- ('user_id', '=', self.pos_user.id)
- ], limit=1)
+ self.pos_user = self.res_users.create(
+ {
+ "name": "pos_test_email",
+ "login": "pos_test_email",
+ "email": "pos_test_email@mail.com",
+ }
+ )
+ self.pos_session = self.env["pos.session"]
+ self.PosSession = self.pos_session.search(
+ [("user_id", "=", self.pos_user.id)], limit=1
+ )
if not self.PosSession:
- self.PosSession = self.env['pos.session'].create({
- 'user_id': self.pos_user.id,
- 'config_id': self.pos_config.id
- })
- self.led_lamp = self.env.ref('point_of_sale.led_lamp')
- self.whiteboard_pen = self.env.ref('point_of_sale.whiteboard_pen')
- self.newspaper_rack = self.env.ref('point_of_sale.newspaper_rack')
- self.partner_3 = self.env.ref('base.res_partner_3')
- self.pos_sale_journal = self.env['account.journal'].search([
- ('type', '=', 'cash')
- ])
+ self.PosSession = self.env["pos.session"].create(
+ {"user_id": self.pos_user.id, "config_id": self.pos_config.id}
+ )
+ self.led_lamp = self.env.ref("point_of_sale.led_lamp")
+ self.whiteboard_pen = self.env.ref("point_of_sale.whiteboard_pen")
+ self.newspaper_rack = self.env.ref("point_of_sale.newspaper_rack")
+ self.partner_3 = self.env.ref("base.res_partner_3")
+ self.pos_sale_journal = self.env["account.journal"].search(
+ [("type", "=", "cash")]
+ )
self.pos_config.journal_ids = [self.pos_sale_journal[0].id]
def test_01_pos_config_no_mail_sent(self):
"""
- POS config do not send email
+ POS config do not send email
"""
+
def compute_tax(product, price, qty=1, taxes=None):
if not taxes:
taxes = product.taxes_id.filtered(
- lambda t: t.company_id.id == self.env.user.id)
+ lambda t: t.company_id.id == self.env.user.id
+ )
currency = self.pos_config.pricelist_id.currency_id
res = taxes.compute_all(price, currency, qty, product=product)
- untax = res['total_excluded']
- return untax, sum(tax.get('amount', 0.0) for tax in res['taxes'])
- self.ir_config_parameter.set_param('point_of_sale.receipt_options',
- '1')
- open_session = self.PosSession.search([
- ('state', '!=', 'closed'),
- ('config_id', '=', self.pos_config.id),
- ('rescue', '=', False)
- ])
+ untax = res["total_excluded"]
+ return untax, sum(tax.get("amount", 0.0) for tax in res["taxes"])
+
+ self.ir_config_parameter.set_param("point_of_sale.receipt_options", "1")
+ open_session = self.PosSession.search(
+ [
+ ("state", "!=", "closed"),
+ ("config_id", "=", self.pos_config.id),
+ ("rescue", "=", False),
+ ]
+ )
if open_session:
current_session = open_session
else:
@@ -72,71 +78,85 @@ def compute_tax(product, price, qty=1, taxes=None):
current_session = self.pos_config.current_session_id
untax, atax = compute_tax(self.led_lamp, 0.9)
carrot_order = {
- 'data': {
- 'amount_paid': untax + atax,
- 'amount_return': 0,
- 'amount_tax': atax,
- 'amount_total': untax + atax,
- 'creation_date': fields.Datetime.to_string(
- fields.Datetime.now()
- ),
- 'fiscal_position_id': False,
- 'pricelist_id': self.pos_config.available_pricelist_ids[0].id,
- 'lines': [[0, 0, {
- 'discount': 0,
- 'id': 42,
- 'pack_lot_ids': [],
- 'price_unit': 0.9,
- 'product_id': self.led_lamp.id,
- 'price_subtotal': 0.9,
- 'price_subtotal_incl': 1.04,
- 'qty': 1,
- 'tax_ids': [(6, 0, self.led_lamp.taxes_id.ids)]}]],
- 'name': 'Order 00042-003-0014',
- 'partner_id': False,
- 'pos_session_id': current_session.id,
- 'sequence_number': 2,
- 'statement_ids': [[0, 0, {
- 'account_id': self.env.user.partner_id.
- property_account_receivable_id.id,
- 'amount': untax + atax,
- 'journal_id': self.pos_sale_journal[0].id,
- 'name': fields.Datetime.now(),
- 'statement_id': current_session.statement_ids[0].id}]],
- 'uid': '00042-003-0014',
- 'user_id': self.env.uid
+ "data": {
+ "amount_paid": untax + atax,
+ "amount_return": 0,
+ "amount_tax": atax,
+ "amount_total": untax + atax,
+ "creation_date": fields.Datetime.to_string(fields.Datetime.now()),
+ "fiscal_position_id": False,
+ "pricelist_id": self.pos_config.available_pricelist_ids[0].id,
+ "lines": [
+ [
+ 0,
+ 0,
+ {
+ "discount": 0,
+ "id": 42,
+ "pack_lot_ids": [],
+ "price_unit": 0.9,
+ "product_id": self.led_lamp.id,
+ "price_subtotal": 0.9,
+ "price_subtotal_incl": 1.04,
+ "qty": 1,
+ "tax_ids": [(6, 0, self.led_lamp.taxes_id.ids)],
+ },
+ ]
+ ],
+ "name": "Order 00042-003-0014",
+ "partner_id": False,
+ "pos_session_id": current_session.id,
+ "sequence_number": 2,
+ "statement_ids": [
+ [
+ 0,
+ 0,
+ {
+ "account_id": self.env.user.partner_id.property_account_receivable_id.id,
+ "amount": untax + atax,
+ "journal_id": self.pos_sale_journal[0].id,
+ "name": fields.Datetime.now(),
+ "statement_id": current_session.statement_ids[0].id,
+ },
+ ]
+ ],
+ "uid": "00042-003-0014",
+ "user_id": self.env.uid,
},
- 'id': '00042-003-0014',
- 'to_invoice': False
+ "id": "00042-003-0014",
+ "to_invoice": False,
}
untax, atax = compute_tax(self.whiteboard_pen, 1.2)
self.PosOrder01 = self.PosOrder.browse(
- self.PosOrder.create_from_ui([carrot_order]))
+ self.PosOrder.create_from_ui([carrot_order])
+ )
self.PosOrder01.action_pos_order_paid()
current_session.action_pos_session_closing_control()
def test_02_pos_config_mail_sent_print_no_partner(self):
"""
- POS config Email receipt and print it
- No Partner
+ POS config Email receipt and print it
+ No Partner
"""
+
def compute_tax(product, price, qty=1, taxes=None):
if not taxes:
taxes = product.taxes_id.filtered(
- lambda t: t.company_id.id == self.env.user.id)
+ lambda t: t.company_id.id == self.env.user.id
+ )
currency = self.pos_config.pricelist_id.currency_id
res = taxes.compute_all(price, currency, qty, product=product)
- untax = res['total_excluded']
- return untax, sum(tax.get('amount', 0.0) for tax in res['taxes'])
- self.ir_config_parameter.set_param(
- 'point_of_sale.receipt_options',
- '2'
+ untax = res["total_excluded"]
+ return untax, sum(tax.get("amount", 0.0) for tax in res["taxes"])
+
+ self.ir_config_parameter.set_param("point_of_sale.receipt_options", "2")
+ open_session = self.PosSession.search(
+ [
+ ("state", "!=", "closed"),
+ ("config_id", "=", self.pos_config.id),
+ ("rescue", "=", False),
+ ]
)
- open_session = self.PosSession.search([
- ('state', '!=', 'closed'),
- ('config_id', '=', self.pos_config.id),
- ('rescue', '=', False)
- ])
if open_session:
current_session = open_session
else:
@@ -144,70 +164,86 @@ def compute_tax(product, price, qty=1, taxes=None):
current_session = self.pos_config.current_session_id
untax, atax = compute_tax(self.led_lamp, 0.9)
carrot_order = {
- 'data': {
- 'amount_paid': untax + atax,
- 'amount_return': 0,
- 'amount_tax': atax,
- 'amount_total': untax + atax,
- 'creation_date': fields.Datetime.to_string(
- fields.Datetime.now()
- ),
- 'fiscal_position_id': False,
- 'pricelist_id': self.pos_config.available_pricelist_ids[0].id,
- 'lines': [[0, 0, {
- 'discount': 0,
- 'id': 43,
- 'pack_lot_ids': [],
- 'price_unit': 0.9,
- 'product_id': self.led_lamp.id,
- 'price_subtotal': 0.9,
- 'price_subtotal_incl': 1.04,
- 'qty': 1,
- 'tax_ids': [(6, 0, self.led_lamp.taxes_id.ids)]}]],
- 'name': 'Order 00042-003-0024',
- 'partner_id': False,
- 'pos_session_id': current_session.id,
- 'sequence_number': 3,
- 'statement_ids': [[0, 0, {
- 'account_id': self.env.user.partner_id.
- property_account_receivable_id.id,
- 'amount': untax + atax,
- 'journal_id': self.pos_sale_journal[0].id,
- 'name': fields.Datetime.now(),
- 'statement_id': current_session.statement_ids[0].id}]],
- 'uid': '00042-003-0028',
- 'user_id': self.env.uid
+ "data": {
+ "amount_paid": untax + atax,
+ "amount_return": 0,
+ "amount_tax": atax,
+ "amount_total": untax + atax,
+ "creation_date": fields.Datetime.to_string(fields.Datetime.now()),
+ "fiscal_position_id": False,
+ "pricelist_id": self.pos_config.available_pricelist_ids[0].id,
+ "lines": [
+ [
+ 0,
+ 0,
+ {
+ "discount": 0,
+ "id": 43,
+ "pack_lot_ids": [],
+ "price_unit": 0.9,
+ "product_id": self.led_lamp.id,
+ "price_subtotal": 0.9,
+ "price_subtotal_incl": 1.04,
+ "qty": 1,
+ "tax_ids": [(6, 0, self.led_lamp.taxes_id.ids)],
+ },
+ ]
+ ],
+ "name": "Order 00042-003-0024",
+ "partner_id": False,
+ "pos_session_id": current_session.id,
+ "sequence_number": 3,
+ "statement_ids": [
+ [
+ 0,
+ 0,
+ {
+ "account_id": self.env.user.partner_id.property_account_receivable_id.id,
+ "amount": untax + atax,
+ "journal_id": self.pos_sale_journal[0].id,
+ "name": fields.Datetime.now(),
+ "statement_id": current_session.statement_ids[0].id,
+ },
+ ]
+ ],
+ "uid": "00042-003-0028",
+ "user_id": self.env.uid,
},
- 'id': '00042-003-0028',
- 'to_invoice': False
+ "id": "00042-003-0028",
+ "to_invoice": False,
}
untax, atax = compute_tax(self.whiteboard_pen, 1.2)
self.PosOrder02 = self.PosOrder.browse(
- self.PosOrder.create_from_ui([carrot_order]))
+ self.PosOrder.create_from_ui([carrot_order])
+ )
self.PosOrder.action_pos_order_paid()
self.PosOrder02._send_order_cron()
current_session.action_pos_session_closing_control()
def test_03_pos_config_mail_sent_print_partner(self):
"""
- POS config Email receipt and print it
- Set Partner
+ POS config Email receipt and print it
+ Set Partner
"""
+
def compute_tax(product, price, qty=1, taxes=None):
if not taxes:
taxes = product.taxes_id.filtered(
- lambda t: t.company_id.id == self.env.user.id)
+ lambda t: t.company_id.id == self.env.user.id
+ )
currency = self.pos_config.pricelist_id.currency_id
res = taxes.compute_all(price, currency, qty, product=product)
- untax = res['total_excluded']
- return untax, sum(tax.get('amount', 0.0) for tax in res['taxes'])
- self.ir_config_parameter.set_param('point_of_sale.receipt_options',
- '2')
- open_session = self.PosSession.search([
- ('state', '!=', 'closed'),
- ('config_id', '=', self.pos_config.id),
- ('rescue', '=', False)
- ])
+ untax = res["total_excluded"]
+ return untax, sum(tax.get("amount", 0.0) for tax in res["taxes"])
+
+ self.ir_config_parameter.set_param("point_of_sale.receipt_options", "2")
+ open_session = self.PosSession.search(
+ [
+ ("state", "!=", "closed"),
+ ("config_id", "=", self.pos_config.id),
+ ("rescue", "=", False),
+ ]
+ )
if open_session:
current_session = open_session
else:
@@ -215,71 +251,87 @@ def compute_tax(product, price, qty=1, taxes=None):
current_session = self.pos_config.current_session_id
untax, atax = compute_tax(self.led_lamp, 0.9)
carrot_order = {
- 'data': {
- 'amount_paid': untax + atax,
- 'amount_return': 0,
- 'amount_tax': atax,
- 'amount_total': untax + atax,
- 'creation_date': fields.Datetime.to_string(
- fields.Datetime.now()
- ),
- 'fiscal_position_id': False,
- 'pricelist_id': self.pos_config.available_pricelist_ids[0].id,
- 'lines': [[0, 0, {
- 'discount': 0,
- 'id': 44,
- 'pack_lot_ids': [],
- 'price_unit': 0.9,
- 'product_id': self.led_lamp.id,
- 'price_subtotal': 0.9,
- 'price_subtotal_incl': 1.04,
- 'qty': 1,
- 'tax_ids': [(6, 0, self.led_lamp.taxes_id.ids)]}]],
- 'name': 'Order 00042-003-0044',
- 'partner_id': self.partner1.id,
- 'pos_session_id': current_session.id,
- 'sequence_number': 4,
- 'statement_ids': [[0, 0, {
- 'account_id': self.env.user.partner_id.
- property_account_receivable_id.id,
- 'amount': untax + atax,
- 'journal_id': self.pos_sale_journal[0].id,
- 'name': fields.Datetime.now(),
- 'statement_id': current_session.statement_ids[0].id}]],
- 'uid': '00042-003-0129',
- 'user_id': self.env.uid
+ "data": {
+ "amount_paid": untax + atax,
+ "amount_return": 0,
+ "amount_tax": atax,
+ "amount_total": untax + atax,
+ "creation_date": fields.Datetime.to_string(fields.Datetime.now()),
+ "fiscal_position_id": False,
+ "pricelist_id": self.pos_config.available_pricelist_ids[0].id,
+ "lines": [
+ [
+ 0,
+ 0,
+ {
+ "discount": 0,
+ "id": 44,
+ "pack_lot_ids": [],
+ "price_unit": 0.9,
+ "product_id": self.led_lamp.id,
+ "price_subtotal": 0.9,
+ "price_subtotal_incl": 1.04,
+ "qty": 1,
+ "tax_ids": [(6, 0, self.led_lamp.taxes_id.ids)],
+ },
+ ]
+ ],
+ "name": "Order 00042-003-0044",
+ "partner_id": self.partner1.id,
+ "pos_session_id": current_session.id,
+ "sequence_number": 4,
+ "statement_ids": [
+ [
+ 0,
+ 0,
+ {
+ "account_id": self.env.user.partner_id.property_account_receivable_id.id,
+ "amount": untax + atax,
+ "journal_id": self.pos_sale_journal[0].id,
+ "name": fields.Datetime.now(),
+ "statement_id": current_session.statement_ids[0].id,
+ },
+ ]
+ ],
+ "uid": "00042-003-0129",
+ "user_id": self.env.uid,
},
- 'id': '00042-003-0129',
- 'to_invoice': False
+ "id": "00042-003-0129",
+ "to_invoice": False,
}
untax, atax = compute_tax(self.whiteboard_pen, 1.2)
self.PosOrder03 = self.PosOrder.browse(
- self.PosOrder.create_from_ui([carrot_order]))
+ self.PosOrder.create_from_ui([carrot_order])
+ )
self.PosOrder.action_pos_order_paid()
self.PosOrder._send_order_cron()
current_session.action_pos_session_closing_control()
def test_04_pos_config_mail_print_partner_e_ticket(self):
"""
- POS config Email receipt and print it
- Set Partner and also e-receipt
+ POS config Email receipt and print it
+ Set Partner and also e-receipt
"""
+
def compute_tax(product, price, qty=1, taxes=None):
if not taxes:
taxes = product.taxes_id.filtered(
- lambda t: t.company_id.id == self.env.user.id)
+ lambda t: t.company_id.id == self.env.user.id
+ )
currency = self.pos_config.pricelist_id.currency_id
res = taxes.compute_all(price, currency, qty, product=product)
- untax = res['total_excluded']
- return untax, sum(tax.get('amount', 0.0) for tax in res['taxes'])
- self.ir_config_parameter.set_param('point_of_sale.receipt_options',
- '2')
+ untax = res["total_excluded"]
+ return untax, sum(tax.get("amount", 0.0) for tax in res["taxes"])
+
+ self.ir_config_parameter.set_param("point_of_sale.receipt_options", "2")
self.partner_3.email_pos_receipt = True
- open_session = self.PosSession.search([
- ('state', '!=', 'closed'),
- ('config_id', '=', self.pos_config.id),
- ('rescue', '=', False)
- ])
+ open_session = self.PosSession.search(
+ [
+ ("state", "!=", "closed"),
+ ("config_id", "=", self.pos_config.id),
+ ("rescue", "=", False),
+ ]
+ )
if open_session:
current_session = open_session
else:
@@ -287,46 +339,58 @@ def compute_tax(product, price, qty=1, taxes=None):
current_session = self.pos_config.current_session_id
untax, atax = compute_tax(self.led_lamp, 0.9)
carrot_order = {
- 'data': {
- 'amount_paid': untax + atax,
- 'amount_return': 0,
- 'amount_tax': atax,
- 'amount_total': untax + atax,
- 'creation_date': fields.Datetime.to_string(
- fields.Datetime.now()
- ),
- 'fiscal_position_id': False,
- 'pricelist_id': self.pos_config.available_pricelist_ids[0].id,
- 'lines': [[0, 0, {
- 'discount': 0,
- 'id': 45,
- 'pack_lot_ids': [],
- 'price_unit': 0.9,
- 'product_id': self.led_lamp.id,
- 'price_subtotal': 0.9,
- 'price_subtotal_incl': 1.04,
- 'qty': 1,
- 'tax_ids': [(6, 0, self.led_lamp.taxes_id.ids)]}]],
- 'name': 'Order 00042-003-0051',
- 'partner_id': self.partner_3.id,
- 'pos_session_id': current_session.id,
- 'sequence_number': 4,
- 'statement_ids': [[0, 0, {
- 'account_id': self.env.user.partner_id.
- property_account_receivable_id.id,
- 'amount': untax + atax,
- 'journal_id': self.pos_sale_journal[0].id,
- 'name': fields.Datetime.now(),
- 'statement_id': current_session.statement_ids[0].id}]],
- 'uid': '00042-003-0151',
- 'user_id': self.env.uid
+ "data": {
+ "amount_paid": untax + atax,
+ "amount_return": 0,
+ "amount_tax": atax,
+ "amount_total": untax + atax,
+ "creation_date": fields.Datetime.to_string(fields.Datetime.now()),
+ "fiscal_position_id": False,
+ "pricelist_id": self.pos_config.available_pricelist_ids[0].id,
+ "lines": [
+ [
+ 0,
+ 0,
+ {
+ "discount": 0,
+ "id": 45,
+ "pack_lot_ids": [],
+ "price_unit": 0.9,
+ "product_id": self.led_lamp.id,
+ "price_subtotal": 0.9,
+ "price_subtotal_incl": 1.04,
+ "qty": 1,
+ "tax_ids": [(6, 0, self.led_lamp.taxes_id.ids)],
+ },
+ ]
+ ],
+ "name": "Order 00042-003-0051",
+ "partner_id": self.partner_3.id,
+ "pos_session_id": current_session.id,
+ "sequence_number": 4,
+ "statement_ids": [
+ [
+ 0,
+ 0,
+ {
+ "account_id": self.env.user.partner_id.property_account_receivable_id.id,
+ "amount": untax + atax,
+ "journal_id": self.pos_sale_journal[0].id,
+ "name": fields.Datetime.now(),
+ "statement_id": current_session.statement_ids[0].id,
+ },
+ ]
+ ],
+ "uid": "00042-003-0151",
+ "user_id": self.env.uid,
},
- 'id': '00042-003-0151',
- 'to_invoice': False
+ "id": "00042-003-0151",
+ "to_invoice": False,
}
untax, atax = compute_tax(self.whiteboard_pen, 1.2)
self.PosOrder04 = self.PosOrder.browse(
- self.PosOrder.create_from_ui([carrot_order]))
+ self.PosOrder.create_from_ui([carrot_order])
+ )
self.PosOrder04.action_pos_order_paid()
self.PosOrder._send_order_cron()
current_session.action_pos_session_closing_control()
diff --git a/pos_ticket_send_by_mail/views/report_paperformat.xml b/pos_ticket_send_by_mail/views/report_paperformat.xml
index 07a9c7010d..48a4bdc058 100755
--- a/pos_ticket_send_by_mail/views/report_paperformat.xml
+++ b/pos_ticket_send_by_mail/views/report_paperformat.xml
@@ -1,6 +1,5 @@
-
+
-
Point Of Sale Receipt
@@ -16,5 +15,4 @@
3
130
-
diff --git a/pos_ticket_send_by_mail/views/report_receipt.xml b/pos_ticket_send_by_mail/views/report_receipt.xml
index 80d28420cb..5100f4b09b 100755
--- a/pos_ticket_send_by_mail/views/report_receipt.xml
+++ b/pos_ticket_send_by_mail/views/report_receipt.xml
@@ -1,6 +1,5 @@
-
+
-
@@ -8,8 +7,10 @@
-
+
User:
@@ -18,8 +19,7 @@
-
-
+
@@ -34,17 +34,16 @@
|
-
+
|
-
+
+ t-options='{"widget": "monetary", "display_currency": o.company_id.currency_id}'
+ />
@@ -62,8 +61,10 @@
Taxes
|
-
+
|
@@ -71,8 +72,10 @@
Total
|
-
+
|
@@ -91,8 +94,10 @@
-
+
|
@@ -101,5 +106,4 @@
-
diff --git a/pos_ticket_send_by_mail/views/view_pos_config_settings.xml b/pos_ticket_send_by_mail/views/view_pos_config_settings.xml
index aebb088e0d..15624bad38 100644
--- a/pos_ticket_send_by_mail/views/view_pos_config_settings.xml
+++ b/pos_ticket_send_by_mail/views/view_pos_config_settings.xml
@@ -1,18 +1,18 @@
-
+
-
res.config.settings.view.form.inherit.pos_ticket_send_by_mail
res.config.settings
-
+
Receipt Options
-
@@ -31,9 +30,13 @@
-
-
+
diff --git a/pos_ticket_send_by_mail/views/view_res_partner.xml b/pos_ticket_send_by_mail/views/view_res_partner.xml
index 3806343c6b..ddb4d70aa4 100644
--- a/pos_ticket_send_by_mail/views/view_res_partner.xml
+++ b/pos_ticket_send_by_mail/views/view_res_partner.xml
@@ -1,21 +1,23 @@
-
+
-
view_partner_form_inherit
res.partner
-
-
+
-
-
From 28b72e56c7fc0582fb11a560e5352b9f9bbec34d Mon Sep 17 00:00:00 2001
From: phucph
Date: Thu, 16 Oct 2025 17:30:03 +0700
Subject: [PATCH 13/13] [MIG] pos_ticket_send_by_mail: Migration to 18.0
---
pos_ticket_send_by_mail/README.rst | 1 +
pos_ticket_send_by_mail/__manifest__.py | 12 +-
.../data/email_template_data.xml | 35 +-
pos_ticket_send_by_mail/data/ir_cron_data.xml | 2 -
.../i18n/email_pos_receipt.pot | 109 -----
pos_ticket_send_by_mail/i18n/fr.po | 201 +++++----
.../i18n/pos_ticket_send_by_mail.pot | 125 +++---
pos_ticket_send_by_mail/models/__init__.py | 1 +
pos_ticket_send_by_mail/models/pos_config.py | 19 +
pos_ticket_send_by_mail/models/pos_order.py | 23 +-
.../models/res_config_settings.py | 45 +-
pos_ticket_send_by_mail/models/res_partner.py | 32 +-
.../readme/CONTRIBUTORS.md | 2 +
.../security/ir.model.access.csv | 1 -
.../static/src/js/pos_model.js | 28 --
.../src/js/receipt_screen_widget.esm.js | 29 ++
.../static/src/js/receipt_screen_widget.js | 49 --
.../static/src/xml/receipt_screen.xml | 11 +
.../static/src/xml/templates.xml | 15 -
.../tests/test_pos_ticket_mail.py | 420 +++++++++---------
.../views/report_paperformat.xml | 0
.../views/report_receipt.xml | 189 ++++----
.../views/view_pos_config_settings.xml | 51 +--
.../views/view_res_partner.xml | 12 +-
24 files changed, 638 insertions(+), 774 deletions(-)
delete mode 100644 pos_ticket_send_by_mail/i18n/email_pos_receipt.pot
create mode 100644 pos_ticket_send_by_mail/models/pos_config.py
create mode 100644 pos_ticket_send_by_mail/readme/CONTRIBUTORS.md
delete mode 100644 pos_ticket_send_by_mail/security/ir.model.access.csv
delete mode 100644 pos_ticket_send_by_mail/static/src/js/pos_model.js
create mode 100644 pos_ticket_send_by_mail/static/src/js/receipt_screen_widget.esm.js
delete mode 100644 pos_ticket_send_by_mail/static/src/js/receipt_screen_widget.js
create mode 100644 pos_ticket_send_by_mail/static/src/xml/receipt_screen.xml
delete mode 100644 pos_ticket_send_by_mail/static/src/xml/templates.xml
mode change 100755 => 100644 pos_ticket_send_by_mail/views/report_paperformat.xml
mode change 100755 => 100644 pos_ticket_send_by_mail/views/report_receipt.xml
diff --git a/pos_ticket_send_by_mail/README.rst b/pos_ticket_send_by_mail/README.rst
index 433d8c493c..91b5b90677 100644
--- a/pos_ticket_send_by_mail/README.rst
+++ b/pos_ticket_send_by_mail/README.rst
@@ -21,6 +21,7 @@ Contributors
~~~~~~~~~~~~
* Iván Todorovich
+* Phan Hong Phuc
Maintainers
~~~~~~~~~~~
diff --git a/pos_ticket_send_by_mail/__manifest__.py b/pos_ticket_send_by_mail/__manifest__.py
index 03a070ee55..7d56a3a573 100644
--- a/pos_ticket_send_by_mail/__manifest__.py
+++ b/pos_ticket_send_by_mail/__manifest__.py
@@ -5,23 +5,27 @@
{
"name": "POS Receipt By Email",
- "version": "12.0.1.0.0",
+ "version": "18.0.1.0.0",
"category": "Custom",
- "author": "Druidoo",
+ "author": "Druidoo, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/pos",
"license": "AGPL-3",
"depends": [
"point_of_sale",
],
"data": [
- "security/ir.model.access.csv",
"views/report_paperformat.xml",
"views/view_pos_config_settings.xml",
"data/email_template_data.xml",
"data/ir_cron_data.xml",
"views/view_res_partner.xml",
"views/report_receipt.xml",
- "static/src/xml/templates.xml",
],
+ "assets": {
+ "point_of_sale._assets_pos": [
+ "pos_ticket_send_by_mail/static/src/js/*",
+ "pos_ticket_send_by_mail/static/src/xml/*",
+ ],
+ },
"installable": True,
}
diff --git a/pos_ticket_send_by_mail/data/email_template_data.xml b/pos_ticket_send_by_mail/data/email_template_data.xml
index 3f02bb77a9..de8e41befc 100644
--- a/pos_ticket_send_by_mail/data/email_template_data.xml
+++ b/pos_ticket_send_by_mail/data/email_template_data.xml
@@ -2,30 +2,31 @@
- Send Received
+ Send Receipt
ticket@${object.user_id.company_id.email.split('@')[1] or ''|safe}
+ >{{ (object.user_id.company_id.email_formatted or user.email_formatted) }}
${object.user_id.company_id.name} Received ${object.pos_reference and object.pos_reference.split(' ')[1] or ''}
- ${object.partner_id.id}
+ >{{ object.user_id.company_id.name }} Received {{ object.pos_reference and object.pos_reference.split(' ')[1] or '' }}
+ {{ object.partner_id.id }}
-
- Ticket ${object.pos_reference}
- ${object.partner_id.lang}
- Thank you for your visit !
- You will find your receipt ${object.pos_reference and object.pos_reference.split(' ')[1] or ''} attached.
- Sincerely,
- The team of the cooperative
- ]]>
+
+ {{ object.partner_id.lang }}
+
+
+
Thank you for your visit !
+
You will find your receipt attached.
+
+
Sincerely,
+
The team of the cooperative
+
diff --git a/pos_ticket_send_by_mail/data/ir_cron_data.xml b/pos_ticket_send_by_mail/data/ir_cron_data.xml
index 1858551025..a2d1f97b71 100644
--- a/pos_ticket_send_by_mail/data/ir_cron_data.xml
+++ b/pos_ticket_send_by_mail/data/ir_cron_data.xml
@@ -4,8 +4,6 @@
Send Reciept via Email
1
minutes
- -1
-
model._send_order_cron()
code
diff --git a/pos_ticket_send_by_mail/i18n/email_pos_receipt.pot b/pos_ticket_send_by_mail/i18n/email_pos_receipt.pot
deleted file mode 100644
index c9ed316fca..0000000000
--- a/pos_ticket_send_by_mail/i18n/email_pos_receipt.pot
+++ /dev/null
@@ -1,109 +0,0 @@
-# Translation of Odoo Server.
-# This file contains the translation of the following modules:
-# * pos_ticket_send_by_mail
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
-"Report-Msgid-Bugs-To: \n"
-"Last-Translator: <>\n"
-"Language-Team: \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: \n"
-"Plural-Forms: \n"
-
-#. module: pos_ticket_send_by_mail
-#: model:mail.template,body_html:pos_ticket_send_by_mail.email_send_pos_receipt
-msgid "\n"
-"Thank you for your visit !
\n"
-"You will find your receipt ${object.pos_reference.split(' ')[1]} attached.
\n"
-"Sincerely,
\n"
-"The team of the cooperative
\n"
-" "
-msgstr "\n"
-"Merci de votre visite !
\n"
-"Vous trouverez votre reçu ${object.pos_reference.split(' ')[1]} en pièce-jointe.
\n"
-"Amicalement,
\n"
-"L'équipe de la coopérative
\n"
-" "
-
-#. module: pos_ticket_send_by_mail
-#: model:mail.template,subject:pos_ticket_send_by_mail.email_send_pos_receipt
-msgid "${object.user_id.company_id.name} Received ${object.pos_reference.split(' ')[1]}"
-msgstr "${object.user_id.company_id.name} Reçu ${object.pos_reference.split(' ')[1]}"
-
-#. module: pos_ticket_send_by_mail
-#: selection:pos.order,email_status:0
-msgid "Do not Send"
-msgstr ""
-
-#. module: pos_ticket_send_by_mail
-#: selection:pos.config.settings,receipt_options:0
-msgid "Do not send receipt via email"
-msgstr ""
-
-#. module: pos_ticket_send_by_mail
-#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_partner_pos_ticket_send_by_mail
-msgid "E-receipt"
-msgstr ""
-
-#. module: pos_ticket_send_by_mail
-#: selection:pos.config.settings,receipt_options:0
-msgid "Email receipt and print it"
-msgstr ""
-
-#. module: pos_ticket_send_by_mail
-#: selection:res.config.settings,receipt_options:0
-msgid ""
-"Email receipt and print it unless configured on user that "
-"he only receives electronically"
-msgstr ""
-"Envoyer le reçu par email et l'imprimer sauf si ce partenaire est configuré "
-"pour recevoir uniquement le reçu électronique"
-
-#. module: pos_ticket_send_by_mail
-#: model:ir.model.fields,help:pos_ticket_send_by_mail.field_res_partner_pos_ticket_send_by_mail
-msgid "If you tick this box and option 3 is selected for 'Receipt' in point of sale settings, the user will only receive e-receipt"
-msgstr ""
-
-#. module: pos_ticket_send_by_mail
-#: model:ir.model,name:pos_ticket_send_by_mail.model_res_partner
-msgid "Partner"
-msgstr ""
-
-#. module: pos_ticket_send_by_mail
-#: model:ir.model,name:pos_ticket_send_by_mail.model_pos_order
-msgid "Point of Sale"
-msgstr ""
-
-#. module: pos_ticket_send_by_mail
-#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_pos_config_settings_receipt_options
-msgid "Receipt"
-msgstr ""
-
-#. module: pos_ticket_send_by_mail
-#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_pos_order_email_status
-msgid "Send Status"
-msgstr ""
-
-#. module: pos_ticket_send_by_mail
-#: selection:pos.order,email_status:0
-msgid "Sent"
-msgstr ""
-
-#. module: pos_ticket_send_by_mail
-#: model:mail.template,report_name:pos_ticket_send_by_mail.email_send_pos_receipt
-msgid "Ticket ${object.pos_reference}"
-msgstr "Billet ${object.pos_reference}"
-
-#. module: pos_ticket_send_by_mail
-#: selection:pos.order,email_status:0
-msgid "To send"
-msgstr ""
-
-#. module: pos_ticket_send_by_mail
-#: model:ir.model,name:pos_ticket_send_by_mail.model_pos_config_settings
-msgid "pos.config.settings"
-msgstr ""
-
diff --git a/pos_ticket_send_by_mail/i18n/fr.po b/pos_ticket_send_by_mail/i18n/fr.po
index 90958129c4..53ae683ecb 100644
--- a/pos_ticket_send_by_mail/i18n/fr.po
+++ b/pos_ticket_send_by_mail/i18n/fr.po
@@ -4,154 +4,166 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2018-08-17 09:04+0000\n"
-"PO-Revision-Date: 2020-07-01 10:27+0000\n"
-"Last-Translator: Simon Mas \n"
-"Language-Team: French \n"
-"Language: fr\n"
+"POT-Creation-Date: 2025-11-25 08:22+0000\n"
+"PO-Revision-Date: 2025-11-25 08:22+0000\n"
+"Last-Translator: \n"
+"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
-"Plural-Forms: nplurals=2; plural=n > 1;\n"
-"X-Generator: Weblate 3.8\n"
+"Plural-Forms: \n"
#. module: pos_ticket_send_by_mail
-#: model:mail.template,body_html:pos_ticket_send_by_mail.email_send_pos_receipt
-msgid ""
-"\n"
-" Thank you for your visit !
\n"
-" You will find your receipt ${object.pos_reference.split(' ')"
-"[1]} attached.
\n"
-" Sincerely,
\n"
-" The team of the cooperative
\n"
-" \n"
-" "
-msgstr ""
+#: model:ir.actions.report,print_report_name:pos_ticket_send_by_mail.action_report_pos_receipt
+msgid "'POS-Receipt-'+(object.name or '').replace('/','-')"
+msgstr "'Reçu PoS-'+(object.name or '').replace('/','-')"
#. module: pos_ticket_send_by_mail
-#: model:mail.template,subject:pos_ticket_send_by_mail.email_send_pos_receipt
+#: model:ir.model.fields,help:pos_ticket_send_by_mail.field_res_partner__pos_email_receipt
+#: model:ir.model.fields,help:pos_ticket_send_by_mail.field_res_users__pos_email_receipt
msgid ""
-"${object.user_id.company_id.name} Received ${object.pos_reference.split(' ')"
-"[1]}"
+"- E-receipt: The user will only receive e-receipt \n"
+"- No E-receipt: The user will not receive e-receipt"
msgstr ""
+"- E-reçu : L’utilisateur recevra exclusivement un reçu électronique n\"
+"- Pas d’e-reçu : L’utilisateur ne recevra pas de reçu électronique"
#. module: pos_ticket_send_by_mail
-#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt_document
msgid ""
"
\n"
" Date:"
msgstr ""
+"
\n"
+" Date:"
#. module: pos_ticket_send_by_mail
-#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
-msgid "Taxes"
+#: model:mail.template,body_html:pos_ticket_send_by_mail.email_send_pos_receipt
+msgid ""
+"\n"
+"
Thank you for your visit !
\n"
+"
You will find your receipt attached.
\n"
+"
\n"
+"
Sincerely,
\n"
+"
The team of the cooperative
\n"
+"
\n"
+" "
msgstr ""
+"\n"
+"
Merci pour votre visite !
\n"
+"
Vous trouverez votre reçu en pièce jointe.
\n"
+"
\n"
+"
Cordialement,
\n"
+"
L’équipe de la coopérative
\n"
+"
\n"
+" "
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt_document
+msgid "Taxes"
+msgstr "Taxes"
#. module: pos_ticket_send_by_mail
-#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt_document
msgid "Total"
msgstr "Total"
#. module: pos_ticket_send_by_mail
-#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt_document
msgid "Amount"
msgstr "Montant"
#. module: pos_ticket_send_by_mail
#: model:ir.model,name:pos_ticket_send_by_mail.model_res_config_settings
msgid "Config Settings"
-msgstr ""
+msgstr "Paramètres de configuration"
#. module: pos_ticket_send_by_mail
#: model:ir.model,name:pos_ticket_send_by_mail.model_res_partner
msgid "Contact"
-msgstr ""
+msgstr "Contact"
#. module: pos_ticket_send_by_mail
-#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt_document
msgid "Description"
-msgstr ""
+msgstr "Description"
#. module: pos_ticket_send_by_mail
-#: selection:pos.order,email_status:0
+#: model:ir.model.fields.selection,name:pos_ticket_send_by_mail.selection__pos_order__email_status__no_send
msgid "Do not Send"
-msgstr "Do not Send"
+msgstr "Ne pas envoyer"
#. module: pos_ticket_send_by_mail
-#: selection:res.config.settings,receipt_options:0
+#: model:ir.model.fields.selection,name:pos_ticket_send_by_mail.selection__pos_config__receipt_options__1
msgid "Do not send receipt via email"
msgstr "Ne pas envoyer le reçu par email"
#. module: pos_ticket_send_by_mail
-#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_partner__email_pos_receipt
-#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_users__email_pos_receipt
-msgid "E-receipt"
-msgstr "Reçu électronique"
+#: model:ir.model.fields.selection,name:pos_ticket_send_by_mail.selection__res_partner__pos_email_receipt__email_pos_receipt
+msgid "E-receipt Only"
+msgstr "E-reçu uniquement"
#. module: pos_ticket_send_by_mail
-#: selection:res.config.settings,receipt_options:0
+#: model:ir.model.fields.selection,name:pos_ticket_send_by_mail.selection__pos_config__receipt_options__4
msgid "Email receipt"
msgstr "Envoyer le reçu par email"
#. module: pos_ticket_send_by_mail
-#: selection:res.config.settings,receipt_options:0
+#: model:ir.model.fields.selection,name:pos_ticket_send_by_mail.selection__pos_config__receipt_options__2
msgid "Email receipt and print it"
msgstr "Envoyer le reçu par email et l'imprimer"
#. module: pos_ticket_send_by_mail
-#: selection:res.config.settings,receipt_options:0
+#: model:ir.model.fields.selection,name:pos_ticket_send_by_mail.selection__pos_config__receipt_options__3
msgid ""
-"Email receipt and print it unless configured on user that "
-"he only receives electronically"
+"Email receipt and print it unless configured on user that"
+" he only receives electronically"
msgstr ""
"Envoyer le reçu par email et l'imprimer sauf si ce partenaire est configuré "
"pour recevoir uniquement le reçu électronique"
#. module: pos_ticket_send_by_mail
-#: model:ir.model.fields,help:pos_ticket_send_by_mail.field_res_partner__email_pos_receipt
-#: model:ir.model.fields,help:pos_ticket_send_by_mail.field_res_users__email_pos_receipt
-#, fuzzy
-msgid ""
-"If you tick this box and option 3 is selected for 'Receipt' in point "
-"of sale settings, the user will only receive e-receipt "
-msgstr ""
-"Si vous cochez cette case et que l'option 3 est sélectionnée dans la "
-"configuration générale du point de vente, ce partenaire recevra uniquement "
-"le reçu électronique"
-
-#. module: pos_ticket_send_by_mail
-#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_partner__no_email_pos_receipt
-#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_users__no_email_pos_receipt
+#: model:ir.model.fields.selection,name:pos_ticket_send_by_mail.selection__res_partner__pos_email_receipt__no_email_pos_receipt
msgid "No E-receipt"
msgstr "Pas Reçu électronique"
#. module: pos_ticket_send_by_mail
-#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_partner__pos_email_receipt
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_users__pos_email_receipt
+msgid "POS Email Receipt Preference"
+msgstr "Préférence d’envoi du reçu par e-mail du PoS"
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt_document
msgid "Payment Mode"
-msgstr ""
+msgstr "Mode de paiement"
+
+#. module: pos_ticket_send_by_mail
+#: model:ir.model,name:pos_ticket_send_by_mail.model_pos_config
+msgid "Point of Sale Configuration"
+msgstr "Configuration du point de vente"
#. module: pos_ticket_send_by_mail
#: model:ir.model,name:pos_ticket_send_by_mail.model_pos_order
-#, fuzzy
msgid "Point of Sale Orders"
-msgstr "Point de vente"
+msgstr "Commandes du point de vente"
#. module: pos_ticket_send_by_mail
-#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt_document
msgid "Price"
msgstr "Prix"
#. module: pos_ticket_send_by_mail
-#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt_document
msgid "Quantity"
-msgstr ""
+msgstr "Quantité"
#. module: pos_ticket_send_by_mail
#: model:ir.actions.report,name:pos_ticket_send_by_mail.action_report_pos_receipt
-#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_config_settings__receipt_options
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_pos_config__receipt_options
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_config_settings__pos_receipt_options
msgid "Receipt"
msgstr "Reçu"
@@ -161,59 +173,52 @@ msgid "Receipt Options"
msgstr "Reçu"
#. module: pos_ticket_send_by_mail
-#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.view_res_config_settings_form_pos_inherit
-msgid "Select one of the receipting options for point of sales."
-msgstr "Sélectionnez une des options de reçu pour le point de vente"
+#: model:mail.template,name:pos_ticket_send_by_mail.email_send_pos_receipt
+msgid "Send Received"
+msgstr "Envoyer le reçu"
#. module: pos_ticket_send_by_mail
#: model:ir.actions.server,name:pos_ticket_send_by_mail.ir_cron_sent_pos_ticket_ir_actions_server
-#: model:ir.cron,cron_name:pos_ticket_send_by_mail.ir_cron_sent_pos_ticket
-#: model:ir.cron,name:pos_ticket_send_by_mail.ir_cron_sent_pos_ticket
-#, fuzzy
msgid "Send Reciept via Email"
msgstr "Ne pas envoyer le reçu par email"
#. module: pos_ticket_send_by_mail
#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_pos_order__email_status
msgid "Send Status"
-msgstr "Send Status"
+msgstr "Statut d’envoi"
#. module: pos_ticket_send_by_mail
-#: selection:pos.order,email_status:0
+#: model:ir.model.fields.selection,name:pos_ticket_send_by_mail.selection__pos_order__email_status__sent
msgid "Sent"
-msgstr "Sent"
+msgstr "Envoyé"
#. module: pos_ticket_send_by_mail
#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.view_res_config_settings_form_pos_inherit
-#, fuzzy
msgid ""
-"There are three ways of obtaining a receipt: 1.Do not send receipt via email "
-"2.Email receipt and print it 3. Email receipt and print it unless configured "
-"on user that he only receives electronically"
+"There are 4 ways of obtaining a receipt: 1.Do not send receipt via email "
+"2.Email receipt and print it 3. Email receipt and print it unless configured"
+" on user that he only receives electronically 4.Email receipt"
msgstr ""
-"Envoyer le reçu par email et l'imprimer sauf si ce partenaire est configuré "
-"pour recevoir uniquement le reçu électronique"
-
-#. module: pos_ticket_send_by_mail
-#: model:mail.template,report_name:pos_ticket_send_by_mail.email_send_pos_receipt
-msgid "Ticket ${object.pos_reference}"
-msgstr "Billet ${object.pos_reference}"
+"Il y a 4 façons d’obtenir un reçu: 1.Ne pas envoyer le reçu par e-mail "
+"2.Envoyer le reçu par e-mail et l’imprimer 3.Envoyer le reçu par e-mail et "
+"l’imprimer sauf si l’utilisateur est configuré pour ne recevoir que par voie"
+" électronique 4. Envoyer le reçu par e-mail"
#. module: pos_ticket_send_by_mail
-#: selection:pos.order,email_status:0
+#: model:ir.model.fields.selection,name:pos_ticket_send_by_mail.selection__pos_order__email_status__to_send
msgid "To send"
-msgstr "To send"
+msgstr "Envoyer"
#. module: pos_ticket_send_by_mail
-#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt_document
msgid "User:"
-msgstr ""
-
-#~ msgid "Partner"
-#~ msgstr "Partenaire"
+msgstr "Utilisateur:"
-#~ msgid "Print receipt when not sent email"
-#~ msgstr "Ne pas imprimer de ticket s’il est envoyé par par email"
-
-#~ msgid "pos.config"
-#~ msgstr "pos.config"
+#. module: pos_ticket_send_by_mail
+#: model:mail.template,subject:pos_ticket_send_by_mail.email_send_pos_receipt
+msgid ""
+"{{ object.user_id.company_id.name }} Received {{ object.pos_reference and "
+"object.pos_reference.split(' ')[1] or '' }}"
+msgstr ""
+"{{ object.user_id.company_id.name }} a reçu {{ object.pos_reference and "
+"object.pos_reference.split(' ')[1] or '' }}"
diff --git a/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot b/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot
index 3e897cda8d..12283e5bcb 100644
--- a/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot
+++ b/pos_ticket_send_by_mail/i18n/pos_ticket_send_by_mail.pot
@@ -1,12 +1,14 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
-# * pos_ticket_send_by_mail
+# * pos_ticket_send_by_mail
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 12.0\n"
+"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
-"Last-Translator: <>\n"
+"POT-Creation-Date: 2025-11-25 08:23+0000\n"
+"PO-Revision-Date: 2025-11-25 08:23+0000\n"
+"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -14,39 +16,50 @@ msgstr ""
"Plural-Forms: \n"
#. module: pos_ticket_send_by_mail
-#: model:mail.template,body_html:pos_ticket_send_by_mail.email_send_pos_receipt
-msgid "\n"
-" Thank you for your visit !
\n"
-" You will find your receipt ${object.pos_reference.split(' ')[1]} attached.
\n"
-" Sincerely,
\n"
-" The team of the cooperative
\n"
-" \n"
-" "
+#: model:ir.actions.report,print_report_name:pos_ticket_send_by_mail.action_report_pos_receipt
+msgid "'POS-Receipt-'+(object.name or '').replace('/','-')"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: model:mail.template,subject:pos_ticket_send_by_mail.email_send_pos_receipt
-msgid "${object.user_id.company_id.name} Received ${object.pos_reference.split(' ')[1]}"
+#: model:ir.model.fields,help:pos_ticket_send_by_mail.field_res_partner__pos_email_receipt
+#: model:ir.model.fields,help:pos_ticket_send_by_mail.field_res_users__pos_email_receipt
+msgid ""
+"- E-receipt: The user will only receive e-receipt \n"
+"- No E-receipt: The user will not receive e-receipt"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
-msgid "
\n"
-" Date:"
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt_document
+msgid ""
+"
\n"
+" Date:"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+#: model:mail.template,body_html:pos_ticket_send_by_mail.email_send_pos_receipt
+msgid ""
+"\n"
+"
Thank you for your visit !
\n"
+"
You will find your receipt attached.
\n"
+"
\n"
+"
Sincerely,
\n"
+"
The team of the cooperative
\n"
+"
\n"
+" "
+msgstr ""
+
+#. module: pos_ticket_send_by_mail
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt_document
msgid "Taxes"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt_document
msgid "Total"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt_document
msgid "Amount"
msgstr ""
@@ -61,76 +74,82 @@ msgid "Contact"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt_document
msgid "Description"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: selection:pos.order,email_status:0
+#: model:ir.model.fields.selection,name:pos_ticket_send_by_mail.selection__pos_order__email_status__no_send
msgid "Do not Send"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: selection:res.config.settings,receipt_options:0
+#: model:ir.model.fields.selection,name:pos_ticket_send_by_mail.selection__pos_config__receipt_options__1
msgid "Do not send receipt via email"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_partner__email_pos_receipt
-#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_users__email_pos_receipt
-msgid "E-receipt"
+#: model:ir.model.fields.selection,name:pos_ticket_send_by_mail.selection__res_partner__pos_email_receipt__email_pos_receipt
+msgid "E-receipt Only"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: selection:res.config.settings,receipt_options:0
+#: model:ir.model.fields.selection,name:pos_ticket_send_by_mail.selection__pos_config__receipt_options__4
msgid "Email receipt"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: selection:res.config.settings,receipt_options:0
+#: model:ir.model.fields.selection,name:pos_ticket_send_by_mail.selection__pos_config__receipt_options__2
msgid "Email receipt and print it"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: selection:res.config.settings,receipt_options:0
-msgid "Email receipt and print it unless configured on user that he only receives electronically"
+#: model:ir.model.fields.selection,name:pos_ticket_send_by_mail.selection__pos_config__receipt_options__3
+msgid ""
+"Email receipt and print it unless configured on user that"
+" he only receives electronically"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: model:ir.model.fields,help:pos_ticket_send_by_mail.field_res_partner__email_pos_receipt
-#: model:ir.model.fields,help:pos_ticket_send_by_mail.field_res_users__email_pos_receipt
-msgid "If you tick this box and option 3 is selected for 'Receipt' in point of sale settings, the user will only receive e-receipt "
+#: model:ir.model.fields.selection,name:pos_ticket_send_by_mail.selection__res_partner__pos_email_receipt__no_email_pos_receipt
+msgid "No E-receipt"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_partner__no_email_pos_receipt
-#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_users__no_email_pos_receipt
-msgid "No E-receipt"
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_partner__pos_email_receipt
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_users__pos_email_receipt
+msgid "POS Email Receipt Preference"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt_document
msgid "Payment Mode"
msgstr ""
+#. module: pos_ticket_send_by_mail
+#: model:ir.model,name:pos_ticket_send_by_mail.model_pos_config
+msgid "Point of Sale Configuration"
+msgstr ""
+
#. module: pos_ticket_send_by_mail
#: model:ir.model,name:pos_ticket_send_by_mail.model_pos_order
msgid "Point of Sale Orders"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt_document
msgid "Price"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt_document
msgid "Quantity"
msgstr ""
#. module: pos_ticket_send_by_mail
#: model:ir.actions.report,name:pos_ticket_send_by_mail.action_report_pos_receipt
-#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_config_settings__receipt_options
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_pos_config__receipt_options
+#: model:ir.model.fields,field_description:pos_ticket_send_by_mail.field_res_config_settings__pos_receipt_options
msgid "Receipt"
msgstr ""
@@ -140,14 +159,12 @@ msgid "Receipt Options"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.view_res_config_settings_form_pos_inherit
-msgid "Select one of the receipting options for point of sales."
+#: model:mail.template,name:pos_ticket_send_by_mail.email_send_pos_receipt
+msgid "Send Receipt"
msgstr ""
#. module: pos_ticket_send_by_mail
#: model:ir.actions.server,name:pos_ticket_send_by_mail.ir_cron_sent_pos_ticket_ir_actions_server
-#: model:ir.cron,cron_name:pos_ticket_send_by_mail.ir_cron_sent_pos_ticket
-#: model:ir.cron,name:pos_ticket_send_by_mail.ir_cron_sent_pos_ticket
msgid "Send Reciept via Email"
msgstr ""
@@ -157,27 +174,31 @@ msgid "Send Status"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: selection:pos.order,email_status:0
+#: model:ir.model.fields.selection,name:pos_ticket_send_by_mail.selection__pos_order__email_status__sent
msgid "Sent"
msgstr ""
#. module: pos_ticket_send_by_mail
#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.view_res_config_settings_form_pos_inherit
-msgid "There are three ways of obtaining a receipt: 1.Do not send receipt via email 2.Email receipt and print it 3. Email receipt and print it unless configured on user that he only receives electronically"
-msgstr ""
-
-#. module: pos_ticket_send_by_mail
-#: model:mail.template,report_name:pos_ticket_send_by_mail.email_send_pos_receipt
-msgid "Ticket ${object.pos_reference}"
+msgid ""
+"There are 4 ways of obtaining a receipt: 1.Do not send receipt via email "
+"2.Email receipt and print it 3. Email receipt and print it unless configured"
+" on user that he only receives electronically 4.Email receipt"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: selection:pos.order,email_status:0
+#: model:ir.model.fields.selection,name:pos_ticket_send_by_mail.selection__pos_order__email_status__to_send
msgid "To send"
msgstr ""
#. module: pos_ticket_send_by_mail
-#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt
+#: model_terms:ir.ui.view,arch_db:pos_ticket_send_by_mail.report_receipt_document
msgid "User:"
msgstr ""
+#. module: pos_ticket_send_by_mail
+#: model:mail.template,subject:pos_ticket_send_by_mail.email_send_pos_receipt
+msgid ""
+"{{ object.user_id.company_id.name }} Received {{ object.pos_reference and "
+"object.pos_reference.split(' ')[1] or '' }}"
+msgstr ""
\ No newline at end of file
diff --git a/pos_ticket_send_by_mail/models/__init__.py b/pos_ticket_send_by_mail/models/__init__.py
index 37a95e46ac..d93ea62153 100644
--- a/pos_ticket_send_by_mail/models/__init__.py
+++ b/pos_ticket_send_by_mail/models/__init__.py
@@ -5,4 +5,5 @@
from . import res_partner
from . import pos_order
+from . import pos_config
from . import res_config_settings
diff --git a/pos_ticket_send_by_mail/models/pos_config.py b/pos_ticket_send_by_mail/models/pos_config.py
new file mode 100644
index 0000000000..16a64f4ff0
--- /dev/null
+++ b/pos_ticket_send_by_mail/models/pos_config.py
@@ -0,0 +1,19 @@
+from odoo import fields, models
+
+
+class PosConfig(models.Model):
+ _inherit = "pos.config"
+
+ receipt_options = fields.Selection(
+ [
+ ("1", "Do not send receipt via email"),
+ ("2", "Email receipt and print it"),
+ (
+ "3",
+ "Email receipt and print it unless configured on user that \
+ he only receives electronically",
+ ),
+ ("4", "Email receipt"),
+ ],
+ string="Receipt",
+ )
diff --git a/pos_ticket_send_by_mail/models/pos_order.py b/pos_ticket_send_by_mail/models/pos_order.py
index 8895bef5fa..12c258695e 100644
--- a/pos_ticket_send_by_mail/models/pos_order.py
+++ b/pos_ticket_send_by_mail/models/pos_order.py
@@ -5,6 +5,7 @@
import logging
+import odoo
from odoo import api, fields, models
_logger = logging.getLogger(__name__)
@@ -23,15 +24,21 @@ class PosOrder(models.Model):
@api.model
def _send_order_cron(self):
_logger.info("------------------------------------------------------")
- mail_template = self.env.ref("pos_ticket_send_by_mail.email_send_pos_receipt")
+ mail_template = self.env.ref(
+ "pos_ticket_send_by_mail.email_send_pos_receipt",
+ raise_if_not_found=False,
+ )
+ if not mail_template.exists():
+ _logger.warning("No mail template found for sending ticket")
+ return
_logger.info("Start to send ticket")
for order in self.search([("email_status", "=", "to_send")]):
mail_template.send_mail(order.id, force_send=True)
order.email_status = "sent"
# Make sure we commit the change to not send ticket twice
- self.env.cr.commit()
+ if not odoo.tools.config["test_enable"]:
+ self.env.cr.commit() # pylint: disable=E8102
- @api.multi
def action_pos_order_paid(self):
# Send e-receipt for the partner.
# It depends on value of the field `receipt_option`
@@ -43,13 +50,17 @@ def action_pos_order_paid(self):
return res
def _set_order_to_send(self):
- icp_sudo = self.env["ir.config_parameter"].sudo()
- receipt_options = icp_sudo.get_param("point_of_sale.receipt_options")
+ receipt_options = self.config_id.receipt_options
receipt_options = receipt_options and int(receipt_options) or False
for order in self:
if (
receipt_options in [2, 3, 4]
and order.partner_id.email
- and not order.partner_id.no_email_pos_receipt
+ and order.partner_id.pos_email_receipt != "no_email_pos_receipt"
):
order.email_status = "to_send"
+
+ def _get_statments(self):
+ self.ensure_one()
+ acc_move_lines = self.account_move.line_ids
+ return acc_move_lines.mapped("statement_id")
diff --git a/pos_ticket_send_by_mail/models/res_config_settings.py b/pos_ticket_send_by_mail/models/res_config_settings.py
index 928f8159e3..d9a80c9f07 100644
--- a/pos_ticket_send_by_mail/models/res_config_settings.py
+++ b/pos_ticket_send_by_mail/models/res_config_settings.py
@@ -3,51 +3,14 @@
# @author: La Louve
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html
-from odoo import api, fields, models
+from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"
- receipt_options = fields.Selection(
- [
- ("1", "Do not send receipt via email"),
- ("2", "Email receipt and print it"),
- (
- "3",
- "Email receipt and print it unless configured on user that \
- he only receives electronically",
- ),
- ("4", "Email receipt"),
- ],
+ pos_receipt_options = fields.Selection(
string="Receipt",
- config_parameter="point_of_sale.receipt_options",
+ related="pos_config_id.receipt_options",
+ readonly=False,
)
-
- @api.model
- def get_values(self):
- res = super().get_values()
- icp_sudo = self.env["ir.config_parameter"].sudo()
- receipt_options = icp_sudo.get_param("point_of_sale.receipt_options")
- res.update(receipt_options=receipt_options)
- return res
-
- @api.model
- def get_default_receipt_options(self):
- receipt_options = self.env["ir.values"].get_default(
- "res.config.settings", "receipt_options"
- )
- return {
- "receipt_options": receipt_options,
- }
-
- @api.multi
- def set_default_receipt_options(self):
- self.ensure_one()
- return (
- self.env["ir.values"]
- .sudo()
- .set_default(
- "res.config.settings", "receipt_options", self.receipt_options or None
- )
- )
diff --git a/pos_ticket_send_by_mail/models/res_partner.py b/pos_ticket_send_by_mail/models/res_partner.py
index 0ea5c3832e..ba80084797 100644
--- a/pos_ticket_send_by_mail/models/res_partner.py
+++ b/pos_ticket_send_by_mail/models/res_partner.py
@@ -3,28 +3,24 @@
# @author: La Louve
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html
-from odoo import fields, models
+from odoo import api, fields, models
class ResPartner(models.Model):
_inherit = "res.partner"
- email_pos_receipt = fields.Boolean(
- string="E-receipt",
- default=False,
- help="If you tick this box and option 3 is selected for 'Receipt'\
- in point of sale settings, the user will only receive e-receipt ",
+ pos_email_receipt = fields.Selection(
+ [
+ ("email_pos_receipt", "E-receipt Only"),
+ ("no_email_pos_receipt", "No E-receipt"),
+ ],
+ string="POS Email Receipt Preference",
+ help="- E-receipt: The user will only receive e-receipt \n"
+ "- No E-receipt: The user will not receive e-receipt",
)
- no_email_pos_receipt = fields.Boolean(
- string="No E-receipt",
- default=False,
- help="If you tick this box, the user will not receive e-receipt ",
- )
- config_receipt_options = fields.Integer(compute="_compute_config_receipt_options")
- def _compute_config_receipt_options(self):
- icp_sudo = self.env["ir.config_parameter"].sudo()
- receipt_options = icp_sudo.get_param("point_of_sale.receipt_options")
- receipt_options = receipt_options and int(receipt_options) or 0
- for record in self:
- record.config_receipt_options = receipt_options
+ @api.model
+ def _load_pos_data_fields(self, config_id):
+ fields = super()._load_pos_data_fields(config_id)
+ fields.append("pos_email_receipt")
+ return fields
diff --git a/pos_ticket_send_by_mail/readme/CONTRIBUTORS.md b/pos_ticket_send_by_mail/readme/CONTRIBUTORS.md
new file mode 100644
index 0000000000..aaff50bdac
--- /dev/null
+++ b/pos_ticket_send_by_mail/readme/CONTRIBUTORS.md
@@ -0,0 +1,2 @@
+- [Trobz](https://www.trobz.com):
+ - Phan Hong Phuc
diff --git a/pos_ticket_send_by_mail/security/ir.model.access.csv b/pos_ticket_send_by_mail/security/ir.model.access.csv
deleted file mode 100644
index 97dd8b917b..0000000000
--- a/pos_ticket_send_by_mail/security/ir.model.access.csv
+++ /dev/null
@@ -1 +0,0 @@
-id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
diff --git a/pos_ticket_send_by_mail/static/src/js/pos_model.js b/pos_ticket_send_by_mail/static/src/js/pos_model.js
deleted file mode 100644
index dd217574e5..0000000000
--- a/pos_ticket_send_by_mail/static/src/js/pos_model.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-# Copyright (C) 2016-Today: La Louve ()
-# Copyright (C) 2019-Today: Druidoo ()
-# @author: La Louve
-# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html
-
-*/
-
-odoo.define("pos_ticket_send_by_mail.pos_model", function (require) {
- "use strict";
- var pos_model = require("point_of_sale.models");
- pos_model.load_fields("res.partner", "email_pos_receipt");
- pos_model.load_models([
- {
- model: "res.config.settings",
- fields: ["receipt_options"],
- loaded: function (self, config_settings) {
- const config_setting =
- config_settings.length > 0
- ? config_settings.reduce(function (prev, current) {
- return prev.id > current.id ? prev : current;
- })
- : false; // Returns object
- self.config_settings = config_setting;
- },
- },
- ]);
-});
diff --git a/pos_ticket_send_by_mail/static/src/js/receipt_screen_widget.esm.js b/pos_ticket_send_by_mail/static/src/js/receipt_screen_widget.esm.js
new file mode 100644
index 0000000000..b94d7d7e35
--- /dev/null
+++ b/pos_ticket_send_by_mail/static/src/js/receipt_screen_widget.esm.js
@@ -0,0 +1,29 @@
+/*
+
+# Copyright (C) 2016-Today: La Louve ()
+# Copyright (C) 2019-Today: Druidoo ()
+# @author: La Louve
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html
+
+*/
+
+import {ReceiptScreen} from "@point_of_sale/app/screens/receipt_screen/receipt_screen";
+import {patch} from "@web/core/utils/patch";
+
+patch(ReceiptScreen.prototype, {
+ get showSendReceiptOption() {
+ const receipt_options = this.pos.config
+ ? this.pos.config.receipt_options
+ : false;
+ const client = this.currentOrder.partner_id;
+ const email_pos_receipt = client ? client.pos_email_receipt : false;
+ if (
+ receipt_options &&
+ receipt_options === "3" &&
+ email_pos_receipt == "email_pos_receipt"
+ ) {
+ return false;
+ }
+ return true;
+ },
+});
diff --git a/pos_ticket_send_by_mail/static/src/js/receipt_screen_widget.js b/pos_ticket_send_by_mail/static/src/js/receipt_screen_widget.js
deleted file mode 100644
index ee2812c1ee..0000000000
--- a/pos_ticket_send_by_mail/static/src/js/receipt_screen_widget.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-
-# Copyright (C) 2016-Today: La Louve ()
-# Copyright (C) 2019-Today: Druidoo ()
-# @author: La Louve
-# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html
-
-*/
-
-odoo.define("pos_ticket_send_by_mail.receipt_screen_widget", function (require) {
- "use strict";
- var models = require("point_of_sale.models");
- var screens = require("point_of_sale.screens");
- var core = require("web.core");
- var gui = require("point_of_sale.gui");
- var _t = core._t;
-
- screens.ReceiptScreenWidget.include({
- print_web: function () {
- var client = this.pos.get_client();
- var email_pos_receipt = client ? client.email_pos_receipt : false;
- var receipt_options = this.pos.config_settings
- ? this.pos.config_settings.receipt_options
- : false;
- if (receipt_options && receipt_options == "3" && email_pos_receipt) {
- console.log("Skip print receipt by web");
- return;
- }
- console.log("1 print receipt by web");
- return this._super();
-
- },
-
- print_xml: function () {
- var client = this.pos.get_client();
- var email_pos_receipt = client ? client.email_pos_receipt : false;
- var receipt_options = this.pos.config_settings
- ? this.pos.config_settings.receipt_options
- : false;
- if (receipt_options && receipt_options == "3" && email_pos_receipt) {
- console.log("Skip print receipt by web");
- return;
- }
- console.log(" print receipt by web");
- return this._super();
-
- },
- });
-});
diff --git a/pos_ticket_send_by_mail/static/src/xml/receipt_screen.xml b/pos_ticket_send_by_mail/static/src/xml/receipt_screen.xml
new file mode 100644
index 0000000000..2ff31cfdde
--- /dev/null
+++ b/pos_ticket_send_by_mail/static/src/xml/receipt_screen.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
diff --git a/pos_ticket_send_by_mail/static/src/xml/templates.xml b/pos_ticket_send_by_mail/static/src/xml/templates.xml
deleted file mode 100644
index 4e0b58d0c6..0000000000
--- a/pos_ticket_send_by_mail/static/src/xml/templates.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/pos_ticket_send_by_mail/tests/test_pos_ticket_mail.py b/pos_ticket_send_by_mail/tests/test_pos_ticket_mail.py
index 5dafebabed..d7d71b73f5 100644
--- a/pos_ticket_send_by_mail/tests/test_pos_ticket_mail.py
+++ b/pos_ticket_send_by_mail/tests/test_pos_ticket_mail.py
@@ -10,6 +10,18 @@ def setUp(self):
self.PosOrder = self.env["pos.order"]
self.partner1 = self.env.ref("base.res_partner_1")
self.posconfig = self.env["pos.config"]
+ self.pos_sale_journal = self.env["account.journal"].search(
+ [("type", "=", "cash")],
+ limit=1,
+ )
+ self.cash_payment_method = self.env["pos.payment.method"].create(
+ {
+ "name": "Cash",
+ "journal_id": self.pos_sale_journal.id,
+ "company_id": self.env.company.id,
+ }
+ )
+
self.pos_config = self.posconfig.search(
[("name", "=", "test_pos_email")], limit=1
)
@@ -19,6 +31,8 @@ def setUp(self):
"name": "test_pos_email",
}
)
+ self.pos_config.journal_id = self.pos_sale_journal.id
+ self.pos_config.payment_method_ids = [(4, self.cash_payment_method.id)]
self.res_users = self.env["res.users"]
self.pos_user = self.res_users.search(
[("login", "=", "pos_test_email")], limit=1
@@ -37,16 +51,15 @@ def setUp(self):
)
if not self.PosSession:
self.PosSession = self.env["pos.session"].create(
- {"user_id": self.pos_user.id, "config_id": self.pos_config.id}
+ {
+ "user_id": self.pos_user.id,
+ "config_id": self.pos_config.id,
+ }
)
self.led_lamp = self.env.ref("point_of_sale.led_lamp")
self.whiteboard_pen = self.env.ref("point_of_sale.whiteboard_pen")
self.newspaper_rack = self.env.ref("point_of_sale.newspaper_rack")
self.partner_3 = self.env.ref("base.res_partner_3")
- self.pos_sale_journal = self.env["account.journal"].search(
- [("type", "=", "cash")]
- )
- self.pos_config.journal_ids = [self.pos_sale_journal[0].id]
def test_01_pos_config_no_mail_sent(self):
"""
@@ -74,62 +87,60 @@ def compute_tax(product, price, qty=1, taxes=None):
if open_session:
current_session = open_session
else:
- self.pos_config.open_session_cb()
+ self.pos_config.open_existing_session_cb()
current_session = self.pos_config.current_session_id
+ pricelist_id = False
+ if self.pos_config.available_pricelist_ids:
+ pricelist_id = self.pos_config.available_pricelist_ids[0].id
untax, atax = compute_tax(self.led_lamp, 0.9)
carrot_order = {
- "data": {
- "amount_paid": untax + atax,
- "amount_return": 0,
- "amount_tax": atax,
- "amount_total": untax + atax,
- "creation_date": fields.Datetime.to_string(fields.Datetime.now()),
- "fiscal_position_id": False,
- "pricelist_id": self.pos_config.available_pricelist_ids[0].id,
- "lines": [
- [
- 0,
- 0,
- {
- "discount": 0,
- "id": 42,
- "pack_lot_ids": [],
- "price_unit": 0.9,
- "product_id": self.led_lamp.id,
- "price_subtotal": 0.9,
- "price_subtotal_incl": 1.04,
- "qty": 1,
- "tax_ids": [(6, 0, self.led_lamp.taxes_id.ids)],
- },
- ]
- ],
- "name": "Order 00042-003-0014",
- "partner_id": False,
- "pos_session_id": current_session.id,
- "sequence_number": 2,
- "statement_ids": [
- [
- 0,
- 0,
- {
- "account_id": self.env.user.partner_id.property_account_receivable_id.id,
- "amount": untax + atax,
- "journal_id": self.pos_sale_journal[0].id,
- "name": fields.Datetime.now(),
- "statement_id": current_session.statement_ids[0].id,
- },
- ]
- ],
- "uid": "00042-003-0014",
- "user_id": self.env.uid,
- },
- "id": "00042-003-0014",
+ "access_token": False,
+ "amount_paid": untax + atax,
+ "amount_return": 0,
+ "amount_tax": atax,
+ "amount_total": untax + atax,
+ "date_order": fields.Datetime.to_string(fields.Datetime.now()),
+ "fiscal_position_id": False,
+ "pricelist_id": pricelist_id,
+ "lines": [
+ [
+ 0,
+ 0,
+ {
+ "discount": 0,
+ "id": 42,
+ "pack_lot_ids": [],
+ "price_unit": 0.9,
+ "product_id": self.led_lamp.id,
+ "price_subtotal": 0.9,
+ "price_subtotal_incl": 1.04,
+ "qty": 1,
+ "tax_ids": [(6, 0, self.led_lamp.taxes_id.ids)],
+ },
+ ]
+ ],
+ "payment_ids": [
+ [
+ 0,
+ 0,
+ {
+ "amount": untax + atax,
+ "name": fields.Datetime.now(),
+ "payment_method_id": self.cash_payment_method.id,
+ },
+ ]
+ ],
+ "name": "Order 00042-003-0014",
+ "partner_id": False,
+ "session_id": current_session.id,
+ "sequence_number": 2,
+ "uuid": "00042-003-0014",
+ "user_id": self.env.uid,
"to_invoice": False,
}
untax, atax = compute_tax(self.whiteboard_pen, 1.2)
- self.PosOrder01 = self.PosOrder.browse(
- self.PosOrder.create_from_ui([carrot_order])
- )
+ pos_order_id = self.PosOrder.sync_from_ui([carrot_order])["pos.order"][0]["id"]
+ self.PosOrder01 = self.PosOrder.browse(pos_order_id)
self.PosOrder01.action_pos_order_paid()
current_session.action_pos_session_closing_control()
@@ -160,63 +171,62 @@ def compute_tax(product, price, qty=1, taxes=None):
if open_session:
current_session = open_session
else:
- self.pos_config.open_session_cb()
+ self.pos_config.open_existing_session_cb()
current_session = self.pos_config.current_session_id
+ pricelist_id = False
+ if self.pos_config.available_pricelist_ids:
+ pricelist_id = self.pos_config.available_pricelist_ids[0].id
untax, atax = compute_tax(self.led_lamp, 0.9)
carrot_order = {
- "data": {
- "amount_paid": untax + atax,
- "amount_return": 0,
- "amount_tax": atax,
- "amount_total": untax + atax,
- "creation_date": fields.Datetime.to_string(fields.Datetime.now()),
- "fiscal_position_id": False,
- "pricelist_id": self.pos_config.available_pricelist_ids[0].id,
- "lines": [
- [
- 0,
- 0,
- {
- "discount": 0,
- "id": 43,
- "pack_lot_ids": [],
- "price_unit": 0.9,
- "product_id": self.led_lamp.id,
- "price_subtotal": 0.9,
- "price_subtotal_incl": 1.04,
- "qty": 1,
- "tax_ids": [(6, 0, self.led_lamp.taxes_id.ids)],
- },
- ]
- ],
- "name": "Order 00042-003-0024",
- "partner_id": False,
- "pos_session_id": current_session.id,
- "sequence_number": 3,
- "statement_ids": [
- [
- 0,
- 0,
- {
- "account_id": self.env.user.partner_id.property_account_receivable_id.id,
- "amount": untax + atax,
- "journal_id": self.pos_sale_journal[0].id,
- "name": fields.Datetime.now(),
- "statement_id": current_session.statement_ids[0].id,
- },
- ]
- ],
- "uid": "00042-003-0028",
- "user_id": self.env.uid,
- },
+ "access_token": False,
+ "amount_paid": untax + atax,
+ "amount_return": 0,
+ "amount_tax": atax,
+ "amount_total": untax + atax,
+ "date_order": fields.Datetime.to_string(fields.Datetime.now()),
+ "fiscal_position_id": False,
+ "pricelist_id": pricelist_id,
+ "lines": [
+ [
+ 0,
+ 0,
+ {
+ "discount": 0,
+ "id": 43,
+ "pack_lot_ids": [],
+ "price_unit": 0.9,
+ "product_id": self.led_lamp.id,
+ "price_subtotal": 0.9,
+ "price_subtotal_incl": 1.04,
+ "qty": 1,
+ "tax_ids": [(6, 0, self.led_lamp.taxes_id.ids)],
+ },
+ ]
+ ],
+ "payment_ids": [
+ [
+ 0,
+ 0,
+ {
+ "amount": untax + atax,
+ "name": fields.Datetime.now(),
+ "payment_method_id": self.cash_payment_method.id,
+ },
+ ]
+ ],
+ "name": "Order 00042-003-0024",
+ "partner_id": False,
+ "session_id": current_session.id,
+ "sequence_number": 3,
+ "uuid": "00042-003-0028",
+ "user_id": self.env.uid,
"id": "00042-003-0028",
"to_invoice": False,
}
untax, atax = compute_tax(self.whiteboard_pen, 1.2)
- self.PosOrder02 = self.PosOrder.browse(
- self.PosOrder.create_from_ui([carrot_order])
- )
- self.PosOrder.action_pos_order_paid()
+ pos_order_id = self.PosOrder.sync_from_ui([carrot_order])["pos.order"][0]["id"]
+ self.PosOrder02 = self.PosOrder.browse(pos_order_id)
+ self.PosOrder02.action_pos_order_paid()
self.PosOrder02._send_order_cron()
current_session.action_pos_session_closing_control()
@@ -247,64 +257,63 @@ def compute_tax(product, price, qty=1, taxes=None):
if open_session:
current_session = open_session
else:
- self.pos_config.open_session_cb()
+ self.pos_config.open_existing_session_cb()
current_session = self.pos_config.current_session_id
+ pricelist_id = False
+ if self.pos_config.available_pricelist_ids:
+ pricelist_id = self.pos_config.available_pricelist_ids[0].id
untax, atax = compute_tax(self.led_lamp, 0.9)
carrot_order = {
- "data": {
- "amount_paid": untax + atax,
- "amount_return": 0,
- "amount_tax": atax,
- "amount_total": untax + atax,
- "creation_date": fields.Datetime.to_string(fields.Datetime.now()),
- "fiscal_position_id": False,
- "pricelist_id": self.pos_config.available_pricelist_ids[0].id,
- "lines": [
- [
- 0,
- 0,
- {
- "discount": 0,
- "id": 44,
- "pack_lot_ids": [],
- "price_unit": 0.9,
- "product_id": self.led_lamp.id,
- "price_subtotal": 0.9,
- "price_subtotal_incl": 1.04,
- "qty": 1,
- "tax_ids": [(6, 0, self.led_lamp.taxes_id.ids)],
- },
- ]
- ],
- "name": "Order 00042-003-0044",
- "partner_id": self.partner1.id,
- "pos_session_id": current_session.id,
- "sequence_number": 4,
- "statement_ids": [
- [
- 0,
- 0,
- {
- "account_id": self.env.user.partner_id.property_account_receivable_id.id,
- "amount": untax + atax,
- "journal_id": self.pos_sale_journal[0].id,
- "name": fields.Datetime.now(),
- "statement_id": current_session.statement_ids[0].id,
- },
- ]
- ],
- "uid": "00042-003-0129",
- "user_id": self.env.uid,
- },
+ "access_token": False,
+ "amount_paid": untax + atax,
+ "amount_return": 0,
+ "amount_tax": atax,
+ "amount_total": untax + atax,
+ "date_order": fields.Datetime.to_string(fields.Datetime.now()),
+ "fiscal_position_id": False,
+ "pricelist_id": pricelist_id,
+ "lines": [
+ [
+ 0,
+ 0,
+ {
+ "discount": 0,
+ "id": 44,
+ "pack_lot_ids": [],
+ "price_unit": 0.9,
+ "product_id": self.led_lamp.id,
+ "price_subtotal": 0.9,
+ "price_subtotal_incl": 1.04,
+ "qty": 1,
+ "tax_ids": [(6, 0, self.led_lamp.taxes_id.ids)],
+ },
+ ]
+ ],
+ "payment_ids": [
+ [
+ 0,
+ 0,
+ {
+ "amount": untax + atax,
+ "name": fields.Datetime.now(),
+ "payment_method_id": self.cash_payment_method.id,
+ },
+ ]
+ ],
+ "name": "Order 00042-003-0044",
+ "partner_id": self.partner1.id,
+ "session_id": current_session.id,
+ "sequence_number": 4,
+ "uuid": "00042-003-0129",
+ "user_id": self.env.uid,
"id": "00042-003-0129",
"to_invoice": False,
}
untax, atax = compute_tax(self.whiteboard_pen, 1.2)
- self.PosOrder03 = self.PosOrder.browse(
- self.PosOrder.create_from_ui([carrot_order])
- )
- self.PosOrder.action_pos_order_paid()
- self.PosOrder._send_order_cron()
+ pos_order_id = self.PosOrder.sync_from_ui([carrot_order])["pos.order"][0]["id"]
+ self.PosOrder03 = self.PosOrder.browse(pos_order_id)
+ self.PosOrder03.action_pos_order_paid()
+ self.PosOrder03._send_order_cron()
current_session.action_pos_session_closing_control()
def test_04_pos_config_mail_print_partner_e_ticket(self):
@@ -324,7 +333,7 @@ def compute_tax(product, price, qty=1, taxes=None):
return untax, sum(tax.get("amount", 0.0) for tax in res["taxes"])
self.ir_config_parameter.set_param("point_of_sale.receipt_options", "2")
- self.partner_3.email_pos_receipt = True
+ self.partner_3.pos_email_receipt = "email_pos_receipt"
open_session = self.PosSession.search(
[
("state", "!=", "closed"),
@@ -335,62 +344,61 @@ def compute_tax(product, price, qty=1, taxes=None):
if open_session:
current_session = open_session
else:
- self.pos_config.open_session_cb()
+ self.pos_config.open_existing_session_cb()
current_session = self.pos_config.current_session_id
+ pricelist_id = False
+ if self.pos_config.available_pricelist_ids:
+ pricelist_id = self.pos_config.available_pricelist_ids[0].id
untax, atax = compute_tax(self.led_lamp, 0.9)
carrot_order = {
- "data": {
- "amount_paid": untax + atax,
- "amount_return": 0,
- "amount_tax": atax,
- "amount_total": untax + atax,
- "creation_date": fields.Datetime.to_string(fields.Datetime.now()),
- "fiscal_position_id": False,
- "pricelist_id": self.pos_config.available_pricelist_ids[0].id,
- "lines": [
- [
- 0,
- 0,
- {
- "discount": 0,
- "id": 45,
- "pack_lot_ids": [],
- "price_unit": 0.9,
- "product_id": self.led_lamp.id,
- "price_subtotal": 0.9,
- "price_subtotal_incl": 1.04,
- "qty": 1,
- "tax_ids": [(6, 0, self.led_lamp.taxes_id.ids)],
- },
- ]
- ],
- "name": "Order 00042-003-0051",
- "partner_id": self.partner_3.id,
- "pos_session_id": current_session.id,
- "sequence_number": 4,
- "statement_ids": [
- [
- 0,
- 0,
- {
- "account_id": self.env.user.partner_id.property_account_receivable_id.id,
- "amount": untax + atax,
- "journal_id": self.pos_sale_journal[0].id,
- "name": fields.Datetime.now(),
- "statement_id": current_session.statement_ids[0].id,
- },
- ]
- ],
- "uid": "00042-003-0151",
- "user_id": self.env.uid,
- },
+ "access_token": False,
+ "amount_paid": untax + atax,
+ "amount_return": 0,
+ "amount_tax": atax,
+ "amount_total": untax + atax,
+ "date_order": fields.Datetime.to_string(fields.Datetime.now()),
+ "fiscal_position_id": False,
+ "pricelist_id": pricelist_id,
+ "lines": [
+ [
+ 0,
+ 0,
+ {
+ "discount": 0,
+ "id": 45,
+ "pack_lot_ids": [],
+ "price_unit": 0.9,
+ "product_id": self.led_lamp.id,
+ "price_subtotal": 0.9,
+ "price_subtotal_incl": 1.04,
+ "qty": 1,
+ "tax_ids": [(6, 0, self.led_lamp.taxes_id.ids)],
+ },
+ ]
+ ],
+ "payment_ids": [
+ [
+ 0,
+ 0,
+ {
+ "amount": untax + atax,
+ "name": fields.Datetime.now(),
+ "payment_method_id": self.cash_payment_method.id,
+ },
+ ]
+ ],
+ "name": "Order 00042-003-0051",
+ "partner_id": self.partner_3.id,
+ "session_id": current_session.id,
+ "sequence_number": 4,
+ "uuid": "00042-003-0151",
+ "user_id": self.env.uid,
"id": "00042-003-0151",
"to_invoice": False,
}
untax, atax = compute_tax(self.whiteboard_pen, 1.2)
- self.PosOrder04 = self.PosOrder.browse(
- self.PosOrder.create_from_ui([carrot_order])
- )
+ pos_order_id = self.PosOrder.sync_from_ui([carrot_order])["pos.order"][0]["id"]
+ self.PosOrder04 = self.PosOrder.browse(pos_order_id)
self.PosOrder04.action_pos_order_paid()
self.PosOrder._send_order_cron()
current_session.action_pos_session_closing_control()
diff --git a/pos_ticket_send_by_mail/views/report_paperformat.xml b/pos_ticket_send_by_mail/views/report_paperformat.xml
old mode 100755
new mode 100644
diff --git a/pos_ticket_send_by_mail/views/report_receipt.xml b/pos_ticket_send_by_mail/views/report_receipt.xml
old mode 100755
new mode 100644
index 5100f4b09b..1e8a8bf640
--- a/pos_ticket_send_by_mail/views/report_receipt.xml
+++ b/pos_ticket_send_by_mail/views/report_receipt.xml
@@ -1,108 +1,119 @@
-
-
-
-
-
-
-
-
- User:
-
-
- Date:
-
-
-
+
+
+
+
+
+
+
+
+ User:
+
+
+ Date:
+
+
-
-
-
-
- | Description |
- Quantity |
- Price |
-
-
-
-
+
+
+
+
+
+ | Description |
+ Quantity |
+ Price |
+
+
+
+
+
+ |
+
+ |
+
+
+
+
+ |
+
+
+
+
+
+
+ %
+
+ |
+
+
+
+
+
+
+
|
-
+ Taxes
|
-
-
-
- |
-
-
-
-
-
-
- %
-
+
|
-
-
-
-
-
-
- |
- Taxes
- |
-
-
- |
-
-
- |
- Total
- |
-
-
- |
-
-
-
-
-
-
- | Payment Mode |
- Amount |
-
-
-
-
|
-
+ Total
|
-
+ |
|
-
-
+
+
+
+
+
+ | Payment Mode |
+ Amount |
+
+
+
+
+ |
+
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pos_ticket_send_by_mail/views/view_pos_config_settings.xml b/pos_ticket_send_by_mail/views/view_pos_config_settings.xml
index 15624bad38..4e224f6a94 100644
--- a/pos_ticket_send_by_mail/views/view_pos_config_settings.xml
+++ b/pos_ticket_send_by_mail/views/view_pos_config_settings.xml
@@ -6,37 +6,32 @@
res.config.settings
-
- Receipt Options
-
-
+
+
-
-
-
-
- Select one of the receipting options for point of sales.
-
-
-
-
-
-
-
-
+
+
+
-
+
+ Receipt
+ pos.order
+ qweb-pdf
+ pos_ticket_send_by_mail.report_receipt
+ pos_ticket_send_by_mail.report_receipt
+
+ 'POS-Receipt-'+(object.name or '').replace('/','-')
+
diff --git a/pos_ticket_send_by_mail/views/view_res_partner.xml b/pos_ticket_send_by_mail/views/view_res_partner.xml
index ddb4d70aa4..e012f88232 100644
--- a/pos_ticket_send_by_mail/views/view_res_partner.xml
+++ b/pos_ticket_send_by_mail/views/view_res_partner.xml
@@ -6,17 +6,7 @@
-
-
-
+