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)
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)
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)
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
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
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
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
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()
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