Added test_add_items_to_work_order and fixed Decimal128 in model Workorder #148

Merged
GFMpt13 merged 2 commits from workOrders-quote&item-fix into main 2025-12-04 11:42:29 +00:00
GFMpt13 commented 2025-12-03 11:25:50 +00:00 (Migrated from github.com)
  • Added the test_add_items_to_work_order to test adding items to a workworder.

  • Updated test_update_work_order_success to simulate a more complete quote.

  • Fixed the error using Decimal128 in the WorkOrder. The model was trying to compare the Decimal 128 with an Int for a validation. The fix was creating a Custom Validators for Decimal128.

Closes #147

- Added the test_add_items_to_work_order to test adding items to a workworder. - Updated test_update_work_order_success to simulate a more complete quote. - Fixed the error using Decimal128 in the WorkOrder. The model was trying to compare the Decimal 128 with an Int for a validation. The fix was creating a Custom Validators for Decimal128. Closes #147
duarteneves5 (Migrated from github.com) reviewed 2025-12-03 11:25:50 +00:00
miguelmiranda20 (Migrated from github.com) reviewed 2025-12-03 11:25:50 +00:00
JoaoTF03 (Migrated from github.com) reviewed 2025-12-03 11:25:50 +00:00
vascodias23 (Migrated from github.com) reviewed 2025-12-03 20:13:10 +00:00
@ -51,13 +51,31 @@ class WorkOrderItem(BaseModel):
type: WorkOrderItemType
vascodias23 (Migrated from github.com) commented 2025-12-03 20:12:03 +00:00

In these two validators (validate_positive_decimal and validate_iva_rate) is the cls argument needed? Since it looks like we do not need to access the class model itself, it seems redundant.

In these two validators (`validate_positive_decimal` and `validate_iva_rate`) is the `cls` argument needed? Since it looks like we do not need to access the class model itself, it seems redundant.
GFMpt13 (Migrated from github.com) reviewed 2025-12-04 01:03:50 +00:00
@ -51,13 +51,31 @@ class WorkOrderItem(BaseModel):
type: WorkOrderItemType
GFMpt13 (Migrated from github.com) commented 2025-12-04 01:03:50 +00:00

You are absolutely right. The cls argument is not necessary and, in fact, it's incorrect to keep it there when using the @staticmethod decorator.

When using @staticmethod, the function stops receiving the first implicit argument (which would be cls).

Tank you for your comment.

You are absolutely right. The `cls` argument is not necessary and, in fact, it's incorrect to keep it there when using the `@staticmethod` decorator. When using `@staticmethod`, the function stops receiving the first implicit argument (which would be `cls`). Tank you for your comment.
AndreFerreira5 (Migrated from github.com) approved these changes 2025-12-04 11:41:05 +00:00
AndreFerreira5 (Migrated from github.com) left a comment

absolutely exquisite piece of work, approved!

absolutely exquisite piece of work, approved!
Sign in to join this conversation.
No description provided.