Exemplo n.º 1
0
 def testRenegotiated(self):
     branch = self.create_branch(name=u'Branch')
     client = self.create_client(name=u'TestClient')
     renegotiation = PaymentRenegotiation(branch=branch, client=client)
     rows = self.store.find(PaymentRenegotiation, branch_id=branch.id,
                            client=client,
                            status=renegotiation.STATUS_RENEGOTIATED).count()
     self.assertEquals(rows, 0)
     renegotiation.status = renegotiation.STATUS_RENEGOTIATED
     rows = self.store.find(PaymentRenegotiation, branch_id=branch.id,
                            client=client,
                            status=renegotiation.STATUS_RENEGOTIATED).count()
     self.assertEquals(rows, 1)
Exemplo n.º 2
0
 def create_payment_renegotiation(self, group=None):
     from stoqlib.domain.payment.renegotiation import PaymentRenegotiation
     return PaymentRenegotiation(responsible=get_current_user(self.store),
                                 branch=get_current_branch(self.store),
                                 group=group or self.create_payment_group(),
                                 client=self.create_client(),
                                 store=self.store)
Exemplo n.º 3
0
 def testRenegotiation(self):
     branch = self.create_branch(name=u'Branch')
     client = self.create_client(name=u'TestClient')
     rows = self.store.find(PaymentRenegotiation, branch_id=branch.id,
                            client=client).count()
     self.assertEquals(rows, 0)
     PaymentRenegotiation(branch=branch, client=client)
     rows = self.store.find(PaymentRenegotiation, branch_id=branch.id,
                            client=client).count()
     self.assertEquals(rows, 1)
Exemplo n.º 4
0
 def _create_model(self, store):
     value = 0  # will be updated in the first step.
     branch = api.get_current_branch(store)
     user = api.get_current_user(store)
     client = self.groups[0].get_parent().client
     # Set person as None to allow renegotiate payments without client.
     person = None
     if client:
         person = client.person
     group = PaymentGroup(payer=person, store=store)
     model = PaymentRenegotiation(total=value,
                                  branch=branch,
                                  responsible=user,
                                  client=client,
                                  group=group,
                                  store=store)
     return model
Exemplo n.º 5
0
 def renegotiated(self):
     if self.renegotiated_id:
         return PaymentRenegotiation.get(self.renegotiated_id,
                                         store=self.store)
Exemplo n.º 6
0
Arquivo: views.py Projeto: romaia/stoq
 def renegotiated(self):
     if self.renegotiated_id:
         return PaymentRenegotiation.get(self.renegotiated_id,
                                         store=self.store)