示例#1
0
    def body(self):
        """
            return the body of the email
        """
        status_verb = get_status_verb(self.new_status)

        # If the document is validated, we directly send the link to the pdf
        # file
        if self.new_status == 'valid':
            query_args = dict(view="pdf")
        else:
            query_args = {}

        addr = self.request.route_url(
                    self.document.type_,
                    id=self.document.id,
                    _query=query_args,
                    )
        addr = format_link(self.settings, addr)

        docnumber = self.document.number.lower()
        customer = self.document.customer.name.capitalize()
        project = self.document.project.name.capitalize()
        if self.document.is_invoice():
            docname = u"La facture"
            gender = u"e"
            determinant = u"la"
        elif self.document.is_cancelinvoice():
            docname = u"L'avoir"
            gender = u""
            determinant = u"le"
        else:
            docname = u"Le devis"
            gender = u""
            determinant = u"le"
        if self.document.statusComment:
            comment = self.document.statusComment
        else:
            comment = u"Aucun"

        username = render_api.format_account(self.document.owner, reverse=False)
        return MAIL_TMPL.format(
                determinant=determinant,
                username=username,
                docname=docname,
                docnumber=docnumber,
                customer=customer,
                project=project,
                status_verb=status_verb,
                gender=gender,
                addr=addr,
                comment=comment)
示例#2
0
    def body(self):
        """
            return the body of the email
        """
        status_verb = get_status_verb(self.new_status)

        # If the document is validated, we directly send the link to the pdf
        # file
        if self.new_status == 'valid':
            query_args = dict(view="pdf")
        else:
            query_args = {}

        addr = self.request.route_url(
            self.document.type_,
            id=self.document.id,
            _query=query_args,
        )
        addr = format_link(self.settings, addr)

        docnumber = self.document.internal_number.lower()
        customer = self.document.customer.name.capitalize()
        project = self.document.project.name.capitalize()
        if self.document.is_invoice():
            docname = u"La facture"
            gender = u"e"
            determinant = u"la"
        elif self.document.is_cancelinvoice():
            docname = u"L'avoir"
            gender = u""
            determinant = u"le"
        else:
            docname = u"Le devis"
            gender = u""
            determinant = u"le"
        if self.document.statusComment:
            comment = self.document.statusComment
        else:
            comment = u"Aucun"

        username = render_api.format_account(self.document.owner,
                                             reverse=False)
        return MAIL_TMPL.format(determinant=determinant,
                                username=username,
                                docname=docname,
                                docnumber=docnumber,
                                customer=customer,
                                project=project,
                                status_verb=status_verb,
                                gender=gender,
                                addr=addr,
                                comment=comment)
示例#3
0
    def body(self):
        """
            return the body of the email
        """
        owner = format_account(self.expense.user)
        date = u"{0}/{1}".format(self.expense.month, self.expense.year)
        status_verb = get_status_verb(self.new_status)
        addr = self.request.route_url("expensesheet", id=self.expense.id)
        addr = format_link(self.settings, addr)

        return MAIL_TMPL.format(
            owner=owner,
            addr=addr,
            date=date,
            status_verb=status_verb,
            comment=self.comment,
        )
示例#4
0
    def body(self):
        """
            return the body of the email
        """
        owner = format_account(self.expense.user)
        date = u"{0}/{1}".format(self.expense.month, self.expense.year)
        status_verb = get_status_verb(self.new_status)
        addr = self.request.route_url("expensesheet", id=self.expense.id)
        addr = format_link(self.settings, addr)

        return MAIL_TMPL.format(
            owner=owner,
            addr=addr,
            date=date,
            status_verb=status_verb,
            comment=self.comment,
        )