Skip to content

Commit

Permalink
Merge PR #1408 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by lmignon
  • Loading branch information
shopinvader-git-bot committed Oct 13, 2023
2 parents d6b786a + eda7ea4 commit 53603ce
Show file tree
Hide file tree
Showing 39 changed files with 719 additions and 448 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ exclude: |
^shopinvader_pos/|
^shopinvader_price_per_qty/|
^shopinvader_product_attribute_set/|
^shopinvader_product_brand/|
^shopinvader_product_brand_image/|
^shopinvader_product_brand_tag/|
^shopinvader_product_manufactured_for/|
Expand Down
6 changes: 6 additions & 0 deletions setup/shopinvader_product_brand/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
6 changes: 6 additions & 0 deletions setup/shopinvader_search_engine_product_brand/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
1 change: 1 addition & 0 deletions shopinvader_product_brand/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import models
from . import schemas
23 changes: 9 additions & 14 deletions shopinvader_product_brand/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,25 @@
{
"name": "Shopinvader Product Brand",
"summary": "Shopinvader product Brand",
"version": "14.0.1.3.1",
"version": "16.0.1.0.0",
"category": "Shopinvader",
"website": "https://github.com/shopinvader/odoo-shopinvader",
"author": " Akretion",
"license": "AGPL-3",
"application": False,
"installable": False,
"external_dependencies": {
"python": [],
"bin": [],
},
"installable": True,
"depends": [
# OCA
"product_brand",
# To avoid too much glue module we directly depend of shopinvader_search_engine
# if someone really need this module without the search part please do a PR
"shopinvader_search_engine",
# Shopinvader
"shopinvader_base_url",
"shopinvader_product",
"shopinvader_product_seo",
],
"data": [
"views/product_brand_view.xml",
"views/shopinvader_brand_view.xml",
"views/shopinvader_backend_view.xml",
"data/ir_export_brand.xml",
"data/ir_export_product.xml",
"security/ir.model.access.csv",
],
"demo": [],
"external_dependencies": {"python": ["extendable_pydantic>=1.2.0"]},
"development_status": "Alpha",
}
61 changes: 0 additions & 61 deletions shopinvader_product_brand/data/ir_export_brand.xml

This file was deleted.

23 changes: 0 additions & 23 deletions shopinvader_product_brand/data/ir_export_product.xml

This file was deleted.

3 changes: 0 additions & 3 deletions shopinvader_product_brand/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
from . import shopinvader_brand
from . import product_brand
from . import shopinvader_product
from . import shopinvader_backend
19 changes: 7 additions & 12 deletions shopinvader_product_brand/models/product_brand.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,11 @@


class ProductBrand(models.Model):
_inherit = "product.brand"
_name = "product.brand"
_inherit = ["product.brand", "seo.title.mixin", "abstract.url"]

shopinvader_bind_ids = fields.One2many(
"shopinvader.brand",
"record_id",
string="Shopinvader Binding",
context={"active_test": False},
)
active = fields.Boolean(default=True, inverse="_inverse_active")

def _inverse_active(self):
brands = self.filtered(lambda p: not p.active)
brands.mapped("shopinvader_bind_ids").write({"active": False})
active = fields.Boolean(default=True)
sequence = fields.Integer()
meta_description = fields.Char()
meta_keywords = fields.Char()
short_description = fields.Text()
26 changes: 0 additions & 26 deletions shopinvader_product_brand/models/shopinvader_backend.py

This file was deleted.

40 changes: 0 additions & 40 deletions shopinvader_product_brand/models/shopinvader_brand.py

This file was deleted.

30 changes: 0 additions & 30 deletions shopinvader_product_brand/models/shopinvader_product.py

This file was deleted.

1 change: 1 addition & 0 deletions shopinvader_product_brand/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
* Sebastien BEAU <[email protected]>
* Simone Orsi <[email protected]>
* Marie Lejeune <[email protected]>
11 changes: 10 additions & 1 deletion shopinvader_product_brand/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
This module allow you to manage brand on your `Shopinvader`_ website
This module focus on the serialization of brand information into JSON objects
in the context of the `Shopinvader`_ project. These information are mainly used
to be made available for a `Shopinvader`_ website through an export to search
engine indexation services like ElasticSearch / OpenSearch.

* It defines a new specific Pydantic model to be used to serialize a *product.brand*
record into a JSON object.

* It extends the ProductProduct Pydantic model to add the brand information in the
JSON exported for a product.product record.

.. _Shopinvader: https://shopinvader.com
2 changes: 2 additions & 0 deletions shopinvader_product_brand/schemas/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .brand import ProductBrand
from .product import ProductTemplate
32 changes: 32 additions & 0 deletions shopinvader_product_brand/schemas/brand.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2023 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from extendable_pydantic import StrictExtendableBaseModel


class ProductBrand(StrictExtendableBaseModel):
id: int
name: str
sequence: int | None = None
description: str | None = None
short_description: str | None = None
meta_description: str | None = None
meta_keywords: str | None = None
seo_title: str | None = None
url_key: str | None = None
redirect_url_key: str | None = None

@classmethod
def from_product_brand(cls, odoo_rec):
return cls.model_construct(
id=odoo_rec.id,
name=odoo_rec.name,
sequence=odoo_rec.sequence or None,
description=odoo_rec.description or None,
short_description=odoo_rec.short_description or None,
meta_description=odoo_rec.meta_description or None,
meta_keywords=odoo_rec.meta_keywords or None,
seo_title=odoo_rec.seo_title or None,
url_key=odoo_rec.url_key or None,
redirect_url_key=odoo_rec.redirect_url_key or None,
)
22 changes: 22 additions & 0 deletions shopinvader_product_brand/schemas/product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2023 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo.addons.shopinvader_product.schemas import (
ProductTemplate as BaseProductTemplate,
)

from . import ProductBrand


class ProductTemplate(BaseProductTemplate, extends=True):
brand: ProductBrand | None = None

@classmethod
def from_product_template(cls, odoo_rec):
obj = super().from_product_template(odoo_rec)
obj.brand = (
ProductBrand.from_product_brand(odoo_rec.product_brand_id)
if odoo_rec.product_brand_id
else None
)
return obj
3 changes: 0 additions & 3 deletions shopinvader_product_brand/security/ir.model.access.csv

This file was deleted.

2 changes: 0 additions & 2 deletions shopinvader_product_brand/tests/__init__.py

This file was deleted.

21 changes: 0 additions & 21 deletions shopinvader_product_brand/tests/common.py

This file was deleted.

Loading

0 comments on commit 53603ce

Please sign in to comment.