-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
16.0 add shopinvader_api_sale #1421
16.0 add shopinvader_api_sale #1421
Conversation
@@ -0,0 +1,5 @@ | |||
from . import shipping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, a good practice is to always import defined models a module root. It eases code readability....
from odoo.addons.shopinvader_schema_sale.schemas import InvoicingInfo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the tips
@lmignon I have a weird error with the PagedCollection and I don't know why, do you have an idea? |
@sebastienbeau Don't worry. It's just because you're mixing an extendable model I made a little test by defining the from typing import TypeVar, List, Generic
from odoo.addons.extendable_fastapi.schemas import StrictExtendableBaseModel
T = TypeVar("T")
class PagedCollection(StrictExtendableBaseModel, Generic[T]):
total: int
items: List[T] and it works I propose to add these generics models into the |
@sebastienbeau here it's OCA/rest-framework#380 |
Regarding the security rule define here : We need to define the same rule on api_sale, api_quotation, api_cart (we want to show the sale that belong to the authenticated_partner) I see 3 possibility
|
There is also some "common" code for testing between the api_sale, api_quotation, api_cart |
8f00f55
to
b02b807
Compare
@lmignon the api is ready. |
88beffe
to
6049805
Compare
|
||
def convert_to_sale_write(self): | ||
vals = {} | ||
data = self.model_dump(exclude_unset=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I have used the "self.model_dump(exclude_unset=True)" here to be able to support partial update
The API should be able to only push the invoicing info or the note, without needing to send every value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sebastienbeau It's a valid and appropriate use. The most important here is that you use the result of the call to model_dump
to create the result of the convert_to_sale_write
method but not as
result of the method.
169b339
to
b7074c6
Compare
after merging api_address #1425 clean I will add this clean here akretion#8 |
1e0af41
to
e2c2067
Compare
e2c2067
to
2a28fe8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @sebastienbeau It's promising and easy to read. My remaining concerns:
- Not comfortable with the definition of
FilteredDomainAdapter
into the fastapi addon (Could be also renamedFilteredModelAdapter
???) - Do we've to put the logic to transform a schema into an odoo model dict or a domain into the schema? I've no clear args in favor or against?
Some little comments
_description = "Shopinvader Api Sale Service Helper" | ||
|
||
@property | ||
def adapter(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def adapter(self): | |
def filtered_model(self): |
@sebastienbeau Here it's some fixes and improvements... akretion#9 |
71bc72c
to
ac4c530
Compare
ac4c530
to
797a9ad
Compare
d9707ab
to
4c6cf5f
Compare
@lmignon I have a weird issue on the test
It fail on module shopinvader_api_cart If you run
It's work Seem there is an issue in "extendable" |
Don't forget to reset the exendable registry even if an error occurs into the setup
[FIX] shopinvader_schema_sale: Fix tests
[IMP] shopinvader_schema_sale: Improves naming
…ring shopinvader_api_sale: explicit filtering on partner
/ocabot merge minor |
@lmignon The merge process could not start, because of exception [Errno 13] Permission denied: '/app/run/.cache/oca-mqt'. |
/ocabot merge minor |
@sebastienbeau The merge process could not start, because of exception [Errno 13] Permission denied: '/app/run/.cache/oca-mqt'. |
/ocabot merge minor |
This PR looks fantastic, let's merge it! |
Congratulations, your PR was merged at b42cf29. Thanks a lot for contributing to shopinvader. ❤️ |
Work in progress
@lmignon @sbidoul @thibaultrey