Exemplo n.º 1
0
 def test_duplicate(self):
     line = PaymentLine(**PAYMENT_LINE)
     dline = line.duplicate()
     for i in ('rowIndex', 'description', 'amount'):
         self.assertEqual(getattr(line, i), getattr(dline, i))
     today = datetime.date.today()
     self.assertEqual(dline.paymentDate, today)
Exemplo n.º 2
0
 def test_duplicate(self):
     line = PaymentLine(**PAYMENT_LINE)
     dline = line.duplicate()
     for i in ("rowIndex", "description", "amount"):
         self.assertEqual(getattr(line, i), getattr(dline, i))
     today = datetime.date.today()
     self.assertEqual(dline.paymentDate, today)
Exemplo n.º 3
0
 def test_duplicate(self):
     line = PaymentLine(**PAYMENT_LINE)
     dline = line.duplicate()
     for i in ('order', 'description', 'amount'):
         self.assertEqual(getattr(line, i), getattr(dline, i))
     today = datetime.date.today()
     self.assertEqual(dline.paymentDate, today)
Exemplo n.º 4
0
 def _more_init_attributes(self, estimation, appstruct):
     """
     Add Estimation's specific attribute while adding this task
     """
     estimation.payment_lines = [PaymentLine(description='Solde', amount=0)]
     estimation.initialize_business_datas()
     return estimation
Exemplo n.º 5
0
 def _more_init_attributes(self, estimation, appstruct):
     """
     Add Estimation's specific attribute while adding this task
     """
     estimation.course = appstruct['course']
     estimation.payment_lines = [PaymentLine(description='Solde', amount=0)]
     return estimation
Exemplo n.º 6
0
def add_lines_to_estimation(task, appstruct):
    """
        Add the lines to the current estimation
    """
    task.default_line_group.lines = []
    task.line_groups = [task.default_line_group]
    task.discounts = []
    task.payment_lines = []

    for line in appstruct['payment_lines']:
        task.payment_lines.append(PaymentLine(**line))

    for group in appstruct['groups']:
        lines = group.pop('lines', [])
        group = TaskLineGroup(**group)
        for line in lines:
            group.lines.append(TaskLine(**line))
        task.line_groups.append(group)

    for line in appstruct['lines']:
        task.default_line_group.lines.append(TaskLine(**line))

    for line in appstruct.get('discounts', []):
        task.discounts.append(DiscountLine(**line))

    return task
Exemplo n.º 7
0
def estimation():
    est = Estimation(**ESTIMATION)
    for line in LINES:
        est.lines.append(EstimationLine(**line))
    for line in DISCOUNTS:
        est.discounts.append(DiscountLine(**line))
    for line in PAYMENT_LINES:
        est.payment_lines.append(PaymentLine(**line))
    return est
Exemplo n.º 8
0
 def _before(self):
     """
     Ensure some stuff on the current context
     """
     if not self.context.payment_lines:
         self.context.payment_lines = [
             PaymentLine(description='Solde', amount=self.context.ttc)
         ]
         self.request.dbsession.merge(self.context)
         self.request.dbsession.flush()
Exemplo n.º 9
0
def estimation(project, user, customer, company, phase):
    est = Estimation(
        company,
        customer,
        project,
        phase,
        user,
    )
    for key, value in ESTIMATION.items():
        setattr(est, key, value)
    for line in LINES:
        est.add_line(TaskLine(**line))
    for line in DISCOUNTS:
        est.discounts.append(DiscountLine(**line))
    for line in PAYMENT_LINES:
        est.payment_lines.append(PaymentLine(**line))
    est.mentions = [
        TaskMention(label='mention1', title='title1', full_text='text1')
    ]
    return est