Make supplier_id, receiver_id optional for ProofReuse, fixes #21
This commit is contained in:
parent
edf2e39fc7
commit
bc69d194f4
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
Reference in a new issue