Skip to content

Conversation

@P-H-Phuc
Copy link
Owner

@P-H-Phuc P-H-Phuc commented Oct 20, 2025

This module was initially part of the Foodcoop set of addons. We're now migrating it to 18.0 and taking this occasion to contribute it to OCA.

  • Go to General Settings > Point of Sale app
image
  • Go to Customer Form > edit POS Email Receipt Preference field
image
  • Create a order in PoS UI and validate it > Print report and send a email to customer
image

@P-H-Phuc P-H-Phuc force-pushed the 18.0-mig-pos_ticket_send_by_mail branch 2 times, most recently from 762b8a1 to 2148acd Compare October 31, 2025 08:43
@P-H-Phuc
Copy link
Owner Author

Resolved!

@P-H-Phuc P-H-Phuc force-pushed the 18.0-mig-pos_ticket_send_by_mail branch 2 times, most recently from 0e14b17 to 2194078 Compare October 31, 2025 09:05
Copy link

@nguyenminhchien nguyenminhchien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I cannot test the module since i face this error which prevents me from starting the application.
image

@P-H-Phuc P-H-Phuc force-pushed the 18.0-mig-pos_ticket_send_by_mail branch 2 times, most recently from b43dabb to 81f327c Compare October 31, 2025 10:13
Copy link

@nguyenminhchien nguyenminhchien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error when running the cron to send email (add a new unit test for that cron please):

RPC_ERROR

Odoo Server Error

Occured on localhost:10069 on model ir.cron on 2025-11-03 08:37:29 GMT

Traceback (most recent call last):
  File "<1163>", line 508, in template_1163
  File "<1163>", line 490, in template_1163_content
  File "<1163>", line 224, in template_1163_t_call_0
AttributeError: 'pos.order' object has no attribute 'statement_ids'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/chien/code/odoo/odoo/18.0/odoo/tools/safe_eval.py", line 397, in safe_eval
    return unsafe_eval(c, globals_dict, locals_dict)
  File "ir.actions.server(437,)", line 1, in <module>
  File "/home/chien/code/oca/pos/18.0/pos_ticket_send_by_mail/models/pos_order.py", line 36, in _send_order_cron
    mail_template.send_mail(order.id, force_send=True)
  File "/home/chien/code/odoo/odoo/18.0/addons/mail/models/mail_template.py", line 612, in send_mail
    return self.send_mail_batch(
  File "/home/chien/code/odoo/odoo/18.0/addons/mail/models/mail_template.py", line 642, in send_mail_batch
    res_ids_values = self._generate_template(
  File "/home/chien/code/odoo/odoo/18.0/addons/mail/models/mail_template.py", line 567, in _generate_template
    template._generate_template_attachments(
  File "/home/chien/code/odoo/odoo/18.0/addons/mail/models/mail_template.py", line 297, in _generate_template_attachments
    report_content, report_format = self.env['ir.actions.report']._render_qweb_pdf(report, [res_id])
  File "/home/chien/code/odoo/odoo/18.0/odoo/addons/base/models/ir_actions_report.py", line 1018, in _render_qweb_pdf
    collected_streams, report_type = self._pre_render_qweb_pdf(report_ref, res_ids=res_ids, data=data)
  File "/home/chien/code/odoo/odoo/18.0/addons/account/models/ir_actions_report.py", line 75, in _pre_render_qweb_pdf
    return super()._pre_render_qweb_pdf(report_ref, res_ids=res_ids, data=data)
  File "/home/chien/code/odoo/odoo/18.0/odoo/addons/base/models/ir_actions_report.py", line 1009, in _pre_render_qweb_pdf
    return self._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids), 'pdf'
  File "/home/chien/code/odoo/odoo/18.0/addons/account_edi_ubl_cii/models/ir_actions_report.py", line 11, in _render_qweb_pdf_prepare_streams
    collected_streams = super()._render_qweb_pdf_prepare_streams(report_ref, data, res_ids)
  File "/home/chien/code/odoo/odoo/18.0/addons/account/models/ir_actions_report.py", line 22, in _render_qweb_pdf_prepare_streams
    return super()._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids)
  File "/home/chien/code/odoo/odoo/18.0/odoo/addons/base/models/ir_actions_report.py", line 857, in _render_qweb_pdf_prepare_streams
    html = self.with_context(**additional_context)._render_qweb_html(report_ref, all_res_ids_wo_stream, data=data)[0]
  File "/home/chien/code/odoo/odoo/18.0/odoo/addons/base/models/ir_actions_report.py", line 1097, in _render_qweb_html
    return self._render_template(report.report_name, data), 'html'
  File "/home/chien/code/odoo/odoo/18.0/odoo/addons/base/models/ir_actions_report.py", line 773, in _render_template
    return view_obj._render_template(template, values).encode()
  File "/home/chien/code/odoo/odoo/18.0/odoo/addons/base/models/ir_ui_view.py", line 2218, in _render_template
    return self.env['ir.qweb']._render(template, values)
  File "/home/chien/code/odoo/odoo/18.0/odoo/tools/profiler.py", line 313, in _tracked_method_render
    return method_render(self, template, values, **options)
  File "/home/chien/code/odoo/odoo/18.0/odoo/addons/base/models/ir_qweb.py", line 607, in _render
    result = ''.join(rendering)
  File "<1163>", line 516, in template_1163
odoo.addons.base.models.ir_qweb.QWebException: Error while render the template
AttributeError: 'pos.order' object has no attribute 'statement_ids'
Template: pos_ticket_send_by_mail.report_receipt
Path: /t/t/t/div/table[1]/tbody/tr/td[2]/t/span
Node: <span t-field="line.qty"/>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/chien/code/odoo/odoo/18.0/odoo/http.py", line 2144, in _transactioning
    return service_model.retrying(func, env=self.env)
  File "/home/chien/code/odoo/odoo/18.0/odoo/service/model.py", line 156, in retrying
    result = func()
  File "/home/chien/code/odoo/odoo/18.0/odoo/http.py", line 2111, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/home/chien/code/odoo/odoo/18.0/odoo/http.py", line 2359, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/home/chien/code/odoo/odoo/18.0/odoo/addons/base/models/ir_http.py", line 333, in _dispatch
    result = endpoint(**request.params)
  File "/home/chien/code/odoo/odoo/18.0/odoo/http.py", line 754, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/home/chien/code/odoo/odoo/18.0/addons/web/controllers/dataset.py", line 42, in call_button
    action = call_kw(request.env[model], method, args, kwargs)
  File "/home/chien/code/odoo/odoo/18.0/odoo/api.py", line 535, in call_kw
    result = getattr(recs, name)(*args, **kwargs)
  File "/home/chien/code/odoo/odoo/18.0/odoo/addons/base/models/ir_cron.py", line 120, in method_direct_trigger
    self.ir_actions_server_id.run()
  File "/home/chien/code/odoo/odoo/18.0/odoo/addons/base/models/ir_actions.py", line 995, in run
    res = runner(run_self, eval_context=eval_context)
  File "/home/chien/code/odoo/odoo/18.0/odoo/addons/base/models/ir_actions.py", line 827, in _run_action_code_multi
    safe_eval(self.code.strip(), eval_context, mode="exec", nocopy=True, filename=str(self))  # nocopy allows to return 'action'
  File "/home/chien/code/odoo/odoo/18.0/odoo/tools/safe_eval.py", line 411, in safe_eval
    raise ValueError('%r while evaluating\n%r' % (e, expr))
ValueError: QWebException('Error while render the template') while evaluating
'model._send_order_cron()'

The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
    RPCError@http://localhost:10069/web/assets/d1852bb/web.assets_web.min.js:3159:338
    makeErrorFromResponse@http://localhost:10069/web/assets/d1852bb/web.assets_web.min.js:3162:163
    rpc._rpc/promise</<@http://localhost:10069/web/assets/d1852bb/web.assets_web.min.js:3167:34
    

)

