Working on redoing order to get rid of order_cart.

This commit is contained in:
Scott Idem
2021-08-09 20:16:07 -04:00
parent 1dba813d4b
commit 73466456ee
11 changed files with 272 additions and 27 deletions

View File

@@ -35,6 +35,7 @@ class Order_Line_Base(BaseModel):
product_type_id: Optional[int] # Copied from product record
product_type: Optional[str] # WARNING: Copied from product record; dup from look up? probably not use?
product_type_code: Optional[str] # Copied from product record; from look up
product_type_name: Optional[str] # Copied from product record; from look up
product_name: Optional[str] # Copied from product record
@@ -52,6 +53,7 @@ class Order_Line_Base(BaseModel):
curr_product_type_id: Optional[int] # Dynamic from v_order_line
curr_product_type: Optional[str] # Dynamic from v_order_line
curr_product_type_code: Optional[str] # Dynamic from v_order_line
curr_product_type_name: Optional[str] # Dynamic from v_order_line
curr_product_name: Optional[str] # Dynamic from v_order_line
@@ -160,4 +162,51 @@ class Order_Line_Base(BaseModel):
allow_population_by_field_name = True
fields = base_fields
class Order_Line_DB_Base(BaseModel):
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
id_random: Optional[str] = Field(
alias = 'order_line_id_random',
)
id: Optional[int] = Field(
alias = 'order_line_id'
)
order_id_random: Optional[str]
order_id: Optional[int]
product_id_random: str
product_id: Optional[int]
product_for_type: Optional[str] # Copied from product record
product_for_id_random: Optional[str] # Copied from product record NOPE
product_for_id: Optional[int] # Copied from product record
product_type_id: Optional[int] # Copied from product record
product_name: Optional[str] # Copied from product record
product_unit_price: Optional[int] # Copied from product record
product_recurring: Optional[bool] # Copied from product record
for_person_id: Optional[int]
for_person_id_random: Optional[str]
name: Optional[str] # Should be the same as product_name above
quantity: int = Field(0, ge=0, lt=150)
amount: int = Field(0, ge=0, lt=1500000)
recurring: Optional[bool] = False
recurring_period: Optional[int]
message: Optional[str]
notes: Optional[str]
_processed_at: datetime.datetime = PrivateAttr(default_factory=datetime.datetime.now)
class Config:
underscore_attrs_are_private = True
allow_population_by_field_name = True
Order_Line_Base.update_forward_refs()