Example #1
0
 def merge_from(self, other):
     super(InvMovementMeta, self).merge_from(other)
     if getattr(self, 'value_usd', None):
         self.value_usd = Decimal(self.value_usd)
     if hasattr(self, 'timestamp') and (isinstance(self.timestamp, str)
                                        or isinstance(self.timestamp, unicode)):
         self.timestamp = parse_iso_datetime(self.timestamp)
     return self
Example #2
0
 def deserialize(cls, thedict):
     result = super(Purchase, cls).deserialize(thedict)
     if thedict.get('total_gross_weight_kg', None):
         result.total_gross_weight_kg = Decimal(result.total_gross_weight_kg)
     if thedict.get('total_rmb', None):
         result.total_rmb = result.total_rmb
     if thedict.get('timestamp', None):
         result.timestamp = parse_iso_datetime(result.timestamp)
     return result
Example #3
0
 def deserialize(cls, the_dict):
     x = cls().merge_from(the_dict)
     if x.timestamp and not isinstance(x.timestamp, datetime.datetime):
         x.timestamp = parse_iso_datetime(x.timestamp)
     if 'client' in the_dict:
         client = Client.deserialize(the_dict['client'])
         x.client = client
     else:
         x.client = None
     return x
Example #4
0
 def merge_from(self, other):
     super(Sale, self).merge_from(other)
     if getattr(self, 'total_usd', None):
         self.total_usd = Decimal(self.total_usd)
     if getattr(self, 'tax_usd', None):
         self.tax_usd = Decimal(self.tax_usd)
     if hasattr(self, 'timestamp') and (isinstance(self.timestamp, str)
                                        or isinstance(self.timestamp, unicode)):
         self.timestamp = parse_iso_datetime(self.timestamp)
     return self
Example #5
0
 def deserialize(cls, the_dict):
     x = super(cls, TransMetadata).deserialize(the_dict)
     if not isinstance(x.timestamp, datetime.datetime):
         x.timestamp = parse_iso_datetime(x.timestamp)
     return x