Initial commit: Odoo 18.0-20251222 extra-addons
This commit is contained in:
97
sale_order_note_template/README.rst
Executable file
97
sale_order_note_template/README.rst
Executable file
@@ -0,0 +1,97 @@
|
||||
==========================================
|
||||
Sale Orders Terms and conditions Templates
|
||||
==========================================
|
||||
|
||||
..
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:d1e58e979b84ddf98ac6d3f3a1f8d477a3222c1c5065725c8cba073424108f83
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||
:target: https://odoo-community.org/page/development-status
|
||||
:alt: Beta
|
||||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
|
||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||
:alt: License: AGPL-3
|
||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
|
||||
:target: https://github.com/OCA/sale-workflow/tree/18.0/sale_order_note_template
|
||||
:alt: OCA/sale-workflow
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_order_note_template
|
||||
:alt: Translate me on Weblate
|
||||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
||||
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=18.0
|
||||
:alt: Try me on Runboat
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|
||||
This module add sale terms and conditions templates and change existing
|
||||
terms and conditions (sale_order.note) field type from Text to Html.
|
||||
|
||||
Users will be able to select *terms and conditions template* to fulfill
|
||||
*terms and conditions* likes in mail composer users can configure their
|
||||
template using jinja2.
|
||||
|
||||
How this module differ from `sale_comment_template <https://github.com/OCA/sale-reporting/tree/14.0/sale_comment_template>`__?
|
||||
------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
- `base_comment_template <https://github.com/OCA/reporting-engine/tree/14.0/base_comment_template>`__
|
||||
is for managing comments not terms, it would probably see as mess for
|
||||
users to mixed terms and comments.
|
||||
- `sale_comment_template <https://github.com/OCA/sale-reporting/tree/14.0/sale_comment_template>`__
|
||||
depends on
|
||||
`account_comment_template <https://github.com/OCA/account-invoice-reporting/tree/14.0/account_comment_template>`__
|
||||
comments are forwards to generated invoices, here we don't really
|
||||
display sales terms on final invoices
|
||||
- `base_comment_template <https://github.com/OCA/reporting-engine/tree/14.0/base_comment_template>`__
|
||||
at the time writing do not support template engine
|
||||
|
||||
**Table of contents**
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
- add a post_init_hook and / or a uninstall_hook to handle correctly the
|
||||
conversion (Text <--> Html).
|
||||
- support qweb report templating engine
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
||||
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_order_note_template%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
Do not contact contributors directly about support or help with technical issues.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
* Pierre Verkest
|
||||
|
||||
Maintainers
|
||||
-----------
|
||||
|
||||
This module is maintained by the OCA.
|
||||
|
||||
.. image:: https://odoo-community.org/logo.png
|
||||
:alt: Odoo Community Association
|
||||
:target: https://odoo-community.org
|
||||
|
||||
OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||
mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.
|
||||
|
||||
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/18.0/sale_order_note_template>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
1
sale_order_note_template/__init__.py
Executable file
1
sale_order_note_template/__init__.py
Executable file
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
20
sale_order_note_template/__manifest__.py
Executable file
20
sale_order_note_template/__manifest__.py
Executable file
@@ -0,0 +1,20 @@
|
||||
# © 2020 Pierre Verkest <pierreverkest84@gmail.com>)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "Sale Orders Terms and conditions Templates",
|
||||
"summary": "Add sale orders terms and conditions template that can be "
|
||||
"used to quickly fullfill sale order terms and conditions",
|
||||
"category": "Sales/Sales",
|
||||
"version": "18.0.1.0.0",
|
||||
"author": "Pierre Verkest,Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/sale-workflow",
|
||||
"license": "AGPL-3",
|
||||
"depends": ["sale_management"],
|
||||
"data": [
|
||||
"security/ir.model.access.csv",
|
||||
"views/sale_views.xml",
|
||||
"views/sale_terms_template.xml",
|
||||
],
|
||||
"installable": True,
|
||||
}
|
||||
99
sale_order_note_template/i18n/it.po
Executable file
99
sale_order_note_template/i18n/it.po
Executable file
@@ -0,0 +1,99 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * sale_order_note_template
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 18.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"PO-Revision-Date: 2025-04-05 11:06+0000\n"
|
||||
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
|
||||
"Language-Team: none\n"
|
||||
"Language: it\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 5.10.2\n"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__active
|
||||
msgid "Active"
|
||||
msgstr "Attivo"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__create_uid
|
||||
msgid "Created by"
|
||||
msgstr "Creato da"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__create_date
|
||||
msgid "Created on"
|
||||
msgstr "Creato il"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__display_name
|
||||
msgid "Display Name"
|
||||
msgstr "Nome visualizzato"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__id
|
||||
msgid "ID"
|
||||
msgstr "ID"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__write_uid
|
||||
msgid "Last Updated by"
|
||||
msgstr "Ultimo aggiornamento di"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__write_date
|
||||
msgid "Last Updated on"
|
||||
msgstr "Ultimo aggiornamento il"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__name
|
||||
#: model_terms:ir.ui.view,arch_db:sale_order_note_template.view_sale_terms_template_form
|
||||
#: model_terms:ir.ui.view,arch_db:sale_order_note_template.view_sale_terms_template_search
|
||||
#: model_terms:ir.ui.view,arch_db:sale_order_note_template.view_sale_terms_template_tree
|
||||
msgid "Name"
|
||||
msgstr "Nome"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model,name:sale_order_note_template.model_sale_terms_template
|
||||
msgid "Sale terms template"
|
||||
msgstr "Modello team vendite"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model,name:sale_order_note_template.model_sale_order
|
||||
msgid "Sales Order"
|
||||
msgstr "Ordine di vendita"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model_terms:ir.ui.view,arch_db:sale_order_note_template.view_order_form_terms_template
|
||||
msgid "Terms and Conditions"
|
||||
msgstr "Termini e condizioni"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_order__note
|
||||
msgid "Terms and conditions"
|
||||
msgstr "Termini e condizioni"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.ui.menu,name:sale_order_note_template.menu_sale_terms_template
|
||||
#: model_terms:ir.ui.view,arch_db:sale_order_note_template.view_sale_terms_template_form
|
||||
#: model_terms:ir.ui.view,arch_db:sale_order_note_template.view_sale_terms_template_search
|
||||
msgid "Terms and conditions Templates"
|
||||
msgstr "Modelli termini e condizioni"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.actions.act_window,name:sale_order_note_template.action_sale_terms_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_order__terms_template_id
|
||||
#: model_terms:ir.ui.view,arch_db:sale_order_note_template.view_order_form_terms_template
|
||||
msgid "Terms and conditions template"
|
||||
msgstr "Modello termini e condizioni"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__text
|
||||
msgid "Terms template"
|
||||
msgstr "Modelli termini"
|
||||
96
sale_order_note_template/i18n/sale_order_note_template.pot
Executable file
96
sale_order_note_template/i18n/sale_order_note_template.pot
Executable file
@@ -0,0 +1,96 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * sale_order_note_template
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 18.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: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__active
|
||||
msgid "Active"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__create_uid
|
||||
msgid "Created by"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__create_date
|
||||
msgid "Created on"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__display_name
|
||||
msgid "Display Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__id
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__write_uid
|
||||
msgid "Last Updated by"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__write_date
|
||||
msgid "Last Updated on"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__name
|
||||
#: model_terms:ir.ui.view,arch_db:sale_order_note_template.view_sale_terms_template_form
|
||||
#: model_terms:ir.ui.view,arch_db:sale_order_note_template.view_sale_terms_template_search
|
||||
#: model_terms:ir.ui.view,arch_db:sale_order_note_template.view_sale_terms_template_tree
|
||||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model,name:sale_order_note_template.model_sale_terms_template
|
||||
msgid "Sale terms template"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model,name:sale_order_note_template.model_sale_order
|
||||
msgid "Sales Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model_terms:ir.ui.view,arch_db:sale_order_note_template.view_order_form_terms_template
|
||||
msgid "Terms and Conditions"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_order__note
|
||||
msgid "Terms and conditions"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.ui.menu,name:sale_order_note_template.menu_sale_terms_template
|
||||
#: model_terms:ir.ui.view,arch_db:sale_order_note_template.view_sale_terms_template_form
|
||||
#: model_terms:ir.ui.view,arch_db:sale_order_note_template.view_sale_terms_template_search
|
||||
msgid "Terms and conditions Templates"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.actions.act_window,name:sale_order_note_template.action_sale_terms_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_order__terms_template_id
|
||||
#: model_terms:ir.ui.view,arch_db:sale_order_note_template.view_order_form_terms_template
|
||||
msgid "Terms and conditions template"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__text
|
||||
msgid "Terms template"
|
||||
msgstr ""
|
||||
99
sale_order_note_template/i18n/tr.po
Executable file
99
sale_order_note_template/i18n/tr.po
Executable file
@@ -0,0 +1,99 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * sale_order_note_template
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 18.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"PO-Revision-Date: 2025-08-29 11:43+0000\n"
|
||||
"Last-Translator: Betül Öğmen <betulo@eska.biz>\n"
|
||||
"Language-Team: none\n"
|
||||
"Language: tr\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 5.10.4\n"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__active
|
||||
msgid "Active"
|
||||
msgstr "Etkin"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__create_uid
|
||||
msgid "Created by"
|
||||
msgstr "Oluşturan"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__create_date
|
||||
msgid "Created on"
|
||||
msgstr "Oluşturulma"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__display_name
|
||||
msgid "Display Name"
|
||||
msgstr "Görünen İsim"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__id
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__write_uid
|
||||
msgid "Last Updated by"
|
||||
msgstr "Son Güncelleyen"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__write_date
|
||||
msgid "Last Updated on"
|
||||
msgstr "Son Güncelleme"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__name
|
||||
#: model_terms:ir.ui.view,arch_db:sale_order_note_template.view_sale_terms_template_form
|
||||
#: model_terms:ir.ui.view,arch_db:sale_order_note_template.view_sale_terms_template_search
|
||||
#: model_terms:ir.ui.view,arch_db:sale_order_note_template.view_sale_terms_template_tree
|
||||
msgid "Name"
|
||||
msgstr "İsim"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model,name:sale_order_note_template.model_sale_terms_template
|
||||
msgid "Sale terms template"
|
||||
msgstr "Satış koşulları şablonu"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model,name:sale_order_note_template.model_sale_order
|
||||
msgid "Sales Order"
|
||||
msgstr "Satış Siparişi"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model_terms:ir.ui.view,arch_db:sale_order_note_template.view_order_form_terms_template
|
||||
msgid "Terms and Conditions"
|
||||
msgstr "Şartlar ve Koşullar"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_order__note
|
||||
msgid "Terms and conditions"
|
||||
msgstr "Şartlar ve koşullar"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.ui.menu,name:sale_order_note_template.menu_sale_terms_template
|
||||
#: model_terms:ir.ui.view,arch_db:sale_order_note_template.view_sale_terms_template_form
|
||||
#: model_terms:ir.ui.view,arch_db:sale_order_note_template.view_sale_terms_template_search
|
||||
msgid "Terms and conditions Templates"
|
||||
msgstr "Şartlar ve koşullar Şablonu"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.actions.act_window,name:sale_order_note_template.action_sale_terms_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_order__terms_template_id
|
||||
#: model_terms:ir.ui.view,arch_db:sale_order_note_template.view_order_form_terms_template
|
||||
msgid "Terms and conditions template"
|
||||
msgstr "Şartlar ve koşullar şablonu"
|
||||
|
||||
#. module: sale_order_note_template
|
||||
#: model:ir.model.fields,field_description:sale_order_note_template.field_sale_terms_template__text
|
||||
msgid "Terms template"
|
||||
msgstr "Koşullar şablonu"
|
||||
2
sale_order_note_template/models/__init__.py
Executable file
2
sale_order_note_template/models/__init__.py
Executable file
@@ -0,0 +1,2 @@
|
||||
from . import sale_terms_template
|
||||
from . import sale_order
|
||||
19
sale_order_note_template/models/sale_order.py
Executable file
19
sale_order_note_template/models/sale_order.py
Executable file
@@ -0,0 +1,19 @@
|
||||
# Copyright 2021 Pierre Verkest <pierreverkest84@gmail.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
_inherit = "sale.order"
|
||||
|
||||
terms_template_id = fields.Many2one(
|
||||
"sale.terms_template",
|
||||
string="Terms and conditions template",
|
||||
)
|
||||
note = fields.Html()
|
||||
|
||||
@api.onchange("terms_template_id")
|
||||
def _onchange_terms_template_id(self):
|
||||
if self.terms_template_id:
|
||||
self.note = self.terms_template_id.get_value(self)
|
||||
44
sale_order_note_template/models/sale_terms_template.py
Executable file
44
sale_order_note_template/models/sale_terms_template.py
Executable file
@@ -0,0 +1,44 @@
|
||||
# Copyright 2014 Guewen Baconnier (Camptocamp SA)
|
||||
# Copyright 2013-2014 Nicolas Bessi (Camptocamp SA)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class SaleTermsTemplate(models.Model):
|
||||
_name = "sale.terms_template"
|
||||
_description = "Sale terms template"
|
||||
|
||||
active = fields.Boolean(default=True)
|
||||
|
||||
name = fields.Char(required=True)
|
||||
|
||||
text = fields.Html(string="Terms template", translate=True)
|
||||
|
||||
def get_value(self, sale_order, add_context=None, post_process=True):
|
||||
"""Get sales terms from template.
|
||||
|
||||
Like in mail composer `text` template can use jinja or qweb syntax.
|
||||
|
||||
if `partner_id` is provide, it will retreive it's lang to use the
|
||||
right translation.
|
||||
|
||||
Then template is populated with model/res_id attributes according
|
||||
jinja/qweb instructions.
|
||||
|
||||
:param sale_order: recordset (browsed) sale order
|
||||
:param add_context: context forwarded to the templating engine
|
||||
:param post_process: what ever to use `post_process` from the templating
|
||||
engine. If `True` urls are transform to absolute urls
|
||||
"""
|
||||
self.ensure_one()
|
||||
sale_order.ensure_one()
|
||||
lang = sale_order.partner_id.lang if sale_order.partner_id else None
|
||||
comment_texts = self.env["mail.render.mixin"]._render_template(
|
||||
template_src=self.with_context(lang=lang).text,
|
||||
model="sale.order",
|
||||
res_ids=[sale_order.id],
|
||||
engine="inline_template",
|
||||
add_context=add_context,
|
||||
)
|
||||
return comment_texts[sale_order.id] or ""
|
||||
3
sale_order_note_template/pyproject.toml
Executable file
3
sale_order_note_template/pyproject.toml
Executable file
@@ -0,0 +1,3 @@
|
||||
[build-system]
|
||||
requires = ["whool"]
|
||||
build-backend = "whool.buildapi"
|
||||
1
sale_order_note_template/readme/CONTRIBUTOR.rst
Executable file
1
sale_order_note_template/readme/CONTRIBUTOR.rst
Executable file
@@ -0,0 +1 @@
|
||||
* Pierre Verkest <pierrevkest84@gmail.com>
|
||||
19
sale_order_note_template/readme/DESCRIPTION.md
Executable file
19
sale_order_note_template/readme/DESCRIPTION.md
Executable file
@@ -0,0 +1,19 @@
|
||||
This module add sale terms and conditions templates and change existing
|
||||
terms and conditions (sale_order.note) field type from Text to Html.
|
||||
|
||||
Users will be able to select *terms and conditions template* to fulfill
|
||||
*terms and conditions* likes in mail composer users can configure their
|
||||
template using jinja2.
|
||||
|
||||
## How this module differ from [sale_comment_template](https://github.com/OCA/sale-reporting/tree/14.0/sale_comment_template)?
|
||||
|
||||
- [base_comment_template](https://github.com/OCA/reporting-engine/tree/14.0/base_comment_template)
|
||||
is for managing comments not terms, it would probably see as mess for
|
||||
users to mixed terms and comments.
|
||||
- [sale_comment_template](https://github.com/OCA/sale-reporting/tree/14.0/sale_comment_template)
|
||||
depends on
|
||||
[account_comment_template](https://github.com/OCA/account-invoice-reporting/tree/14.0/account_comment_template)
|
||||
comments are forwards to generated invoices, here we don't really
|
||||
display sales terms on final invoices
|
||||
- [base_comment_template](https://github.com/OCA/reporting-engine/tree/14.0/base_comment_template)
|
||||
at the time writing do not support template engine
|
||||
3
sale_order_note_template/readme/ROADMAP.md
Executable file
3
sale_order_note_template/readme/ROADMAP.md
Executable file
@@ -0,0 +1,3 @@
|
||||
- add a post_init_hook and / or a uninstall_hook to handle correctly the
|
||||
conversion (Text \<--\> Html).
|
||||
- support qweb report templating engine
|
||||
3
sale_order_note_template/security/ir.model.access.csv
Executable file
3
sale_order_note_template/security/ir.model.access.csv
Executable file
@@ -0,0 +1,3 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_sale_terms_template_sale_manager,Access sale_terms_template sale manager,model_sale_terms_template,sales_team.group_sale_manager,1,1,1,1
|
||||
access_sale_terms_template_users,Access sale_terms_template users,model_sale_terms_template,base.group_user,1,0,0,0
|
||||
|
BIN
sale_order_note_template/static/description/icon.png
Executable file
BIN
sale_order_note_template/static/description/icon.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
437
sale_order_note_template/static/description/index.html
Executable file
437
sale_order_note_template/static/description/index.html
Executable file
@@ -0,0 +1,437 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
|
||||
<title>Sale Orders Terms and conditions Templates</title>
|
||||
<style type="text/css">
|
||||
|
||||
/*
|
||||
:Author: David Goodger (goodger@python.org)
|
||||
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
|
||||
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
*/
|
||||
|
||||
/* used to remove borders from tables and images */
|
||||
.borderless, table.borderless td, table.borderless th {
|
||||
border: 0 }
|
||||
|
||||
table.borderless td, table.borderless th {
|
||||
/* Override padding for "table.docutils td" with "! important".
|
||||
The right padding separates the table cells. */
|
||||
padding: 0 0.5em 0 0 ! important }
|
||||
|
||||
.first {
|
||||
/* Override more specific margin styles with "! important". */
|
||||
margin-top: 0 ! important }
|
||||
|
||||
.last, .with-subtitle {
|
||||
margin-bottom: 0 ! important }
|
||||
|
||||
.hidden {
|
||||
display: none }
|
||||
|
||||
.subscript {
|
||||
vertical-align: sub;
|
||||
font-size: smaller }
|
||||
|
||||
.superscript {
|
||||
vertical-align: super;
|
||||
font-size: smaller }
|
||||
|
||||
a.toc-backref {
|
||||
text-decoration: none ;
|
||||
color: black }
|
||||
|
||||
blockquote.epigraph {
|
||||
margin: 2em 5em ; }
|
||||
|
||||
dl.docutils dd {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Uncomment (and remove this text!) to get bold-faced definition list terms
|
||||
dl.docutils dt {
|
||||
font-weight: bold }
|
||||
*/
|
||||
|
||||
div.abstract {
|
||||
margin: 2em 5em }
|
||||
|
||||
div.abstract p.topic-title {
|
||||
font-weight: bold ;
|
||||
text-align: center }
|
||||
|
||||
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||
div.hint, div.important, div.note, div.tip, div.warning {
|
||||
margin: 2em ;
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||
div.important p.admonition-title, div.note p.admonition-title,
|
||||
div.tip p.admonition-title {
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||
div.danger p.admonition-title, div.error p.admonition-title,
|
||||
div.warning p.admonition-title, .code .error {
|
||||
color: red ;
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||
compound paragraphs.
|
||||
div.compound .compound-first, div.compound .compound-middle {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.compound .compound-last, div.compound .compound-middle {
|
||||
margin-top: 0.5em }
|
||||
*/
|
||||
|
||||
div.dedication {
|
||||
margin: 2em 5em ;
|
||||
text-align: center ;
|
||||
font-style: italic }
|
||||
|
||||
div.dedication p.topic-title {
|
||||
font-weight: bold ;
|
||||
font-style: normal }
|
||||
|
||||
div.figure {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
div.footer, div.header {
|
||||
clear: both;
|
||||
font-size: smaller }
|
||||
|
||||
div.line-block {
|
||||
display: block ;
|
||||
margin-top: 1em ;
|
||||
margin-bottom: 1em }
|
||||
|
||||
div.line-block div.line-block {
|
||||
margin-top: 0 ;
|
||||
margin-bottom: 0 ;
|
||||
margin-left: 1.5em }
|
||||
|
||||
div.sidebar {
|
||||
margin: 0 0 0.5em 1em ;
|
||||
border: medium outset ;
|
||||
padding: 1em ;
|
||||
background-color: #ffffee ;
|
||||
width: 40% ;
|
||||
float: right ;
|
||||
clear: right }
|
||||
|
||||
div.sidebar p.rubric {
|
||||
font-family: sans-serif ;
|
||||
font-size: medium }
|
||||
|
||||
div.system-messages {
|
||||
margin: 5em }
|
||||
|
||||
div.system-messages h1 {
|
||||
color: red }
|
||||
|
||||
div.system-message {
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.system-message p.system-message-title {
|
||||
color: red ;
|
||||
font-weight: bold }
|
||||
|
||||
div.topic {
|
||||
margin: 2em }
|
||||
|
||||
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||
margin-top: 0.4em }
|
||||
|
||||
h1.title {
|
||||
text-align: center }
|
||||
|
||||
h2.subtitle {
|
||||
text-align: center }
|
||||
|
||||
hr.docutils {
|
||||
width: 75% }
|
||||
|
||||
img.align-left, .figure.align-left, object.align-left, table.align-left {
|
||||
clear: left ;
|
||||
float: left ;
|
||||
margin-right: 1em }
|
||||
|
||||
img.align-right, .figure.align-right, object.align-right, table.align-right {
|
||||
clear: right ;
|
||||
float: right ;
|
||||
margin-left: 1em }
|
||||
|
||||
img.align-center, .figure.align-center, object.align-center {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
table.align-center {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.align-left {
|
||||
text-align: left }
|
||||
|
||||
.align-center {
|
||||
clear: both ;
|
||||
text-align: center }
|
||||
|
||||
.align-right {
|
||||
text-align: right }
|
||||
|
||||
/* reset inner alignment in figures */
|
||||
div.align-right {
|
||||
text-align: inherit }
|
||||
|
||||
/* div.align-center * { */
|
||||
/* text-align: left } */
|
||||
|
||||
.align-top {
|
||||
vertical-align: top }
|
||||
|
||||
.align-middle {
|
||||
vertical-align: middle }
|
||||
|
||||
.align-bottom {
|
||||
vertical-align: bottom }
|
||||
|
||||
ol.simple, ul.simple {
|
||||
margin-bottom: 1em }
|
||||
|
||||
ol.arabic {
|
||||
list-style: decimal }
|
||||
|
||||
ol.loweralpha {
|
||||
list-style: lower-alpha }
|
||||
|
||||
ol.upperalpha {
|
||||
list-style: upper-alpha }
|
||||
|
||||
ol.lowerroman {
|
||||
list-style: lower-roman }
|
||||
|
||||
ol.upperroman {
|
||||
list-style: upper-roman }
|
||||
|
||||
p.attribution {
|
||||
text-align: right ;
|
||||
margin-left: 50% }
|
||||
|
||||
p.caption {
|
||||
font-style: italic }
|
||||
|
||||
p.credits {
|
||||
font-style: italic ;
|
||||
font-size: smaller }
|
||||
|
||||
p.label {
|
||||
white-space: nowrap }
|
||||
|
||||
p.rubric {
|
||||
font-weight: bold ;
|
||||
font-size: larger ;
|
||||
color: maroon ;
|
||||
text-align: center }
|
||||
|
||||
p.sidebar-title {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold ;
|
||||
font-size: larger }
|
||||
|
||||
p.sidebar-subtitle {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
p.topic-title {
|
||||
font-weight: bold }
|
||||
|
||||
pre.address {
|
||||
margin-bottom: 0 ;
|
||||
margin-top: 0 ;
|
||||
font: inherit }
|
||||
|
||||
pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
pre.code .ln { color: grey; } /* line numbers */
|
||||
pre.code, code { background-color: #eeeeee }
|
||||
pre.code .comment, code .comment { color: #5C6576 }
|
||||
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
||||
pre.code .literal.string, code .literal.string { color: #0C5404 }
|
||||
pre.code .name.builtin, code .name.builtin { color: #352B84 }
|
||||
pre.code .deleted, code .deleted { background-color: #DEB0A1}
|
||||
pre.code .inserted, code .inserted { background-color: #A3D289}
|
||||
|
||||
span.classifier {
|
||||
font-family: sans-serif ;
|
||||
font-style: oblique }
|
||||
|
||||
span.classifier-delimiter {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
span.interpreted {
|
||||
font-family: sans-serif }
|
||||
|
||||
span.option {
|
||||
white-space: nowrap }
|
||||
|
||||
span.pre {
|
||||
white-space: pre }
|
||||
|
||||
span.problematic {
|
||||
color: red }
|
||||
|
||||
span.section-subtitle {
|
||||
/* font-size relative to parent (h1..h6 element) */
|
||||
font-size: 80% }
|
||||
|
||||
table.citation {
|
||||
border-left: solid 1px gray;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docinfo {
|
||||
margin: 2em 4em }
|
||||
|
||||
table.docutils {
|
||||
margin-top: 0.5em ;
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
table.footnote {
|
||||
border-left: solid 1px black;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docutils td, table.docutils th,
|
||||
table.docinfo td, table.docinfo th {
|
||||
padding-left: 0.5em ;
|
||||
padding-right: 0.5em ;
|
||||
vertical-align: top }
|
||||
|
||||
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||
font-weight: bold ;
|
||||
text-align: left ;
|
||||
white-space: nowrap ;
|
||||
padding-left: 0 }
|
||||
|
||||
/* "booktabs" style (no vertical lines) */
|
||||
table.docutils.booktabs {
|
||||
border: 0px;
|
||||
border-top: 2px solid;
|
||||
border-bottom: 2px solid;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.docutils.booktabs * {
|
||||
border: 0px;
|
||||
}
|
||||
table.docutils.booktabs th {
|
||||
border-bottom: thin solid;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
|
||||
font-size: 100% }
|
||||
|
||||
ul.auto-toc {
|
||||
list-style-type: none }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="document" id="sale-orders-terms-and-conditions-templates">
|
||||
<h1 class="title">Sale Orders Terms and conditions Templates</h1>
|
||||
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:d1e58e979b84ddf98ac6d3f3a1f8d477a3222c1c5065725c8cba073424108f83
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/sale-workflow/tree/18.0/sale_order_note_template"><img alt="OCA/sale-workflow" src="https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_order_note_template"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module add sale terms and conditions templates and change existing
|
||||
terms and conditions (sale_order.note) field type from Text to Html.</p>
|
||||
<p>Users will be able to select <em>terms and conditions template</em> to fulfill
|
||||
<em>terms and conditions</em> likes in mail composer users can configure their
|
||||
template using jinja2.</p>
|
||||
<div class="section" id="how-this-module-differ-from-sale-comment-template">
|
||||
<h1>How this module differ from <a class="reference external" href="https://github.com/OCA/sale-reporting/tree/14.0/sale_comment_template">sale_comment_template</a>?</h1>
|
||||
<ul class="simple">
|
||||
<li><a class="reference external" href="https://github.com/OCA/reporting-engine/tree/14.0/base_comment_template">base_comment_template</a>
|
||||
is for managing comments not terms, it would probably see as mess for
|
||||
users to mixed terms and comments.</li>
|
||||
<li><a class="reference external" href="https://github.com/OCA/sale-reporting/tree/14.0/sale_comment_template">sale_comment_template</a>
|
||||
depends on
|
||||
<a class="reference external" href="https://github.com/OCA/account-invoice-reporting/tree/14.0/account_comment_template">account_comment_template</a>
|
||||
comments are forwards to generated invoices, here we don’t really
|
||||
display sales terms on final invoices</li>
|
||||
<li><a class="reference external" href="https://github.com/OCA/reporting-engine/tree/14.0/base_comment_template">base_comment_template</a>
|
||||
at the time writing do not support template engine</li>
|
||||
</ul>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
<div class="contents local topic" id="contents">
|
||||
<ul class="simple">
|
||||
<li><a class="reference internal" href="#known-issues-roadmap" id="toc-entry-1">Known issues / Roadmap</a></li>
|
||||
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="known-issues-roadmap">
|
||||
<h2><a class="toc-backref" href="#toc-entry-1">Known issues / Roadmap</a></h2>
|
||||
<ul class="simple">
|
||||
<li>add a post_init_hook and / or a uninstall_hook to handle correctly the
|
||||
conversion (Text <–> Html).</li>
|
||||
<li>support qweb report templating engine</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
<h2><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h2>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/sale-workflow/issues">GitHub Issues</a>.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
||||
<a class="reference external" href="https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_order_note_template%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
<h2><a class="toc-backref" href="#toc-entry-3">Credits</a></h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="authors">
|
||||
<h1>Authors</h1>
|
||||
<ul class="simple">
|
||||
<li>Pierre Verkest</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
<h1>Maintainers</h1>
|
||||
<p>This module is maintained by the OCA.</p>
|
||||
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
||||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||
mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/sale-workflow/tree/18.0/sale_order_note_template">OCA/sale-workflow</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
1
sale_order_note_template/tests/__init__.py
Executable file
1
sale_order_note_template/tests/__init__.py
Executable file
@@ -0,0 +1 @@
|
||||
from . import test_sale_terms_template, test_sale_order
|
||||
22
sale_order_note_template/tests/test_sale_order.py
Executable file
22
sale_order_note_template/tests/test_sale_order.py
Executable file
@@ -0,0 +1,22 @@
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestSaleOrder(TransactionCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.term_template = self.env["sale.terms_template"].create(
|
||||
{
|
||||
"name": "My terms and conditions template",
|
||||
"text": "<p>Terms template ${object.partner_id.name}</p>",
|
||||
}
|
||||
)
|
||||
self.sale_order = self.env.ref("sale.sale_order_2")
|
||||
|
||||
def test_on_change_term_template(self):
|
||||
self.assertEqual(self.sale_order.note, False)
|
||||
self.sale_order.terms_template_id = self.term_template
|
||||
self.sale_order._onchange_terms_template_id()
|
||||
self.assertEqual(
|
||||
self.sale_order.note, "<p>Terms template ${object.partner_id.name}</p>"
|
||||
)
|
||||
31
sale_order_note_template/tests/test_sale_terms_template.py
Executable file
31
sale_order_note_template/tests/test_sale_terms_template.py
Executable file
@@ -0,0 +1,31 @@
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestSaleTermsTemplate(TransactionCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.term_template = self.env["sale.terms_template"].create(
|
||||
{
|
||||
"name": "My terms and conditions template",
|
||||
"text": "<p>Terms template ${object.partner_id.name}</p>",
|
||||
}
|
||||
)
|
||||
self.sale_order = self.env.ref("sale.sale_order_2")
|
||||
|
||||
def test_get_value(self):
|
||||
self.assertEqual(
|
||||
self.term_template.get_value(self.sale_order),
|
||||
"<p>Terms template ${object.partner_id.name}</p>",
|
||||
)
|
||||
|
||||
def test_get_value_with_translation(self):
|
||||
self.env["res.lang"]._activate_lang("fr_BE")
|
||||
self.sale_order.partner_id.lang = "fr_BE"
|
||||
self.term_template.with_context(lang="fr_BE").write(
|
||||
{"text": "<p>Testing translated fr_BE `${object.partner_id.name}`</p>"}
|
||||
)
|
||||
self.assertEqual(
|
||||
self.term_template.get_value(self.sale_order),
|
||||
"<p>Testing translated fr_BE `${object.partner_id.name}`</p>",
|
||||
)
|
||||
65
sale_order_note_template/views/sale_terms_template.xml
Executable file
65
sale_order_note_template/views/sale_terms_template.xml
Executable file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record model="ir.ui.view" id="view_sale_terms_template_search">
|
||||
<field name="name">sale.terms_template.search</field>
|
||||
<field name="model">sale.terms_template</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Terms and conditions Templates">
|
||||
<field name="name" string="Name" />
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_sale_terms_template_form">
|
||||
<field name="name">sale.terms_template.form</field>
|
||||
<field name="model">sale.terms_template</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Terms and conditions Templates">
|
||||
<sheet>
|
||||
<widget
|
||||
name="web_ribbon"
|
||||
text="Archived"
|
||||
bg_color="bg-danger"
|
||||
invisible="active"
|
||||
/>
|
||||
<div class="oe_title">
|
||||
<h1>
|
||||
<field name="name" placeholder="Name" />
|
||||
</h1>
|
||||
</div>
|
||||
<notebook>
|
||||
<page name="Terms and Conditions">
|
||||
<field name="text" nolabel="1" />
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_sale_terms_template_tree">
|
||||
<field name="name">sale.terms_template.list</field>
|
||||
<field name="model">sale.terms_template</field>
|
||||
<field name="priority" eval="6" />
|
||||
<field name="arch" type="xml">
|
||||
<list>
|
||||
<field name="name" string="Name" />
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_sale_terms_template">
|
||||
<field name="name">Terms and conditions template</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sale.terms_template</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
<field name="view_id" ref="view_sale_terms_template_tree" />
|
||||
</record>
|
||||
<menuitem
|
||||
id="menu_sale_terms_template"
|
||||
name="Terms and conditions Templates"
|
||||
parent="sale.menu_sales_config"
|
||||
action="action_sale_terms_template"
|
||||
sequence="10"
|
||||
/>
|
||||
</odoo>
|
||||
30
sale_order_note_template/views/sale_views.xml
Executable file
30
sale_order_note_template/views/sale_views.xml
Executable file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record model="ir.ui.view" id="view_order_form_terms_template">
|
||||
<field name="name">sale_order_note_templatesale.order.form</field>
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale.view_order_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath
|
||||
expr="//group[@name='note_group']/group/field[@name='note']"
|
||||
position="before"
|
||||
>
|
||||
<field
|
||||
name="terms_template_id"
|
||||
placeholder="Terms and conditions template"
|
||||
nolabel="1"
|
||||
colspan="4"
|
||||
/>
|
||||
<group name="terms_group" string="Terms and Conditions">
|
||||
<field
|
||||
name="terms_template_id"
|
||||
placeholder="Terms and conditions template"
|
||||
nolabel="1"
|
||||
colspan="4"
|
||||
readonly="state != 'draft'"
|
||||
/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user