diff --git a/models/secondary.py b/models/secondary.py
index 6b50710..a4f04cd 100644
--- a/models/secondary.py
+++ b/models/secondary.py
@@ -1,4 +1,4 @@
-from sqlalchemy import Table, Column, Integer, ForeignKey, ForeignKeyConstraint, UniqueConstraint
+from sqlalchemy import Table, Column, Integer, ForeignKey, ForeignKeyConstraint, UniqueConstraint, String
from sqlalchemy.orm import relationship, mapped_column, Mapped
from models.base import BaseModel
@@ -90,6 +90,7 @@ class DealProduct(BaseModel):
deal_id = Column(Integer, ForeignKey('deals.id'), primary_key=True, nullable=False, comment='ID Сделки')
product_id = Column(Integer, ForeignKey('products.id'), primary_key=True, nullable=False, comment='ID Продукта')
quantity = Column(Integer, nullable=False, comment='Кол-во продукта')
+ comment = Column(String, nullable=False, server_default='', comment='Комментарий к товару')
deal = relationship('Deal',
back_populates='products',
diff --git a/schemas/deal.py b/schemas/deal.py
index eb1e0ff..8185531 100644
--- a/schemas/deal.py
+++ b/schemas/deal.py
@@ -70,6 +70,7 @@ class DealProductSchema(BaseSchema):
product: ProductSchema
services: List[DealProductServiceSchema]
quantity: int
+ comment: str = ""
class DealStatusHistorySchema(BaseSchema):
diff --git a/services/deal.py b/services/deal.py
index bfecf8f..fc21ce7 100644
--- a/services/deal.py
+++ b/services/deal.py
@@ -470,7 +470,8 @@ class DealService(BaseService):
deal_product = models.secondary.DealProduct(
deal_id=new_deal.id,
product_id=old_deal_product.product.id,
- quantity=old_deal_product.quantity
+ quantity=old_deal_product.quantity,
+ comment=old_deal_product.comment,
)
self.session.add(deal_product)
await self.session.flush()
@@ -935,6 +936,7 @@ class DealService(BaseService):
# Updating product
deal_product.quantity = request.product.quantity
+ deal_product.comment = request.product.comment
# Updating deleting old employees
delete_stmt = (
diff --git a/templates/documents/deal/deal-product-services.html b/templates/documents/deal/deal-product-services.html
index df17bf2..27319e3 100644
--- a/templates/documents/deal/deal-product-services.html
+++ b/templates/documents/deal/deal-product-services.html
@@ -79,6 +79,22 @@
{% endif %}
+
+ {% if product_data.deal_products|length == 1 and common_deal_product.comment %}
+
+
+
+ | Комментарий |
+
+
+
+
+ | {{ common_deal_product.comment }} |
+
+
+
+ {% endif %}
+
{% if common_deal_product.services|length > 0 %}
@@ -144,6 +160,14 @@
| {{ deal_product.quantity }} |
|
+ {% if deal_product.comment %}
+
+
+ |
+ Комментарий: {{ deal_product.comment }}
+ |
+
+ {% endif %}
{% endfor %}