first iteration integration with blockchain

This commit is contained in:
jordi.nadeu 2019-12-09 17:24:24 +01:00 committed by nad
parent 8389ffeb54
commit 480afb3b12
3 changed files with 39 additions and 0 deletions

View File

@ -1452,6 +1452,32 @@ class Receive(JoinedTableMixin, ActionWithMultipleDevices):
default=ReceiverRole.Intermediary) default=ReceiverRole.Intermediary)
class ShareDeliveryNote(JoinedTableMixin, ActionWithMultipleDevices):
"""To share a DeliveryNote to between owners."""
# New variables for DeliveryNote
supplier = db.Column() # String, nullable, ...
supplier.comment = """Name of the organization/agent that create DeliveryNote."""
date_delivery_note = db.Column()
date_delivery_note.comment = """Date of note creation."""
# Is the same of lot id??
id_delivery_note = db.Column(UUID(as_uuid=True))
id_delivery_note.comment = """Unique id of lot and delivery note."""
deposit = db.Column()
deposit.comment = """Total amount of deposit devices in Lot."""
address_note = db.Column(UUID(as_uuid=True))
address_note.comment = """Address identifier in the blockchain."""
agent_id = Column(UUID(as_uuid=True),
ForeignKey(Agent.id),
nullable=False,
default=lambda: g.user.individual.id)
class ConfirmDeliveryNote(JoinedTableMixin, ActionWithMultipleDevices):
"""To confirm a DeliveryNote that has been shared."""
pass
class Migrate(JoinedTableMixin, ActionWithMultipleDevices): class Migrate(JoinedTableMixin, ActionWithMultipleDevices):
"""Moves the devices to a new database/inventory. Devices cannot be """Moves the devices to a new database/inventory. Devices cannot be
modified anymore at the previous database. modified anymore at the previous database.

View File

@ -537,6 +537,10 @@ class Receive(ActionWithMultipleDevices):
self.role = ... # type: ReceiverRole self.role = ... # type: ReceiverRole
class ShareDeliveryNote(ActionWithMultipleDevices):
pass
class Migrate(ActionWithMultipleDevices): class Migrate(ActionWithMultipleDevices):
other = ... # type: Column other = ... # type: Column

View File

@ -442,6 +442,15 @@ class Receive(ActionWithMultipleDevices):
role = EnumField(ReceiverRole) role = EnumField(ReceiverRole)
class ShareDeliveryNote(ActionWithMultipleDevices):
__doc__ = m.ShareDeliveryNote.__doc__
supplier = SanitizedStr(validate=Length(max=STR_SIZE), data_key='supplierName')
date_delivery_note = DateTime(data_key='dateDeliveryNote')
deposit = Integer(data_key='depositValue')
address_note = UUID(dump_only=True)
id_delivery_note = UUID(dump_only=True)
class Migrate(ActionWithMultipleDevices): class Migrate(ActionWithMultipleDevices):
__doc__ = m.Migrate.__doc__ __doc__ = m.Migrate.__doc__
other = URL() other = URL()