diff --git a/ereuse_devicehub/resources/proof/models.py b/ereuse_devicehub/resources/proof/models.py index ed8bd798..2562b446 100644 --- a/ereuse_devicehub/resources/proof/models.py +++ b/ereuse_devicehub/resources/proof/models.py @@ -137,12 +137,14 @@ class ProofReuse(JoinedTableMixin, Proof): id_receipt = Column(CIText(), default='', nullable=False) supplier_id = db.Column(UUID(as_uuid=True), db.ForeignKey(User.id), - nullable=False, - default=lambda: g.user.id) + # nullable=False, + # default=lambda: g.user.id) + nullable=True) supplier = db.relationship(User, primaryjoin=lambda: ProofReuse.supplier_id == User.id) receiver_id = db.Column(UUID(as_uuid=True), db.ForeignKey(User.id), - nullable=False) + # nullable=False) + nullable=True) receiver = db.relationship(User, primaryjoin=lambda: ProofReuse.receiver_id == User.id) price = Column(db.Integer) diff --git a/ereuse_devicehub/resources/proof/schemas.py b/ereuse_devicehub/resources/proof/schemas.py index a07fc524..de18a41f 100644 --- a/ereuse_devicehub/resources/proof/schemas.py +++ b/ereuse_devicehub/resources/proof/schemas.py @@ -57,8 +57,8 @@ class ProofReuse(Proof): __doc__ = m.ProofReuse.__doc__ receiver_segment = String(default='', data_key='receiverSegment', required=True) id_receipt = String(default='', data_key='idReceipt', required=True) - supplier_id = UUID(load_only=True, required=True, data_key='supplierID') - receiver_id = UUID(load_only=True, required=True, data_key='receiverID') + supplier_id = UUID(load_only=True, required=False, data_key='supplierID') + receiver_id = UUID(load_only=True, required=False, data_key='receiverID') price = Integer(required=True)