Initial commit: Odoo 18.0-20251222 extra-addons
This commit is contained in:
96
product_set_sell_only_by_packaging/README.rst
Executable file
96
product_set_sell_only_by_packaging/README.rst
Executable file
@@ -0,0 +1,96 @@
|
||||
========================================
|
||||
Sales Product Set Sell only by packaging
|
||||
========================================
|
||||
|
||||
..
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:c2b890e9ed626c08aea6f8248665efe9d948f152b6802e73f2122a3f7dd6b1f1
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
|
||||
:target: https://odoo-community.org/page/development-status
|
||||
:alt: Alpha
|
||||
.. |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/product_set_sell_only_by_packaging
|
||||
: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-product_set_sell_only_by_packaging
|
||||
: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|
|
||||
|
||||
Glue module between sell_only_by_packaging and
|
||||
sale_product_set_packaging_qty. If sell_only_by_packaging is ON and
|
||||
there are product set lines without packaging selected, a warning is
|
||||
displayed in the product form and quick link to all involved lines
|
||||
allows to review them.
|
||||
|
||||
.. IMPORTANT::
|
||||
This is an alpha version, the data model and design can change at any time without warning.
|
||||
Only for development or testing purpose, do not use in production.
|
||||
`More details on development status <https://odoo-community.org/page/development-status>`_
|
||||
|
||||
**Table of contents**
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
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:%20product_set_sell_only_by_packaging%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
|
||||
-------
|
||||
|
||||
* Camptocamp
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
- Simone Orsi <simone.orsi@camptocamp.com>
|
||||
|
||||
- `Trobz <https://trobz.com>`__:
|
||||
|
||||
- Son Ho<sonhd@trobz.com>
|
||||
- Tris Doan<tridm@trobz.com>
|
||||
|
||||
Other credits
|
||||
-------------
|
||||
|
||||
The migration of this module from 13.0 to 14.0, and 14.0 to 18.0 was
|
||||
financially supported by Camptocamp
|
||||
|
||||
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/product_set_sell_only_by_packaging>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
1
product_set_sell_only_by_packaging/__init__.py
Executable file
1
product_set_sell_only_by_packaging/__init__.py
Executable file
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
23
product_set_sell_only_by_packaging/__manifest__.py
Executable file
23
product_set_sell_only_by_packaging/__manifest__.py
Executable file
@@ -0,0 +1,23 @@
|
||||
# Copyright 2021 Camptocamp SA
|
||||
# @author Simone Orsi <simone.orsi@camptocamp.com>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
||||
{
|
||||
"name": "Sales Product Set Sell only by packaging",
|
||||
"summary": """
|
||||
Glue module between `sell_only_by_packaging` and `sale_product_set_packaging_qty`.
|
||||
""",
|
||||
"version": "18.0.1.0.0",
|
||||
"development_status": "Alpha",
|
||||
"category": "Sales",
|
||||
"website": "https://github.com/OCA/sale-workflow",
|
||||
"author": "Camptocamp, Odoo Community Association (OCA)",
|
||||
"license": "AGPL-3",
|
||||
"installable": True,
|
||||
"auto_install": True,
|
||||
"depends": ["sell_only_by_packaging", "sale_product_set_packaging_qty"],
|
||||
"data": [
|
||||
"data/ir_cron.xml",
|
||||
"views/product_set_line.xml",
|
||||
"views/product_template.xml",
|
||||
],
|
||||
}
|
||||
12
product_set_sell_only_by_packaging/data/ir_cron.xml
Executable file
12
product_set_sell_only_by_packaging/data/ir_cron.xml
Executable file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo noupdate="1">
|
||||
<record model="ir.cron" id="cron_check_packaging">
|
||||
<field name='name'>Check sale by packaging on wishlist lines</field>
|
||||
<field name='interval_number'>30</field>
|
||||
<field name='interval_type'>minutes</field>
|
||||
<field name="active" eval="True" />
|
||||
<field name="model_id" ref="sale_product_set.model_product_set_line" />
|
||||
<field name="state">code</field>
|
||||
<field name="code">model.cron_check_packaging()</field>
|
||||
</record>
|
||||
</odoo>
|
||||
121
product_set_sell_only_by_packaging/i18n/es.po
Executable file
121
product_set_sell_only_by_packaging/i18n/es.po
Executable file
@@ -0,0 +1,121 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * product_set_sell_only_by_packaging
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 14.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-04-10 08:00+0000\n"
|
||||
"PO-Revision-Date: 2024-01-16 18:36+0000\n"
|
||||
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
|
||||
"Language-Team: none\n"
|
||||
"Language: es\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 4.17\n"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.actions.server,name:product_set_sell_only_by_packaging.cron_check_packaging_ir_actions_server
|
||||
msgid "Check sale by packaging on wishlist lines"
|
||||
msgstr "Compruebe la venta por envases en las líneas de lista de deseos"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.model.fields,help:product_set_sell_only_by_packaging.field_product_product__sell_only_by_packaging_prod_set_tocheck
|
||||
#: model:ir.model.fields,help:product_set_sell_only_by_packaging.field_product_template__sell_only_by_packaging_prod_set_tocheck
|
||||
msgid ""
|
||||
"If this flag is ON, it means you have to check all product.set associated "
|
||||
"with it"
|
||||
msgstr ""
|
||||
"Si esta bandera está en ON, significa que tiene que comprobar todos los "
|
||||
"product.set asociados a él"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.model.fields,field_description:product_set_sell_only_by_packaging.field_product_set_line__sell_only_by_packaging
|
||||
msgid "Only sell by packaging"
|
||||
msgstr "Solo vendemos por embalaje"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.model,name:product_set_sell_only_by_packaging.model_product_template
|
||||
#: model_terms:ir.ui.view,arch_db:product_set_sell_only_by_packaging.view_product_set_line_search
|
||||
msgid "Product"
|
||||
msgstr "Producto"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.model,name:product_set_sell_only_by_packaging.model_product_product
|
||||
#, fuzzy
|
||||
msgid "Product Variant"
|
||||
msgstr "Conjunto de productos"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model_terms:ir.ui.view,arch_db:product_set_sell_only_by_packaging.view_product_set_line_search
|
||||
msgid "Product set"
|
||||
msgstr "Conjunto de productos"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.actions.act_window,name:product_set_sell_only_by_packaging.act_open_product_set_line_view
|
||||
#: model:ir.model,name:product_set_sell_only_by_packaging.model_product_set_line
|
||||
#: model_terms:ir.ui.view,arch_db:product_set_sell_only_by_packaging.view_product_set_line_search
|
||||
msgid "Product set line"
|
||||
msgstr "Línea de conjunto de producto"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.model.fields,help:product_set_sell_only_by_packaging.field_product_set_line__sell_only_by_packaging
|
||||
msgid ""
|
||||
"Restrict the usage of this product on sale order lines without packaging "
|
||||
"defined"
|
||||
msgstr ""
|
||||
"Restrinja el uso de este producto en las líneas de orden de venta sin "
|
||||
"embalaje definido"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.model.fields,field_description:product_set_sell_only_by_packaging.field_product_product__sell_only_by_packaging_prod_set_tocheck
|
||||
#: model:ir.model.fields,field_description:product_set_sell_only_by_packaging.field_product_template__sell_only_by_packaging_prod_set_tocheck
|
||||
msgid "Sell Only By Packaging Prod Set Tocheck"
|
||||
msgstr "Vender Solo Por Producto de Embalaje Establecido Para Comprobar"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#. odoo-python
|
||||
#: code:addons/product_set_sell_only_by_packaging/models/product_set_line.py:0
|
||||
msgid ""
|
||||
"The following product(s) can be sold only by packaging: \n"
|
||||
" %s"
|
||||
msgstr ""
|
||||
"El/los siguiente(s) producto(s) sólo puede(n) venderse envasados: \n"
|
||||
" %s"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model_terms:ir.ui.view,arch_db:product_set_sell_only_by_packaging.product_template_form_view
|
||||
msgid ""
|
||||
"There are product set lines associated to this product\n"
|
||||
" which do not have a packaging associated.\n"
|
||||
" It would be better to check them all.\n"
|
||||
" If you don't take any action,\n"
|
||||
" a cron will assign such lines to the first available "
|
||||
"packaging."
|
||||
msgstr ""
|
||||
"Hay líneas de conjuntos de productos asociadas a este producto\n"
|
||||
" que no tienen un envase asociado.\n"
|
||||
" Sería mejor comprobarlas todas.\n"
|
||||
" Si no realiza ninguna acción\n"
|
||||
" un cron asignará dichas líneas al primer embalaje "
|
||||
"disponible."
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model_terms:ir.ui.view,arch_db:product_set_sell_only_by_packaging.product_template_form_view
|
||||
msgid "View all lines"
|
||||
msgstr "Ver todas las líneas"
|
||||
|
||||
#~ msgid "Display Name"
|
||||
#~ msgstr "Mostrar Nombre"
|
||||
|
||||
#~ msgid "ID"
|
||||
#~ msgstr "ID"
|
||||
|
||||
#~ msgid "Last Modified on"
|
||||
#~ msgstr "Última Modificación el"
|
||||
|
||||
#~ msgid "Product Template"
|
||||
#~ msgstr "Plantilla de Producto"
|
||||
106
product_set_sell_only_by_packaging/i18n/it.po
Executable file
106
product_set_sell_only_by_packaging/i18n/it.po
Executable file
@@ -0,0 +1,106 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * product_set_sell_only_by_packaging
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 18.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"PO-Revision-Date: 2025-04-14 11:24+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.4\n"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.actions.server,name:product_set_sell_only_by_packaging.cron_check_packaging_ir_actions_server
|
||||
msgid "Check sale by packaging on wishlist lines"
|
||||
msgstr "Controlla vendita per imballaggio nelle righe desiderate"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.model.fields,help:product_set_sell_only_by_packaging.field_product_product__sell_only_by_packaging_prod_set_tocheck
|
||||
#: model:ir.model.fields,help:product_set_sell_only_by_packaging.field_product_template__sell_only_by_packaging_prod_set_tocheck
|
||||
msgid ""
|
||||
"If this flag is ON, it means you have to check all product.set associated "
|
||||
"with it"
|
||||
msgstr ""
|
||||
"Se questa opzione è ON, significa che bisogna controllare tutti i "
|
||||
"product.set associati"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.model.fields,field_description:product_set_sell_only_by_packaging.field_product_set_line__sell_only_by_packaging
|
||||
msgid "Only sell by packaging"
|
||||
msgstr "Vendi solo per imballaggio"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.model,name:product_set_sell_only_by_packaging.model_product_template
|
||||
#: model_terms:ir.ui.view,arch_db:product_set_sell_only_by_packaging.view_product_set_line_search
|
||||
msgid "Product"
|
||||
msgstr "Prodotto"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.model,name:product_set_sell_only_by_packaging.model_product_product
|
||||
msgid "Product Variant"
|
||||
msgstr "Variante prodotto"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model_terms:ir.ui.view,arch_db:product_set_sell_only_by_packaging.view_product_set_line_search
|
||||
msgid "Product set"
|
||||
msgstr "Set prodotto"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.actions.act_window,name:product_set_sell_only_by_packaging.act_open_product_set_line_view
|
||||
#: model:ir.model,name:product_set_sell_only_by_packaging.model_product_set_line
|
||||
#: model_terms:ir.ui.view,arch_db:product_set_sell_only_by_packaging.view_product_set_line_search
|
||||
msgid "Product set line"
|
||||
msgstr "Riga set prodotto"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.model.fields,help:product_set_sell_only_by_packaging.field_product_set_line__sell_only_by_packaging
|
||||
msgid ""
|
||||
"Restrict the usage of this product on sale order lines without packaging "
|
||||
"defined"
|
||||
msgstr ""
|
||||
"Non permettere l'uso di questo prodotto nelle righe ordine di vendita senza "
|
||||
"imballaggio definito"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.model.fields,field_description:product_set_sell_only_by_packaging.field_product_product__sell_only_by_packaging_prod_set_tocheck
|
||||
#: model:ir.model.fields,field_description:product_set_sell_only_by_packaging.field_product_template__sell_only_by_packaging_prod_set_tocheck
|
||||
msgid "Sell Only By Packaging Prod Set Tocheck"
|
||||
msgstr "Vendere solo con imballaggio prodotto impostato a controllo"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#. odoo-python
|
||||
#: code:addons/product_set_sell_only_by_packaging/models/product_set_line.py:0
|
||||
msgid ""
|
||||
"The following product(s) can be sold only by packaging: \n"
|
||||
" %s"
|
||||
msgstr ""
|
||||
"I seguenti prodotti possono essere venduti solo in confezione:\n"
|
||||
" %s"
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model_terms:ir.ui.view,arch_db:product_set_sell_only_by_packaging.product_template_form_view
|
||||
msgid ""
|
||||
"There are product set lines associated to this product\n"
|
||||
" which do not have a packaging associated.\n"
|
||||
" It would be better to check them all.\n"
|
||||
" If you don't take any action,\n"
|
||||
" a cron will assign such lines to the first available packaging."
|
||||
msgstr ""
|
||||
"Ci sono righe di set di prodotti associate a questo prodotto\n"
|
||||
" che non hanno un imballaggio associato.\n"
|
||||
" Sarebbe meglio controllarle tutte.\n"
|
||||
" Se non si intraprende alcuna azione,\n"
|
||||
" un cron assegnerà tali linee al primo imballaggio "
|
||||
"disponibile."
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model_terms:ir.ui.view,arch_db:product_set_sell_only_by_packaging.product_template_form_view
|
||||
msgid "View all lines"
|
||||
msgstr "Vedi tutte le righe"
|
||||
@@ -0,0 +1,91 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * product_set_sell_only_by_packaging
|
||||
#
|
||||
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: product_set_sell_only_by_packaging
|
||||
#: model:ir.actions.server,name:product_set_sell_only_by_packaging.cron_check_packaging_ir_actions_server
|
||||
msgid "Check sale by packaging on wishlist lines"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.model.fields,help:product_set_sell_only_by_packaging.field_product_product__sell_only_by_packaging_prod_set_tocheck
|
||||
#: model:ir.model.fields,help:product_set_sell_only_by_packaging.field_product_template__sell_only_by_packaging_prod_set_tocheck
|
||||
msgid ""
|
||||
"If this flag is ON, it means you have to check all product.set associated "
|
||||
"with it"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.model.fields,field_description:product_set_sell_only_by_packaging.field_product_set_line__sell_only_by_packaging
|
||||
msgid "Only sell by packaging"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.model,name:product_set_sell_only_by_packaging.model_product_template
|
||||
#: model_terms:ir.ui.view,arch_db:product_set_sell_only_by_packaging.view_product_set_line_search
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.model,name:product_set_sell_only_by_packaging.model_product_product
|
||||
msgid "Product Variant"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model_terms:ir.ui.view,arch_db:product_set_sell_only_by_packaging.view_product_set_line_search
|
||||
msgid "Product set"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.actions.act_window,name:product_set_sell_only_by_packaging.act_open_product_set_line_view
|
||||
#: model:ir.model,name:product_set_sell_only_by_packaging.model_product_set_line
|
||||
#: model_terms:ir.ui.view,arch_db:product_set_sell_only_by_packaging.view_product_set_line_search
|
||||
msgid "Product set line"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.model.fields,help:product_set_sell_only_by_packaging.field_product_set_line__sell_only_by_packaging
|
||||
msgid ""
|
||||
"Restrict the usage of this product on sale order lines without packaging "
|
||||
"defined"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model:ir.model.fields,field_description:product_set_sell_only_by_packaging.field_product_product__sell_only_by_packaging_prod_set_tocheck
|
||||
#: model:ir.model.fields,field_description:product_set_sell_only_by_packaging.field_product_template__sell_only_by_packaging_prod_set_tocheck
|
||||
msgid "Sell Only By Packaging Prod Set Tocheck"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#. odoo-python
|
||||
#: code:addons/product_set_sell_only_by_packaging/models/product_set_line.py:0
|
||||
msgid ""
|
||||
"The following product(s) can be sold only by packaging: \n"
|
||||
" %s"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model_terms:ir.ui.view,arch_db:product_set_sell_only_by_packaging.product_template_form_view
|
||||
msgid ""
|
||||
"There are product set lines associated to this product\n"
|
||||
" which do not have a packaging associated.\n"
|
||||
" It would be better to check them all.\n"
|
||||
" If you don't take any action,\n"
|
||||
" a cron will assign such lines to the first available packaging."
|
||||
msgstr ""
|
||||
|
||||
#. module: product_set_sell_only_by_packaging
|
||||
#: model_terms:ir.ui.view,arch_db:product_set_sell_only_by_packaging.product_template_form_view
|
||||
msgid "View all lines"
|
||||
msgstr ""
|
||||
3
product_set_sell_only_by_packaging/models/__init__.py
Executable file
3
product_set_sell_only_by_packaging/models/__init__.py
Executable file
@@ -0,0 +1,3 @@
|
||||
from . import product_set_line
|
||||
from . import product_template
|
||||
from . import product_product
|
||||
13
product_set_sell_only_by_packaging/models/product_product.py
Executable file
13
product_set_sell_only_by_packaging/models/product_product.py
Executable file
@@ -0,0 +1,13 @@
|
||||
# Copyright 2021 Camptocamp SA
|
||||
# @author Simone Orsi <simone.orsi@camptocamp.com>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
||||
from odoo import models
|
||||
|
||||
|
||||
class ProductProduct(models.Model):
|
||||
_inherit = "product.product"
|
||||
|
||||
def action_view_product_set_lines_to_check(self):
|
||||
action = self.product_tmpl_id.action_view_product_set_lines_to_check()
|
||||
action["context"] = {"default_product_id": self.id}
|
||||
return action
|
||||
82
product_set_sell_only_by_packaging/models/product_set_line.py
Executable file
82
product_set_sell_only_by_packaging/models/product_set_line.py
Executable file
@@ -0,0 +1,82 @@
|
||||
# Copyright 2021 Camptocamp SA
|
||||
# @author Simone Orsi <simone.orsi@camptocamp.com>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
||||
import logging
|
||||
from collections import defaultdict
|
||||
|
||||
from odoo import api, exceptions, fields, models
|
||||
from odoo.osv import expression
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ProductSetLine(models.Model):
|
||||
_inherit = "product.set.line"
|
||||
|
||||
sell_only_by_packaging = fields.Boolean(related="product_id.sell_only_by_packaging")
|
||||
|
||||
@api.constrains("product_id", "product_packaging_id")
|
||||
def _check_sell_only_by_packaging(self):
|
||||
errored = self.filtered(
|
||||
lambda x: x.product_id.sell_only_by_packaging and not x.product_packaging_id
|
||||
)
|
||||
if errored:
|
||||
raise exceptions.UserError(
|
||||
self._check_sell_only_by_packaging_err_msg(errored)
|
||||
)
|
||||
|
||||
def _check_sell_only_by_packaging_err_msg(self, lines):
|
||||
return self.env._(
|
||||
"The following product(s) can be sold only by packaging: \n %s",
|
||||
", ".join(lines.mapped("product_id.display_name")),
|
||||
)
|
||||
|
||||
@api.model
|
||||
def cron_check_packaging(self):
|
||||
"""Ensure lines are tied to the right packaging.
|
||||
|
||||
When
|
||||
|
||||
* packaging cannot be sold anymore
|
||||
* lines are tied to a product that can be sold only by packaging
|
||||
and have no packaging
|
||||
|
||||
change the packaging on the line to the 1st saleable packaging.
|
||||
"""
|
||||
|
||||
# Pick lines with packaging that cannot be sold
|
||||
# or have no packaging
|
||||
line_domain = expression.OR(
|
||||
[
|
||||
[("product_packaging_id.sales", "=", False)],
|
||||
[
|
||||
("product_packaging_id", "=", False),
|
||||
("product_id.sell_only_by_packaging", "=", True),
|
||||
],
|
||||
]
|
||||
)
|
||||
self._fix_lines_packaging(line_domain)
|
||||
|
||||
def _fix_lines_packaging(self, line_domain):
|
||||
lines = self.search(line_domain, order="product_id")
|
||||
lines_by_product = defaultdict(self.browse)
|
||||
for line in lines:
|
||||
lines_by_product[line.product_id] += line
|
||||
|
||||
# Change packaging to the 1st available for the product
|
||||
for product, lines in lines_by_product.items():
|
||||
first_valid_pkg = self._get_product_first_valid_packaging(product)
|
||||
if not first_valid_pkg:
|
||||
_logger.error(
|
||||
"Cannot find a valid packaging for product ID %s", product.id
|
||||
)
|
||||
continue
|
||||
lines.write(
|
||||
{"product_packaging_id": first_valid_pkg.id, "product_packaging_qty": 1}
|
||||
)
|
||||
_logger.info("Fixed packaging on set lines for product ID %s", product.id)
|
||||
|
||||
def _get_product_first_valid_packaging(self, product):
|
||||
return fields.first(
|
||||
product.packaging_ids.filtered(lambda x: x.sales).sorted("qty")
|
||||
)
|
||||
43
product_set_sell_only_by_packaging/models/product_template.py
Executable file
43
product_set_sell_only_by_packaging/models/product_template.py
Executable file
@@ -0,0 +1,43 @@
|
||||
# Copyright 2021 Camptocamp SA
|
||||
# @author Simone Orsi <simone.orsi@camptocamp.com>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = "product.template"
|
||||
|
||||
# Just for UI purpose
|
||||
sell_only_by_packaging_prod_set_tocheck = fields.Boolean(
|
||||
help="If this flag is ON, "
|
||||
"it means you have to check all product.set associated with it",
|
||||
compute="_compute_sell_only_by_packaging_prod_set_tocheck",
|
||||
)
|
||||
|
||||
@api.depends("sell_only_by_packaging")
|
||||
def _compute_sell_only_by_packaging_prod_set_tocheck(self):
|
||||
ids_to_check = self._product_ids_to_check()
|
||||
for rec in self:
|
||||
value = False
|
||||
if rec.sell_only_by_packaging and ids_to_check:
|
||||
value = set(rec.product_variant_ids.ids).intersection(ids_to_check)
|
||||
rec.sell_only_by_packaging_prod_set_tocheck = value
|
||||
|
||||
def _product_ids_to_check(self):
|
||||
"""Retrieves product.product IDS to check on product sets."""
|
||||
ids_to_check = self.filtered("sell_only_by_packaging").product_variant_ids.ids
|
||||
if not ids_to_check:
|
||||
return []
|
||||
domain = [
|
||||
("product_id", "in", ids_to_check),
|
||||
("product_packaging_id", "=", False),
|
||||
]
|
||||
lines = self.env["product.set.line"].search(domain)
|
||||
return lines.mapped("product_id").ids
|
||||
|
||||
def action_view_product_set_lines_to_check(self):
|
||||
ids_to_check = self._product_ids_to_check()
|
||||
xmlid = "product_set_sell_only_by_packaging.act_open_product_set_line_view"
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id(xmlid)
|
||||
action["domain"] = [("product_id", "in", ids_to_check)]
|
||||
return action
|
||||
3
product_set_sell_only_by_packaging/pyproject.toml
Executable file
3
product_set_sell_only_by_packaging/pyproject.toml
Executable file
@@ -0,0 +1,3 @@
|
||||
[build-system]
|
||||
requires = ["whool"]
|
||||
build-backend = "whool.buildapi"
|
||||
5
product_set_sell_only_by_packaging/readme/CONTRIBUTORS.md
Executable file
5
product_set_sell_only_by_packaging/readme/CONTRIBUTORS.md
Executable file
@@ -0,0 +1,5 @@
|
||||
- Simone Orsi \<<simone.orsi@camptocamp.com>\>
|
||||
|
||||
- [Trobz](https://trobz.com):
|
||||
- Son Ho\<<sonhd@trobz.com>\>
|
||||
- Tris Doan\<<tridm@trobz.com>\>
|
||||
2
product_set_sell_only_by_packaging/readme/CREDITS.md
Executable file
2
product_set_sell_only_by_packaging/readme/CREDITS.md
Executable file
@@ -0,0 +1,2 @@
|
||||
The migration of this module from 13.0 to 14.0, and 14.0 to 18.0 was financially supported
|
||||
by Camptocamp
|
||||
4
product_set_sell_only_by_packaging/readme/DESCRIPTION.md
Executable file
4
product_set_sell_only_by_packaging/readme/DESCRIPTION.md
Executable file
@@ -0,0 +1,4 @@
|
||||
Glue module between sell_only_by_packaging and sale_product_set_packaging_qty.
|
||||
If sell_only_by_packaging is ON and there are product set lines without
|
||||
packaging selected, a warning is displayed in the product form and quick
|
||||
link to all involved lines allows to review them.
|
||||
BIN
product_set_sell_only_by_packaging/static/description/icon.png
Executable file
BIN
product_set_sell_only_by_packaging/static/description/icon.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
444
product_set_sell_only_by_packaging/static/description/index.html
Executable file
444
product_set_sell_only_by_packaging/static/description/index.html
Executable file
@@ -0,0 +1,444 @@
|
||||
<!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>Sales Product Set Sell only by packaging</title>
|
||||
<style type="text/css">
|
||||
|
||||
/*
|
||||
:Author: David Goodger (goodger@python.org)
|
||||
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
Despite the name, some widely supported CSS2 features are used.
|
||||
|
||||
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: gray; } /* 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, pre.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="sales-product-set-sell-only-by-packaging">
|
||||
<h1 class="title">Sales Product Set Sell only by packaging</h1>
|
||||
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:c2b890e9ed626c08aea6f8248665efe9d948f152b6802e73f2122a3f7dd6b1f1
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.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/product_set_sell_only_by_packaging"><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-product_set_sell_only_by_packaging"><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>Glue module between sell_only_by_packaging and
|
||||
sale_product_set_packaging_qty. If sell_only_by_packaging is ON and
|
||||
there are product set lines without packaging selected, a warning is
|
||||
displayed in the product form and quick link to all involved lines
|
||||
allows to review them.</p>
|
||||
<div class="admonition important">
|
||||
<p class="first admonition-title">Important</p>
|
||||
<p class="last">This is an alpha version, the data model and design can change at any time without warning.
|
||||
Only for development or testing purpose, do not use in production.
|
||||
<a class="reference external" href="https://odoo-community.org/page/development-status">More details on development status</a></p>
|
||||
</div>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
<div class="contents local topic" id="contents">
|
||||
<ul class="simple">
|
||||
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-1">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="toc-entry-2">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="toc-entry-3">Authors</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="toc-entry-4">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#other-credits" id="toc-entry-5">Other credits</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
<h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
|
||||
<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:%20product_set_sell_only_by_packaging%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">
|
||||
<h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
|
||||
<div class="section" id="authors">
|
||||
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Camptocamp</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="contributors">
|
||||
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Simone Orsi <<a class="reference external" href="mailto:simone.orsi@camptocamp.com">simone.orsi@camptocamp.com</a>></li>
|
||||
<li><a class="reference external" href="https://trobz.com">Trobz</a>:<ul>
|
||||
<li>Son Ho<<a class="reference external" href="mailto:sonhd@trobz.com">sonhd@trobz.com</a>></li>
|
||||
<li>Tris Doan<<a class="reference external" href="mailto:tridm@trobz.com">tridm@trobz.com</a>></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="other-credits">
|
||||
<h2><a class="toc-backref" href="#toc-entry-5">Other credits</a></h2>
|
||||
<p>The migration of this module from 13.0 to 14.0, and 14.0 to 18.0 was
|
||||
financially supported by Camptocamp</p>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
|
||||
<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/product_set_sell_only_by_packaging">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>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
1
product_set_sell_only_by_packaging/tests/__init__.py
Executable file
1
product_set_sell_only_by_packaging/tests/__init__.py
Executable file
@@ -0,0 +1 @@
|
||||
from . import test_product_set_packaging
|
||||
74
product_set_sell_only_by_packaging/tests/test_product_set_packaging.py
Executable file
74
product_set_sell_only_by_packaging/tests/test_product_set_packaging.py
Executable file
@@ -0,0 +1,74 @@
|
||||
# Copyright 2021 Camptocamp SA
|
||||
# @author Simone Orsi <simone.orsi@camptocamp.com>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
||||
|
||||
from odoo import exceptions
|
||||
|
||||
from odoo.addons.product.tests.common import ProductCommon
|
||||
|
||||
|
||||
class TestProductSetPackaging(ProductCommon):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
|
||||
cls.line = cls.env.ref("product_set.product_set_line_computer_3")
|
||||
cls.packaging = cls.env["product.packaging"].create(
|
||||
{"name": "Box", "product_id": cls.line.product_id.id, "qty": 10}
|
||||
)
|
||||
cls.packaging2 = cls.env["product.packaging"].create(
|
||||
{"name": "Box 2", "product_id": cls.line.product_id.id, "qty": 20}
|
||||
)
|
||||
cls.line.product_packaging_id = cls.packaging
|
||||
cls.tmpl = cls.line.product_id.product_tmpl_id
|
||||
|
||||
def test_sell_only_by_packaging_ko(self):
|
||||
self.line.product_id.sell_only_by_packaging = True
|
||||
with self.assertRaisesRegex(
|
||||
exceptions.UserError, "can be sold only by packaging"
|
||||
):
|
||||
self.line.product_packaging_id = False
|
||||
|
||||
def test_sell_only_by_packaging_ok(self):
|
||||
self.line.product_id.sell_only_by_packaging = False
|
||||
self.line.product_packaging_id = False
|
||||
|
||||
def test_product_set_to_check(self):
|
||||
self.assertFalse(self.line.product_id.sell_only_by_packaging_prod_set_tocheck)
|
||||
self.line.product_packaging_id = False
|
||||
self.tmpl.sell_only_by_packaging = True
|
||||
self.assertTrue(self.line.product_id.sell_only_by_packaging_prod_set_tocheck)
|
||||
|
||||
def test_tmpl_action(self):
|
||||
action = self.tmpl.action_view_product_set_lines_to_check()
|
||||
self.assertEqual(action["domain"], [("product_id", "in", [])])
|
||||
self.line.product_packaging_id = False
|
||||
self.tmpl.sell_only_by_packaging = True
|
||||
action = self.tmpl.action_view_product_set_lines_to_check()
|
||||
self.assertEqual(
|
||||
action["domain"], [("product_id", "in", [self.line.product_id.id])]
|
||||
)
|
||||
|
||||
def test_prod_action(self):
|
||||
action = self.line.product_id.action_view_product_set_lines_to_check()
|
||||
self.assertEqual(action["domain"], [("product_id", "in", [])])
|
||||
self.line.product_packaging_id = False
|
||||
self.tmpl.sell_only_by_packaging = True
|
||||
action = self.line.product_id.action_view_product_set_lines_to_check()
|
||||
self.assertEqual(
|
||||
action["domain"], [("product_id", "in", [self.line.product_id.id])]
|
||||
)
|
||||
|
||||
def test_cron_check_can_be_sold(self):
|
||||
self.assertTrue(self.packaging.sales)
|
||||
self.assertTrue(self.packaging2.sales)
|
||||
self.assertEqual(self.line.product_packaging_id, self.packaging)
|
||||
self.packaging.sales = False
|
||||
self.env["product.set.line"].cron_check_packaging()
|
||||
self.assertEqual(self.line.product_packaging_id, self.packaging2)
|
||||
|
||||
def test_cron_check_sell_only_by_packaging(self):
|
||||
self.line.product_packaging_id = False
|
||||
self.line.product_id.sell_only_by_packaging = True
|
||||
self.env["product.set.line"].cron_check_packaging()
|
||||
self.assertEqual(self.line.product_packaging_id, self.packaging)
|
||||
52
product_set_sell_only_by_packaging/views/product_set_line.xml
Executable file
52
product_set_sell_only_by_packaging/views/product_set_line.xml
Executable file
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="view_product_set_line_tree" model="ir.ui.view">
|
||||
<field name="name">product.set.line.list</field>
|
||||
<field name="model">product.set.line</field>
|
||||
<field name="type">list</field>
|
||||
<field name="priority" eval="8" />
|
||||
<field name="arch" type="xml">
|
||||
<list editable="top">
|
||||
<field name="product_set_id" />
|
||||
<field name="product_id" />
|
||||
<field name="quantity" />
|
||||
<field name="discount" groups="sale.group_discount_per_so_line" />
|
||||
<field name="product_packaging_id" required="sell_only_by_packaging" />
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_product_set_line_search" model="ir.ui.view">
|
||||
<field name="name">product.set.line.search</field>
|
||||
<field name="model">product.set.line</field>
|
||||
<field name="type">search</field>
|
||||
<field name="priority" eval="8" />
|
||||
<field name="arch" type="xml">
|
||||
<search string="Product set line">
|
||||
<field name="product_set_id" />
|
||||
<field name="product_id" />
|
||||
<filter
|
||||
name="group_by_product_set_id"
|
||||
string="Product set"
|
||||
domain="[]"
|
||||
context="{'group_by':'product_set_id'}"
|
||||
/>
|
||||
<filter
|
||||
name="group_by_product_id"
|
||||
string="Product"
|
||||
domain="[]"
|
||||
context="{'group_by':'product_id'}"
|
||||
/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
<!-- For action "View all lines" in warning message -->
|
||||
<record model="ir.actions.act_window" id="act_open_product_set_line_view">
|
||||
<field name="name">Product set line</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">product.set.line</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
<field name="search_view_id" ref="view_product_set_line_search" />
|
||||
<field name="domain">[]</field>
|
||||
<field name="context">{}</field>
|
||||
</record>
|
||||
</odoo>
|
||||
32
product_set_sell_only_by_packaging/views/product_template.xml
Executable file
32
product_set_sell_only_by_packaging/views/product_template.xml
Executable file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!-- Copyright 2020 Camptocamp License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
||||
<odoo>
|
||||
<record id="product_template_form_view" model="ir.ui.view">
|
||||
<field name="name">product.template.form.view</field>
|
||||
<field name="model">product.template</field>
|
||||
<field
|
||||
name="inherit_id"
|
||||
ref="sell_only_by_packaging.product_template_form_view"
|
||||
/>
|
||||
<field name="arch" type="xml">
|
||||
<label for="sell_only_by_packaging" position="after">
|
||||
<div
|
||||
class="alert alert-warning"
|
||||
role="alert"
|
||||
invisible="not sell_only_by_packaging_prod_set_tocheck"
|
||||
>
|
||||
There are product set lines associated to this product
|
||||
which do not have a packaging associated.
|
||||
It would be better to check them all.
|
||||
If you don't take any action,
|
||||
a cron will assign such lines to the first available packaging.
|
||||
<button
|
||||
class="oe_link"
|
||||
type="object"
|
||||
name="action_view_product_set_lines_to_check"
|
||||
>View all lines</button>
|
||||
</div>
|
||||
</label>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user