feat: total services amount and recalculating
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from sqlalchemy import Table, Column, Integer, ForeignKey, ForeignKeyConstraint, UniqueConstraint
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.orm import relationship, mapped_column, Mapped
|
||||
|
||||
from models.base import BaseModel
|
||||
|
||||
@@ -41,6 +41,7 @@ class DealService(BaseModel):
|
||||
|
||||
quantity = Column(Integer, nullable=False, comment='Кол-во услуги')
|
||||
price = Column(Integer, nullable=False, server_default='0', comment='Цена услуги')
|
||||
is_fixed_price: Mapped[bool] = mapped_column(default=False, server_default='0', comment='Фиксированная цена')
|
||||
|
||||
employees = relationship('User', secondary=deal_service_employees)
|
||||
|
||||
@@ -59,6 +60,8 @@ class DealProductService(BaseModel):
|
||||
|
||||
price = Column(Integer, nullable=False, comment='Цена услуги')
|
||||
|
||||
is_fixed_price: Mapped[bool] = mapped_column(default=False, server_default='0', comment='Фиксированная цена')
|
||||
|
||||
deal_product = relationship('DealProduct',
|
||||
back_populates='services',
|
||||
primaryjoin="and_(DealProductService.deal_id == DealProduct.deal_id, "
|
||||
@@ -114,4 +117,3 @@ barcode_template_attribute_link = Table(
|
||||
Column('barcode_template_id', ForeignKey('barcode_templates.id')),
|
||||
Column('attribute_id', ForeignKey('barcode_template_attributes.id'))
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user