コード例 #1
0
ファイル: task.py プロジェクト: lluc/autonomie
 def deposit_amounts(self):
     """
         Return the lines of the deposit for the different amount of tvas
     """
     ret_dict = {}
     for tva, total_ht in self.tva_ht_parts().items():
         ret_dict[tva] = self.floor(
             math_utils.percentage(total_ht, self.deposit))
     return ret_dict
コード例 #2
0
ファイル: task.py プロジェクト: CroissanceCommune/autonomie
 def deposit_amounts(self):
     """
         Return the lines of the deposit for the different amount of tvas
     """
     ret_dict = {}
     for tva, total_ht in self.tva_ht_parts().items():
         ret_dict[tva] = self.floor(
             math_utils.percentage(total_ht, self.deposit)
         )
     return ret_dict
コード例 #3
0
ファイル: rest_api.py プロジェクト: tonthon/autonomie
    def post_percent_discount_view(self):
        """
        View handling percent discount configuration

        Generates discounts for each tva used in this document

        current context : Invoice/Estimation/CancelInvoice
        """
        percent = self.request.json_body.get('percentage')
        description = self.request.json_body.get('description')
        lines = []
        if percent is not None and description is not None:
            tva_parts = self.context.tva_ht_parts()
            for tva, ht in tva_parts.items():
                amount = percentage(ht, percent)
                line = DiscountLine(description=description,
                                    amount=amount,
                                    tva=tva)
                lines.append(line)
                self.context.discounts.append(line)
            self.request.dbsession.merge(self.context)
        return lines
コード例 #4
0
    def post_percent_discount_view(self):
        """
        View handling percent discount configuration

        Generates discounts for each tva used in this document

        current context : Invoice/Estimation/CancelInvoice
        """
        percent = self.request.json_body.get('percentage')
        description = self.request.json_body.get('description')
        lines = []
        if percent is not None and description is not None:
            tva_parts = self.context.tva_ht_parts()
            for tva, ht in tva_parts.items():
                amount = percentage(ht, percent)
                line = DiscountLine(
                    description=description,
                    amount=amount,
                    tva=tva
                )
                lines.append(line)
                self.context.discounts.append(line)
            self.request.dbsession.merge(self.context)
        return lines
コード例 #5
0
 def get_amount(self, product):
     """
         Return the amount for the current module
         (the same for credit or debit)
     """
     return percentage(product['ht'], self.get_contribution())
コード例 #6
0
 def _amount_method(a, b):
     return percentage(a, b)
コード例 #7
0
 def _get_contribution_amount(self, ht):
     """
     Return the contribution on the HT total
     """
     return percentage(ht, self.get_contribution())
コード例 #8
0
 def test_percentage(self):
     # Ref #32
     a = 0.25
     b = 10000
     self.assertEqual(percentage(a, b), 25)
コード例 #9
0
ファイル: sage.py プロジェクト: Orelab/autonomie
 def get_amount(self, product):
     """
         Return the amount for the current module
         (the same for credit or debit)
     """
     return percentage(product['ht'], self.get_contribution())
コード例 #10
0
ファイル: sage.py プロジェクト: Orelab/autonomie
 def _amount_method(a, b):
     return percentage(a, b)
コード例 #11
0
ファイル: sage.py プロジェクト: Orelab/autonomie
 def _get_contribution_amount(self, ht):
     """
     Return the contribution on the HT total
     """
     return percentage(ht, self.get_contribution())
コード例 #12
0
ファイル: test_math_utils.py プロジェクト: w3bcr4ft/autonomie
 def test_percentage(self):
     # Ref #32
     a = 0.25
     b = 10000
     self.assertEqual(percentage(a, b), 25)