当前位置: 首页>>代码示例>>Python>>正文


Python tva.Tva类代码示例

本文整理汇总了Python中autonomie.models.tva.Tva的典型用法代码示例。如果您正苦于以下问题:Python Tva类的具体用法?Python Tva怎么用?Python Tva使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Tva类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: submit_success

    def submit_success(self, appstruct):
        if 'amount' in appstruct:
            appstruct['tva_id'] = Tva.by_value(
                self.context.get_tvas().keys()[0]
            ).id
            self.context.record_payment(
                user_id=self.request.user.id,
                **appstruct
            )
        elif 'tvas' in appstruct:
            appstruct.pop('payment_amount')
            # si on a plusieurs tva :
            for tva_payment in appstruct['tvas']:
                bank_remittance_id = appstruct['bank_remittance_id']
                tva_payment['bank_remittance_id'] = bank_remittance_id
                tva_payment['date'] = appstruct['date']
                tva_payment['mode'] = appstruct['mode']
                tva_payment['bank_id'] = appstruct.get('bank_id')
                tva_payment['resulted'] = appstruct.get('resulted', False)
                self.context.record_payment(
                    user_id=self.request.user.id,
                    **tva_payment
                )

        self.request.dbsession.merge(self.context)
        self.notify()
        return self.redirect()
开发者ID:CroissanceCommune,项目名称:autonomie,代码行数:27,代码来源:invoice.py

示例2: submit_success

    def submit_success(self, appstruct):
        """
            fired on submit success, set Tvas
        """
        # First we disable the elements that are no longer part of the
        # configuration
        self.disable_elements(Product, self.get_remaining_prod_ids(appstruct))
        self.disable_elements(Tva, self.get_remaining_tva_ids(appstruct))
        self.dbsession.flush()

        for data in appstruct['tvas']:
            products = data.pop('products')
            if 'id' in data:
                tva = Tva.get(data['id'])
                merge_session_with_post(tva, data)
                tva = self.dbsession.merge(tva)
            else:
                tva = Tva()
                merge_session_with_post(tva, data)
                self.dbsession.add(tva)

            for prod in products:
                if 'id' in prod:
                    product = Product.get(prod['id'])
                    product.tva = tva
                    merge_session_with_post(product, prod)
                    self.dbsession.merge(product)
                else:
                    product = Product()
                    merge_session_with_post(product, prod)
                    product.tva = tva
                    self.dbsession.add(product)
        self.request.session.flash(self.validation_msg)
        return HTTPFound(self.request.route_path("admin_tva"))
开发者ID:yledoare,项目名称:autonomie,代码行数:34,代码来源:admin.py

示例3: __call__

 def __call__(self):
     for tva in Tva.query(include_inactive=True):
         tva.default = False
         self.request.dbsession.merge(tva)
     self.context.default = True
     self.request.dbsession.merge(tva)
     return HTTPFound(TVA_URL)
开发者ID:CroissanceCommune,项目名称:autonomie,代码行数:7,代码来源:tva.py

示例4: has_tva_default_validator

def has_tva_default_validator(node, value):
    """
    Validator for tva uniqueness
    """
    from autonomie.models.tva import Tva
    if Tva.get_default() is None and not value:
        raise colander.Invalid(node, TVA_NO_DEFAULT_SET_MSG)
开发者ID:CroissanceCommune,项目名称:autonomie,代码行数:7,代码来源:__init__.py

示例5: pre_paid_process

    def pre_paid_process(self, task, status, params):
        """
            Validate a payment form's data
        """
        form = get_paid_form(self.request)
        # We don't try except on the data validation, since this is done in the
        # original wrapping call (see taskaction set_status)
        appstruct = form.validate(params.items())

        if 'amount' in appstruct:
            # Les lignes de facture ne conservent pas le lien avec les objets
            # Tva, ici on en a une seule, on récupère l'objet et on le set sur
            # le amount
            appstruct['tva_id'] = Tva.by_value(
                self.context.get_tvas().keys()[0]
            ).id

        elif 'tvas' in appstruct:
            # Ce champ ne servait que pour tester las somme des valeurs saisies
            appstruct.pop('payment_amount')
            # si on a plusieurs tva :
            for tva_payment in appstruct['tvas']:
                remittance_amount = appstruct['remittance_amount']
                tva_payment['remittance_amount'] = remittance_amount
                tva_payment['date'] = appstruct['date']
                tva_payment['mode'] = appstruct['mode']
                tva_payment['bank_id'] = appstruct.get('bank_id')
                tva_payment['resulted'] = appstruct.get('resulted', False)
        else:
            raise Exception(u"On a rien à faire ici")

        logger.debug(u"In pre paid process")
        logger.debug(u"Returning : {0}".format(appstruct))
        return appstruct
开发者ID:Orelab,项目名称:autonomie,代码行数:34,代码来源:invoice.py

