Skip to content

Commit

Permalink
shopinvader_api_sale: move search schema to shopinvader_schema_sale
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienbeau committed Oct 20, 2023
1 parent b7074c6 commit e2c2067
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 20 deletions.
1 change: 0 additions & 1 deletion shopinvader_api_sale/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
from . import routers
from . import schemas
4 changes: 1 addition & 3 deletions shopinvader_api_sale/routers/sales.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
)
from odoo.addons.fastapi.schemas import Paging
from odoo.addons.fastapi.utils import FilteredDomainAdapter
from odoo.addons.shopinvader_schema_sale.schemas import Sale

from ..schemas import SaleSearch
from odoo.addons.shopinvader_schema_sale.schemas import Sale, SaleSearch

sale_router = APIRouter(tags=["sales"])

Expand Down
16 changes: 0 additions & 16 deletions shopinvader_api_sale/schemas.py

This file was deleted.

10 changes: 10 additions & 0 deletions shopinvader_schema_sale/schemas/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,13 @@ def from_sale_order(cls, odoo_rec):
invoicing=InvoicingInfo.from_sale_order(odoo_rec),
note=odoo_rec.note or None,
)


class SaleSearch(StrictExtendableBaseModel):
name: str | None = None

def to_odoo_domain(self):
if self.name:
return [("name", "ilike", self.name)]
else:
return []

0 comments on commit e2c2067

Please sign in to comment.