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
8 changes: 3 additions & 5 deletions product_variant_default_code/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

============================
Product Variant Default Code
============================
Expand All @@ -17,7 +13,7 @@ Product Variant Default Code
.. |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/license-AGPL--3-blue.png
.. |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%2Fproduct--variant-lightgray.png?logo=github
Expand Down Expand Up @@ -147,6 +143,8 @@ Contributors
* Pedro M. Baeza
* João Marques

* Florent THOMAS <florent.thomas@mind-and-go.com>

Maintainers
~~~~~~~~~~~

Expand Down
1 change: 1 addition & 0 deletions product_variant_default_code/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import models
from .hooks import pre_init_hook
1 change: 1 addition & 0 deletions product_variant_default_code/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"category": "Product",
"maintainers": ["Kev-Roche"],
"depends": ["product"],
"pre_init_hook": "pre_init_hook",
"data": [
"security/product_security.xml",
"data/ir_config_parameter.xml",
Expand Down
14 changes: 14 additions & 0 deletions product_variant_default_code/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright <YEAR(S)> <AUTHOR(S)>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

import logging


def pre_init_hook(cr):
logger = logging.getLogger(__name__)
logger.info("Add product_product.manual_code column if it does not yet exist")
cr.execute(
"ALTER TABLE product_product ADD COLUMN IF NOT EXISTS manual_code BOOLEAN;"
)
cr.execute("UPDATE product_product SET manual_code = TRUE;")
logger.info("product_product.manual_code set to True on existing variants")
2 changes: 2 additions & 0 deletions product_variant_default_code/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
* David Vidal
* Pedro M. Baeza
* João Marques

* Florent THOMAS <florent.thomas@mind-and-go.com>
42 changes: 17 additions & 25 deletions product_variant_default_code/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>README.rst</title>
<title>Product Variant Default Code</title>
<style type="text/css">

/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
: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.
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.
Expand Down Expand Up @@ -275,7 +274,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: gray; } /* line numbers */
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 }
Expand All @@ -301,7 +300,7 @@
span.pre {
white-space: pre }

span.problematic, pre.problematic {
span.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -360,21 +359,16 @@
</style>
</head>
<body>
<div class="document">
<div class="document" id="product-variant-default-code">
<h1 class="title">Product Variant Default Code</h1>


<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
</a>
<div class="section" id="product-variant-default-code">
<h1>Product Variant Default Code</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:23782e83708e18c5e26008b1e49622f50b2f53d317111279dd3fe33def16dacd
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/product-variant/tree/16.0/product_variant_default_code"><img alt="OCA/product-variant" src="https://img.shields.io/badge/github-OCA%2Fproduct--variant-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/product-variant-16-0/product-variant-16-0-product_variant_default_code"><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/product-variant&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<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/product-variant/tree/16.0/product_variant_default_code"><img alt="OCA/product-variant" src="https://img.shields.io/badge/github-OCA%2Fproduct--variant-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/product-variant-16-0/product-variant-16-0-product_variant_default_code"><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/product-variant&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module automatically generate Product Reference (default_code)
according to attributes data with a configurable behavior.</p>
<p>It defines a reference mask on the product templates so the
Expand Down Expand Up @@ -411,7 +405,7 @@ <h1>Product Variant Default Code</h1>
</ul>
</div>
<div class="section" id="usage">
<h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<p>To set the reference mask up on any product template ‘Variant reference mask’
new field.</p>
<p>When creating a new product template without specifying the <em>Variant reference
Expand Down Expand Up @@ -444,7 +438,7 @@ <h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
would give <cite>default_code</cite> like this: <cite>COBl-L</cite>, <cite>COWh-L</cite>, <cite>COBl-XL</cite> and
<cite>COWh-XL</cite>.</p>
<div class="section" id="avoiding-mask-in-variants">
<h3><a class="toc-backref" href="#toc-entry-2">Avoiding mask in variants</a></h3>
<h2><a class="toc-backref" href="#toc-entry-2">Avoiding mask in variants</a></h2>
<p>You can avoid this behavior or force a manual default_code on variant. To do
so, go to <em>Product Variants &gt; [any variant you want to set up]</em> and set
manually its reference code. The field <cite>manual code</cite> will be set to on and the
Expand All @@ -453,23 +447,23 @@ <h3><a class="toc-backref" href="#toc-entry-2">Avoiding mask in variants</a></h3
</div>
</div>
<div class="section" id="known-issues-roadmap">
<h2><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h2>
<h1><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h1>
<ul class="simple">
<li>In case of attribute name update, related mask are not updated.</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h2><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h2>
<h1><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/product-variant/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/product-variant/issues/new?body=module:%20product_variant_default_code%0Aversion:%2016.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-5">Credits</a></h2>
<h1><a class="toc-backref" href="#toc-entry-5">Credits</a></h1>
<div class="section" id="authors">
<h3><a class="toc-backref" href="#toc-entry-6">Authors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-6">Authors</a></h2>
<ul class="simple">
<li>AvancOSC</li>
<li>Shine IT</li>
Expand All @@ -478,7 +472,7 @@ <h3><a class="toc-backref" href="#toc-entry-6">Authors</a></h3>
</ul>
</div>
<div class="section" id="contributors">
<h3><a class="toc-backref" href="#toc-entry-7">Contributors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
<ul class="simple">
<li>Alfredo de la Fuente &lt;<a class="reference external" href="mailto:alfredodelafuente&#64;avanzosc.es">alfredodelafuente&#64;avanzosc.es</a>&gt;</li>
<li>Tony Gu &lt;<a class="reference external" href="mailto:tony&#64;openerp.cn">tony&#64;openerp.cn</a>&gt;</li>
Expand All @@ -489,14 +483,13 @@ <h3><a class="toc-backref" href="#toc-entry-7">Contributors</a></h3>
* David Vidal
* Pedro M. Baeza
* João Marques</li>
<li>Florent THOMAS &lt;<a class="reference external" href="mailto:florent.thomas&#64;mind-and-go.com">florent.thomas&#64;mind-and-go.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h3>
<h2><a class="toc-backref" href="#toc-entry-8">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>
<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>
Expand All @@ -507,6 +500,5 @@ <h3><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h3>
</div>
</div>
</div>
</div>
</body>
</html>