Beispiel #1
0
 def save(self, invoice):
     with transaction():
         self.invoice_issueing_signal.send(invoice)
         save_model(invoice)
     self.invoice_issued_signal.send(invoice)
     if invoice.email and self.options["send_email"]:
         self.send_email(invoice.email, invoice)
 def update_model_vat_rates(self):
     with transaction():
         query = current_app.features.models.query(self.model)
         for country_code in EU_COUNTRIES:
             rate = self.service.get_vat_rate(country_code)
             for obj in query.filter(eu_vat_country=country_code, eu_vat_rate__ne=rate).all():
                 obj.eu_vat_rate = rate
                 self.model_rate_updated_signal.send(obj)
                 save_model(obj)
         self.rates_updated_signal.send(self)