From b428d1d61b63e60ce93cde63d8d8b9bd1f68d41d Mon Sep 17 00:00:00 2001
From: Florian Mounier
Date: Thu, 19 Dec 2024 17:30:37 +0100
Subject: [PATCH] [DONOTMERGE] PR depends
---
shopinvader_api_cart_options/README.rst | 24 +++++++++----------
shopinvader_api_cart_options/readme/USAGE.md | 22 ++++++++---------
.../static/description/index.html | 24 +++++++++----------
shopinvader_api_cart_options/tests/models.py | 14 +++++------
shopinvader_api_cart_options/tests/schemas.py | 2 +-
test-requirements.txt | 5 ++--
6 files changed, 45 insertions(+), 46 deletions(-)
diff --git a/shopinvader_api_cart_options/README.rst b/shopinvader_api_cart_options/README.rst
index ffc890834c..8f8a11df02 100644
--- a/shopinvader_api_cart_options/README.rst
+++ b/shopinvader_api_cart_options/README.rst
@@ -7,7 +7,7 @@ Shopinvader API Cart Options
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- !! source digest: sha256:946cd22cb562f3d64d31537d9fdfb741356c31fcfa820646b6827b07492a263a
+ !! source digest: sha256:a79d0b44a91d73aa4ec75b5dc399fac8130e6bc08cf5228ce0a6da8b4c81eba0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -45,13 +45,13 @@ add your own options:
.. code:: python
class SaleLineOptions(BaseSaleLineOptions, extends=True):
- note: str | None = None
+ engraving: str | None = None
special: bool = False
@classmethod
def from_sale_order_line(cls, odoo_rec):
rv = super().from_sale_order_line(odoo_rec)
- rv.note = odoo_rec.note or None
+ rv.engraving = odoo_rec.carving or None
rv.special = odoo_rec.special
return rv
@@ -62,27 +62,27 @@ for you options in the cart line matching and in the cart line transfer:
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
- note = fields.Char()
+ carving = fields.Char()
special = fields.Boolean()
def _match_cart_line(
self,
product_id,
- note=None,
+ carving=None,
special=None,
**kwargs,
):
rv = super()._match_cart_line(
product_id,
- note=note,
+ carving=carving,
special=special,
**kwargs,
)
- return rv and self.note == note and self.special == special
+ return rv and self.carving == carving and self.special == special
def _prepare_cart_line_transfer_values(self):
vals = super()._prepare_cart_line_transfer_values()
- vals["note"] = self.note
+ vals["carving"] = self.carving
vals["special"] = self.special
return vals
@@ -92,7 +92,9 @@ the cart line creation from the transaction API:
.. code:: python
- class ShopinvaderApiCartRouterHelper(models.AbstractModel):
+ class ShopinvaderApiCartRouterHelper(
+ models.AbstractModel
+ ): # pylint: disable=consider-merging-classes-inherited
_inherit = "shopinvader_api_cart.cart_router.helper"
@api.model
@@ -101,9 +103,7 @@ the cart line creation from the transaction API:
):
options = transactions[0].options
if options:
- if options.note is not None:
- values["note"] = options.note
-
+ values["carving"] = options.engraving
values["special"] = options.special
return values
diff --git a/shopinvader_api_cart_options/readme/USAGE.md b/shopinvader_api_cart_options/readme/USAGE.md
index d0ed7c2a68..eda21c4de7 100644
--- a/shopinvader_api_cart_options/readme/USAGE.md
+++ b/shopinvader_api_cart_options/readme/USAGE.md
@@ -6,13 +6,13 @@ options:
```python
class SaleLineOptions(BaseSaleLineOptions, extends=True):
- note: str | None = None
+ engraving: str | None = None
special: bool = False
@classmethod
def from_sale_order_line(cls, odoo_rec):
rv = super().from_sale_order_line(odoo_rec)
- rv.note = odoo_rec.note or None
+ rv.engraving = odoo_rec.carving or None
rv.special = odoo_rec.special
return rv
```
@@ -23,27 +23,27 @@ the cart line matching and in the cart line transfer:
```python
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
- note = fields.Char()
+ carving = fields.Char()
special = fields.Boolean()
def _match_cart_line(
self,
product_id,
- note=None,
+ carving=None,
special=None,
**kwargs,
):
rv = super()._match_cart_line(
product_id,
- note=note,
+ carving=carving,
special=special,
**kwargs,
)
- return rv and self.note == note and self.special == special
+ return rv and self.carving == carving and self.special == special
def _prepare_cart_line_transfer_values(self):
vals = super()._prepare_cart_line_transfer_values()
- vals["note"] = self.note
+ vals["carving"] = self.carving
vals["special"] = self.special
return vals
```
@@ -52,7 +52,9 @@ And finally, you will need to extend the `ShopinvaderApiCartRouterHelper` to add
for your options in the cart line creation from the transaction API:
```python
-class ShopinvaderApiCartRouterHelper(models.AbstractModel):
+class ShopinvaderApiCartRouterHelper(
+ models.AbstractModel
+): # pylint: disable=consider-merging-classes-inherited
_inherit = "shopinvader_api_cart.cart_router.helper"
@api.model
@@ -61,9 +63,7 @@ class ShopinvaderApiCartRouterHelper(models.AbstractModel):
):
options = transactions[0].options
if options:
- if options.note is not None:
- values["note"] = options.note
-
+ values["carving"] = options.engraving
values["special"] = options.special
return values
diff --git a/shopinvader_api_cart_options/static/description/index.html b/shopinvader_api_cart_options/static/description/index.html
index 62c13e05b4..5b7438b825 100644
--- a/shopinvader_api_cart_options/static/description/index.html
+++ b/shopinvader_api_cart_options/static/description/index.html
@@ -368,7 +368,7 @@ Shopinvader API Cart Options
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! source digest: sha256:946cd22cb562f3d64d31537d9fdfb741356c31fcfa820646b6827b07492a263a
+!! source digest: sha256:a79d0b44a91d73aa4ec75b5dc399fac8130e6bc08cf5228ce0a6da8b4c81eba0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
This module allows to add options to the cart lines, grouping cart
@@ -396,13 +396,13 @@
add your own options:
class SaleLineOptions(BaseSaleLineOptions, extends=True):
- note: str | None = None
+ engraving: str | None = None
special: bool = False
@classmethod
def from_sale_order_line(cls, odoo_rec):
rv = super().from_sale_order_line(odoo_rec)
- rv.note = odoo_rec.note or None
+ rv.engraving = odoo_rec.carving or None
rv.special = odoo_rec.special
return rv
@@ -411,27 +411,27 @@
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
- note = fields.Char()
+ carving = fields.Char()
special = fields.Boolean()
def _match_cart_line(
self,
product_id,
- note=None,
+ carving=None,
special=None,
**kwargs,
):
rv = super()._match_cart_line(
product_id,
- note=note,
+ carving=carving,
special=special,
**kwargs,
)
- return rv and self.note == note and self.special == special
+ return rv and self.carving == carving and self.special == special
def _prepare_cart_line_transfer_values(self):
vals = super()._prepare_cart_line_transfer_values()
- vals["note"] = self.note
+ vals["carving"] = self.carving
vals["special"] = self.special
return vals
@@ -439,7 +439,9 @@
ShopinvaderApiCartRouterHelper to add support for your options in
the cart line creation from the transaction API:
-class ShopinvaderApiCartRouterHelper(models.AbstractModel):
+class ShopinvaderApiCartRouterHelper(
+ models.AbstractModel
+): # pylint: disable=consider-merging-classes-inherited
_inherit = "shopinvader_api_cart.cart_router.helper"
@api.model
@@ -448,9 +450,7 @@
):
options = transactions[0].options
if options:
- if options.note is not None:
- values["note"] = options.note
-
+ values["carving"] = options.engraving
values["special"] = options.special
return values
diff --git a/shopinvader_api_cart_options/tests/models.py b/shopinvader_api_cart_options/tests/models.py
index 0db95ef3cc..1567925d9d 100644
--- a/shopinvader_api_cart_options/tests/models.py
+++ b/shopinvader_api_cart_options/tests/models.py
@@ -11,27 +11,27 @@
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
- engraving = fields.Char()
+ carving = fields.Char()
special = fields.Boolean()
def _match_cart_line(
self,
product_id,
- engraving=None,
+ carving=None,
special=None,
**kwargs,
):
rv = super()._match_cart_line(
product_id,
- engraving=engraving,
+ carving=carving,
special=special,
**kwargs,
)
- return rv and self.engraving == engraving and self.special == special
+ return rv and self.carving == carving and self.special == special
def _prepare_cart_line_transfer_values(self):
vals = super()._prepare_cart_line_transfer_values()
- vals["engraving"] = self.engraving
+ vals["carving"] = self.carving
vals["special"] = self.special
return vals
@@ -47,9 +47,7 @@ def _apply_transactions_creating_new_cart_line_prepare_vals(
):
options = transactions[0].options
if options:
- if options.engraving is not None:
- values["engraving"] = options.engraving
-
+ values["carving"] = options.engraving
values["special"] = options.special
return values
diff --git a/shopinvader_api_cart_options/tests/schemas.py b/shopinvader_api_cart_options/tests/schemas.py
index 5fd950d530..38532fc110 100644
--- a/shopinvader_api_cart_options/tests/schemas.py
+++ b/shopinvader_api_cart_options/tests/schemas.py
@@ -12,6 +12,6 @@ class SaleLineOptions(BaseSaleLineOptions, extends=True):
@classmethod
def from_sale_order_line(cls, odoo_rec):
rv = super().from_sale_order_line(odoo_rec)
- rv.engraving = odoo_rec.engraving or None
+ rv.engraving = odoo_rec.carving or None
rv.special = odoo_rec.special
return rv
diff --git a/test-requirements.txt b/test-requirements.txt
index c026f5ff35..bceef43629 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -6,5 +6,6 @@ unittest2 # For shopinvader test_controller, which inherits component
odoo-test-helper
httpx # For FastAPI tests
-odoo-addon-shopinvader_api_customer @ git+https://github.com/shopinvader/odoo-shopinvader@refs/pull/1551/head#subdirectory=setup/shopinvader_api_customer
-odoo-addon-shopinvader_api_settings @ git+https://github.com/shopinvader/odoo-shopinvader@refs/pull/1555/head#subdirectory=setup/shopinvader_api_settings
+odoo-addon-shopinvader_sale_cart @ git+https://github.com/shopinvader/odoo-shopinvader@refs/pull/1575/head#subdirectory=setup/shopinvader_sale_cart
+odoo-addon-shopinvader_api_cart @ git+https://github.com/shopinvader/odoo-shopinvader@refs/pull/1575/head#subdirectory=setup/shopinvader_api_cart
+odoo-addon-extendable @ git+https://github.com/OCA/rest-framework@refs/pull/482/head#subdirectory=setup/extendable