示例6: before

    def before(self, form):
        BaseFormView.before(self, form)
        self.request.actionmenu.add(
            ViewLink(
                label=u"Revenir à la facture",
                path="/invoices/{id}.html",
                id=self.context.id,
                _anchor="payment",
            )
        )

        appstruct = []
        for tva_value, value in self.context.topay_by_tvas().items():
            tva = Tva.by_value(tva_value)
            appstruct.append(
                {
                    'tva_id': tva.id,
                    'amount': floor_to_precision(
                        value,
                        precision=2,
                        dialect_precision=5
                    )
                }
            )

        if len(appstruct) == 1:
            form.set_appstruct(appstruct[0])
        else:
            form.set_appstruct({'tvas': appstruct})
开发者ID:CroissanceCommune,项目名称:autonomie,代码行数:29,代码来源:invoice.py

示例7: task_options_json

def task_options_json(request):
    """
        Returns the task form options as a dict
    """
    options = dict()
    options['tvas'] = dict((tva.value, tva.__json__(request)) \
            for tva in Tva.query().all())
    return options
开发者ID:w3bcr4ft,项目名称:autonomie,代码行数:8,代码来源:taskaction.py

示例8: _populate_expenses

    def _populate_expenses(self):
        """
            Add the expenses to our object
        """
        if self.invoice.expenses > 0 or self.invoice.expenses_ht > 0:
            if self.expense_tva_compte_cg is None:
                self.expense_tva_compte_cg = Tva.get_default().compte_cg
                self.expense_tva_code = Tva.get_default().code

            prod = self.get_product(
                        self.compte_cgs["compte_frais_annexes"],
                        self.expense_tva_compte_cg,
                        self.expense_tva_code
                        )
            ht_expense = self.invoice.get_expense_ht()
            ttc_expense = self.invoice.expenses_amount()
            prod['tva'] = ht_expense.tva_amount()
            prod['ht'] = ttc_expense + ht_expense.total_ht()
开发者ID:mike-perdide,项目名称:autonomie,代码行数:18,代码来源:sage.py

示例9: get_default_tva

def get_default_tva():
    """
        Return the default tva
    """
    default_tva = Tva.get_default()
    if default_tva:
        return default_tva.value
    else:
        return 1960
开发者ID:mike-perdide,项目名称:autonomie,代码行数:9,代码来源:task.py

示例10: deferred_default_tva

def deferred_default_tva(node, kw):
    """
        return a tva widget
    """
    default_tva = Tva.get_default()
    if default_tva is not None:
        return unicode(default_tva.value)
    else:
        return colander.null
开发者ID:yledoare,项目名称:autonomie,代码行数:9,代码来源:task.py

示例11: json_tvas

def json_tvas(request):
    """
    Return the tva objects available for this form

    :param obj request: The current request object
    :returns: List of Tva objects in their json repr
    """
    query = Tva.query()
    return [item.__json__(request) for item in query]
开发者ID:CroissanceCommune,项目名称:autonomie,代码行数:9,代码来源:utils.py

示例12: more_template_vars

 def more_template_vars(self, result):
     result['nodata_msg'] = u"Aucun taux de TVA n'a été configuré"
     if result['items']:
         if Tva.get_default() is None:
             result['warn_msg'] = (
                 u"Aucun taux de TVA par défaut n'a été configuré. "
                 u"Des problèmes peuvent être rencontrés lors de "
                 u"l'édition de devis/factures."
             )
     return result
开发者ID:CroissanceCommune,项目名称:autonomie,代码行数:10,代码来源:tva.py

示例13: company_products_options_ajax_view

def company_products_options_ajax_view(context, request):
    """
    The view for company products options load

    :param obj context: The context : The company object
    :param obj request: the Pyramid's request object
    """
    return dict(
        tvas=Tva.query().all(),
        unities=WorkUnit.query().all()
    )
开发者ID:Orelab,项目名称:autonomie,代码行数:11,代码来源:sale_product.py

示例14: validate_amount_by_tva

    def validate_amount_by_tva(values):
        tva_id = values.get('tva_id')
        tva = Tva.get(tva_id)
        if tva is None:
            return u"Tva inconnue"
        amount = values.get('amount')
        # Fix #433 : encaissement et tva multiples
        # Add a tolerance for 5 € of difference
        if amount > tva_parts[tva.value] + PAYMENT_EPSILON:
            return u"Le montant de l'encaissement doit être inférieur à la \
part de cette Tva dans la facture"
        return True
开发者ID:CroissanceCommune,项目名称:autonomie,代码行数:12,代码来源:invoice.py

示例15: get_default_tva

def get_default_tva():
    """
        Return the default tva
    """
    try:
        default_tva = Tva.get_default()
    except:
        default_tva = None

    if default_tva:
        return default_tva.value
    else:
        return 1960
开发者ID:w3bcr4ft,项目名称:autonomie,代码行数:13,代码来源:task.py


注:本文中的autonomie.models.tva.Tva类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。