@api.model
def get_values(self):

This comment was marked as resolved.

if (
receipt_options in [2, 3, 4]
and order.partner_id.email
and order.partner_id.pos_email_receipt == "email_pos_receipt"

This comment was marked as resolved.

he only receives electronically",
),
("4", "Email receipt"),
],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a warning:

2025-11-03 08:24:13,798 173159 WARNING v18c_pos_ticket_send_by_mail odoo.fields: res.config.settings.pos_receipt_options: selection attribute will be ignored as the field is related 

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning's still there. you should remove the Selection value.

@nguyenminhchien
Copy link

@P-H-Phuc just remind in the case you forgot this one

@P-H-Phuc P-H-Phuc force-pushed the 18.0-mig-pos_ticket_send_by_mail branch from 81f327c to 6925b1b Compare November 21, 2025 07:16
Copy link

@nguyenminhchien nguyenminhchien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Receipt:

  • Lack of information: no quantity, no price
  • String currency symbol
image

he only receives electronically",
),
("4", "Email receipt"),
],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning's still there. you should remove the Selection value.

@P-H-Phuc P-H-Phuc force-pushed the 18.0-mig-pos_ticket_send_by_mail branch 2 times, most recently from 228c918 to 1b187ee Compare November 24, 2025 07:46
@P-H-Phuc
Copy link
Owner Author

Resolved!

<t t-if="o.state != 'cancel'">
<span
t-out="line.price_subtotal_incl"
t-options='{"widget": "monetary", "display_currency": o.company_id.currency_id}'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
t-options='{"widget": "monetary", "display_currency": o.company_id.currency_id}'
t-options='{"widget": "monetary", "display_currency": o.currency_id}'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apply the same for other places: get the currency from the pos order.

<odoo>
<template id="report_receipt">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Print the report in the language of Partner. Take this for reference:

    <template id="report_check_base_a4">
        <t t-call="web.html_container">
            <t t-foreach="docs" t-as="o">
                <t
                    t-call="account_check_printing_report_base.report_check_base_a4_document"
                    t-lang="o.partner_id.lang"
                />
            </t>
        </t>
    </template>

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved! Please help me to review

@P-H-Phuc P-H-Phuc force-pushed the 18.0-mig-pos_ticket_send_by_mail branch from 1b187ee to aa69284 Compare November 25, 2025 05:01
@P-H-Phuc P-H-Phuc force-pushed the 18.0-mig-pos_ticket_send_by_mail branch 2 times, most recently from 7d342c7 to f9f7d49 Compare November 25, 2025 08:31
chetanrdhaduk and others added 8 commits November 26, 2025 09:59
[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
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/
…for specific members

[UPD] pos_ticket_send_by_mail: Product Returns and Refunds on POS
@P-H-Phuc P-H-Phuc force-pushed the 18.0-mig-pos_ticket_send_by_mail branch from f9f7d49 to 28b72e5 Compare November 26, 2025 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants