def validatePayments(self, document):
     if document == None:
         NotNoneValidator(
             self._label.get('document.invoice')).validate(document)
     for position in document.getPositions():
         if position.getType() == "INVOICE_PAYMENT":
             self.validatePayment(position)
 def validate(self, document):
     self.check(document.getPossession(), [
         NotNoneValidator(
             messageParameter=self._label.get('field.possession'))
     ])
     for position in document.getPositions():
         self.validatePosition(position)
     self.check(document.getPositions(), [NotEmptyDocumentValidator()])
Example #3
0
 def createStatus(self):
     status = CounterStatus()
     self._svars.put('timestamp', self.get('installation'))
     self._svars.put('status', self.get('startStatus'))
     self._svars.put('statusType', self.get('startStatusType'))
     self.mapDate("timestamp", [
         NotNoneValidator(
             messageParameter=self._label.get('field.installation'))
     ], status)
     self.map("status", [
         DecimalValidator(
             messageParameter=self._label.get('field.counterStatus'))
     ], status)
     status.setPredicted(False)
     status.setCounter(self._entity)
     return status
Example #4
0
 def setData(self):
     self.setCommunity()
     self.map("serialNumber", [
         UniqueValidator(
             "Counter",
             "serialNumber",
             messageParameter=self._label.get('field.counterSerialNumber')),
         LengthValidator(
             minLength=1,
             maxLength=255,
             messageParameter=self._label.get('field.counterSerialNumber'))
     ])
     self.map("seal", [
         LengthValidator(
             minLength=1,
             maxLength=255,
             messageParameter=self._label.get('field.counterSeal'))
     ])
     self.mapDate("installation", [
         NotNoneValidator(
             messageParameter=self._label.get('field.installation'))
     ])
     self.mapDictionary(
         "legalization",
         DictionaryValidator(
             dictionary="YEARS",
             messageParameter=self._label.get('field.legalization')))
     if self.get("counterType") == "GLOBAL":
         self.mapDictionary(
             "type",
             DictionaryValidator(
                 dictionary="COUNTERS_TYPES",
                 messageParameter=self._label.get('field.counterType')))
     if self.get("counterType") == "LOCAL":
         self.mapDictionary(
             "parent",
             BindValidator(
                 entity="Counter",
                 messageParameter=self._label.get('field.parentCounter')))
         self.mapDictionary(
             "possession",
             BindValidator(
                 entity="Possession",
                 messageParameter=self._label.get('field.possession')))
         self.getEntity().setType(self.getEntity().getParent().getType())
     self._entity.getStatuses().add(self.createStatus())
 def validatePayment(self, payment):
     self.check(
         payment.getAttribute("CREATE_DATE").getValue(), [
             DateValidator(messageParameter=self._label.get(
                 'validators.invoice.payment.paymentDate'))
         ])
     self.check(payment.getAccount(), [
         NotNoneValidator(messageParameter=self._label.get(
             'validators.invoice.payment.account'))
     ])
     self.check(payment.getValue().floatValue(), [
         DecimalValidator(messageParameter=self._label.get(
             'validators.invoice.payment.value'))
     ])
     self.check(
         payment.getAttribute("COST_ID").getValue(), [
             PositiveIntValidator(messageParameter=self._label.get(
                 'validators.invoice.payment.costType'))
         ])
 def validatePosition(self, position):
     self.check(position.getAccount(), [
         NotNoneValidator(messageParameter=self._label.get('field.account'))
     ])
     self.check(position.getDescription(), [
         NotEmptyValidator(
             messageParameter=self._label.get('field.description'))
     ])
     self.check(position.getClientName(), [
         NotEmptyValidator(
             messageParameter=self._label.get('field.clientName'))
     ])
     self.check(
         position.getAttribute("CREATE_DATE").getValue(), [
             DateValidator(
                 messageParameter=self._label.get('field.createDate'))
         ])
     self.check(
         position.getAttribute("BOOKING_DATE").getValue(), [
             DateValidator(
                 messageParameter=self._label.get('field.bookedDate'))
         ])
 def validateAttributes(self, document):
     self.check(document.getContractor(), [
         NotNoneValidator(messageParameter=self._label.get(
             'validators.invoice.contractor'))
     ])
     self.check(
         document.getAttribute("NUMBER").getValue(), [
             LengthValidator(minLength=1,
                             maxLength=250,
                             messageParameter=self._label.get(
                                 'validators.invoice.number')),
             UniqueInvoiceNumber(document)
         ])
     self.check(
         document.getAttribute("CREATE_DATE").getValue(), [
             DateValidator(messageParameter=self._label.get(
                 'validators.invoice.createDate'))
         ])
     self.check(
         document.getAttribute("PAYMENT_DATE").getValue(), [
             DateValidator(messageParameter=self._label.get(
                 'validators.invoice.paymentDate'))
         ])
Example #8
0
 def replace(self):
     self.map("serialNumber", [
         UniqueValidator(
             "Counter",
             "serialNumber",
             messageParameter=self._label.get('field.counterSerialNumber')),
         LengthValidator(
             minLength=1,
             maxLength=255,
             messageParameter=self._label.get('field.counterSerialNumber'))
     ])
     self.map("seal", [
         LengthValidator(
             minLength=1,
             maxLength=255,
             messageParameter=self._label.get('field.counterSeal'))
     ])
     self.mapDate("installation", [
         NotNoneValidator(
             messageParameter=self._label.get('field.installation'))
     ])
     self.mapDictionary(
         "legalization",
         DictionaryValidator(
             dictionary="YEARS",
             messageParameter=self._label.get('field.legalization')))
     oldCounter = self.findBy("Counter", "serialNumber",
                              "'" + self.get("replacementOf") + "'")
     oldCounter.setDecomission(self._entity.getInstallation())
     self._entity.setCommunity(oldCounter.getCommunity())
     self._entity.setType(oldCounter.getType())
     self._entity.setPossession(oldCounter.getPossession())
     self._entity.setParent(oldCounter.getParent())
     self._entity.setReplacementOf(oldCounter)
     self._entity.getStatuses().add(self.createStatus())
     self.createEndStatus(oldCounter)
     self.mapChildren(oldCounter, self._entity)
 def validate(self, document):
     self.check(document.getPossession(), [NotNoneValidator(messageParameter = self._label.get('validators.rentNote.possession'))])
     self.check(document.getPositions().get(0).getAttribute("ELEMENT_ID"), [NotNoneValidator(messageParameter = self._label.get('validators.rentNote.element'))])
     self.check(document.getPositions().get(0).getValue().floatValue(), [DecimalValidator(messageParameter = self._label.get('field.value'))])
 def validate(self, document):
     self.check(document.getPositions().get(0).getAccount(), [NotNoneValidator(messageParameter = self._label.get('field.accountNumber'))])
     self.check(document.getPositions().get(0).getValue().floatValue(), [DecimalValidator(messageParameter = self._label.get('field.value'))])