Skip to content

Commit

Permalink
[MIG] product_manufacturer: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
NICO-SOLUTIONS committed Oct 10, 2024
1 parent 62e77eb commit b474abc
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 44 deletions.
1 change: 1 addition & 0 deletions product_manufacturer/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Contributors
- Guewen Baconnier <[email protected]>
- Héctor Villarreal <[email protected]>
- Mantas Šniukas <[email protected]>
- Nils Coenen <[email protected]>

Maintainers
-----------
Expand Down
3 changes: 1 addition & 2 deletions product_manufacturer/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Product Manufacturer",
"version": "16.0.1.0.1",
"version": "17.0.1.0.0",
"summary": "Adds manufacturers and attributes on the product view.",
"website": "https://github.com/OCA/product-attribute",
"author": "OpenERP SA, Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "Product",
"external_dependencies": {"python": ["openupgradelib"]},
"depends": ["product"],
"data": ["views/product_manufacturer_view.xml"],
"auto_install": False,
Expand Down
13 changes: 0 additions & 13 deletions product_manufacturer/migrations/16.0.1.0.0/pre-migration.py

This file was deleted.

42 changes: 23 additions & 19 deletions product_manufacturer/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,34 @@ def _compute_manufacturer_info(self):
lambda template: len(template.product_variant_ids) == 1
)
for template in unique_variants:
template.manufacturer_id = template.product_variant_ids.manufacturer_id
template.manufacturer_pname = (
template.product_variant_ids.manufacturer_pname
product_variant = template.product_variant_ids
template.update(
{
"manufacturer_id": product_variant.manufacturer_id.id,
"manufacturer_pname": product_variant.manufacturer_pname,
"manufacturer_pref": product_variant.manufacturer_pref,
"manufacturer_purl": product_variant.manufacturer_purl,
}
)
template.manufacturer_pref = template.product_variant_ids.manufacturer_pref
template.manufacturer_purl = template.product_variant_ids.manufacturer_purl
for template in self - unique_variants:
template.manufacturer_id = False
template.manufacturer_pname = False
template.manufacturer_pref = False
template.manufacturer_purl = False
(self - unique_variants).update(
{
"manufacturer_id": False,
"manufacturer_pname": False,
"manufacturer_pref": False,
"manufacturer_purl": False,
}
)

def _inverse_manufacturer_info(self):
for template in self:
if len(template.product_variant_ids) == 1:
template.product_variant_ids.manufacturer_id = template.manufacturer_id
template.product_variant_ids.manufacturer_pname = (
template.manufacturer_pname
)
template.product_variant_ids.manufacturer_pref = (
template.manufacturer_pref
)
template.product_variant_ids.manufacturer_purl = (
template.manufacturer_purl
template.product_variant_ids.update(
{
"manufacturer_id": template.manufacturer_id,
"manufacturer_pname": template.manufacturer_pname,
"manufacturer_pref": template.manufacturer_pref,
"manufacturer_purl": template.manufacturer_purl,
}
)

def _get_related_fields_variant_template(self):
Expand Down
1 change: 1 addition & 0 deletions product_manufacturer/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
- Guewen Baconnier \<<[email protected]>\>
- Héctor Villarreal \<<[email protected]>\>
- Mantas Šniukas \<<[email protected]>\>
- Nils Coenen \<<[email protected]>\>
13 changes: 8 additions & 5 deletions product_manufacturer/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!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>
Expand All @@ -9,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
: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.
Expand Down Expand Up @@ -275,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

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

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

span.section-subtitle {
Expand Down Expand Up @@ -415,12 +415,15 @@ <h1>Contributors</h1>
<li>Guewen Baconnier &lt;<a class="reference external" href="mailto:guewen.baconnier&#64;camptocamp.com">guewen.baconnier&#64;camptocamp.com</a>&gt;</li>
<li>Héctor Villarreal &lt;<a class="reference external" href="mailto:hector.villarreal&#64;forgeflow.com">hector.villarreal&#64;forgeflow.com</a>&gt;</li>
<li>Mantas Šniukas &lt;<a class="reference external" href="mailto:mantas&#64;vialaurea.lt">mantas&#64;vialaurea.lt</a>&gt;</li>
<li>Nils Coenen &lt;<a class="reference external" href="mailto:nils.coenen&#64;nico-solutions.de">nils.coenen&#64;nico-solutions.de</a>&gt;</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>
<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 Down
5 changes: 2 additions & 3 deletions product_manufacturer/tests/test_product_manufacturer.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


from odoo.tests.common import TransactionCase
from odoo.addons.base.tests.common import BaseCommon


class TestProductManufacturer(TransactionCase):
class TestProductManufacturer(BaseCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
cls.manufacturer_a = cls.env["res.partner"].create({"name": "Manufacturer A"})
cls.manufacturer_b = cls.env["res.partner"].create({"name": "Manufacturer B"})
cls.attr1 = cls.env["product.attribute"].create({"name": "color"})
Expand Down
2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

0 comments on commit b474abc

Please sign in to comment.