-
Notifications
You must be signed in to change notification settings - Fork 9
Add disabled, disabled_at, edit_history_summary and errors fields to Invoice #126
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
base: main
Are you sure you want to change the base?
Changes from all commits
b21f44a
b06878a
fac5d3f
d568895
44a6e89
dcc59d2
5680ccf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,10 @@ class Invoice(Resource): | |
|
|
||
| _path = "/import/customers{/uuid}/invoices" | ||
| _root_key = "invoices" | ||
| _bool_query_params = [ | ||
| 'include_edit_histories', | ||
| 'with_disabled' | ||
| ] | ||
| _many = namedtuple( | ||
| "Invoices", | ||
| [_root_key, "cursor", "has_more", "customer_uuid"], | ||
|
|
@@ -58,6 +62,12 @@ class _Schema(Schema): | |
| date = fields.DateTime() | ||
| due_date = fields.DateTime(allow_none=True) | ||
|
|
||
| disabled = fields.Boolean(allow_none=True) | ||
| disabled_at = fields.DateTime(allow_none=True) | ||
| disabled_by = fields.String(allow_none=True) | ||
| edit_history_summary = fields.Dict(allow_none=True) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [major] When trying to retrieve this field from few random invoices in production, I get: Could you confirm that it works for you in production using any invoice? |
||
| errors = fields.Dict(allow_none=True) | ||
loomchild marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| line_items = fields.Nested(LineItem._Schema, many=True, unknown=EXCLUDE) | ||
| transactions = fields.Nested(Transaction._Schema, many=True, unknown=EXCLUDE) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -121,6 +121,15 @@ def _preProcessParams(cls, params): | |
| if key in params: | ||
| params[replacement] = params[key] | ||
| del params[key] | ||
|
|
||
| if hasattr(cls, '_bool_query_params'): | ||
| for query_param in cls._bool_query_params: | ||
| if query_param in params and isinstance(params[query_param], bool): | ||
| if params[query_param] is True: | ||
| params[query_param] = 'true' | ||
| elif params[query_param] is False: | ||
| params[query_param] = 'false' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [question] Why not delete it as it was before - is it needed because sometimes value can be true by default? |
||
|
|
||
| return params | ||
|
|
||
| @classmethod | ||
|
|
||
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.
[question] Shouldn't
_bool_query_paramsbe added to this array, similar toDataSource(or perhaps even add them automatically inResource)? If not, is it still necessary to add them there?