Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions sale_product_attribute_custom_value_variant/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
===========================================
Sale Product Attribute Custom Value Variant
===========================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:47cd8424086b47a4a452525fdfdbd23c71e51171bee5daf54fb36f8c10534f65
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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_product_attribute_custom_value_variant
: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_product_attribute_custom_value_variant
: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 allows to use products with custom value (Free Text) in sale
orders with the ability of creating a specific variant (which is not the
case in Odoo core).

**Table of contents**

.. contents::
:local:

Configuration
=============

See ``product_attribute_custom_value_variant`` module.

Usage
=====

When a product template is added to a sale order line, the configured
custom values become real attribute values.

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_product_attribute_custom_value_variant%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
-------

* ACSONE SA/NV
* Aion Tech

Contributors
------------

- Simone Rubino - Aion Tech
- Denis Roussel [email protected]

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_product_attribute_custom_value_variant>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions sale_product_attribute_custom_value_variant/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
16 changes: 16 additions & 0 deletions sale_product_attribute_custom_value_variant/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2025 Simone Rubino - Aion Tech
# Copyright 2025 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Sale Product Attribute Custom Value Variant",
"summary": """
This module allows to use product custom attribute
and create the corresponding variant when using it on sale order line
""",
"version": "18.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Aion Tech,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/sale-workflow",
"depends": ["sale", "product_attribute_custom_value_variant"],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_order_line
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2025 Simone Rubino - Aion Tech
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, models


class SaleOrderLine(models.Model):
_inherit = "sale.order.line"

def _assign_new_custom_variant(self):
"""Create new variants and assign them to the `self`."""
for line in self:
with line.product_id._get_attribute_custom_value_variant(
line.product_custom_attribute_value_ids
) as new_variant:
line.product_id = new_variant

@api.model_create_multi
def create(self, vals_list):
lines = super().create(vals_list)
custom_value_lines = lines.filtered("product_custom_attribute_value_ids")
if custom_value_lines:
custom_value_lines._assign_new_custom_variant()
return lines
3 changes: 3 additions & 0 deletions sale_product_attribute_custom_value_variant/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See `product_attribute_custom_value_variant` module.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Simone Rubino - Aion Tech
- Denis Roussel <[email protected]>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module allows to use products with custom value (Free Text) in sale orders
with the ability of creating a specific variant (which is not the case in Odoo core).
2 changes: 2 additions & 0 deletions sale_product_attribute_custom_value_variant/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
When a product template is added to a sale order line, the configured
custom values become real attribute values.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading