Skip to content

Commit

Permalink
VAT number correction
Browse files Browse the repository at this point in the history
Update #31
  • Loading branch information
mwolff44 committed Nov 5, 2014
1 parent 09a4d04 commit 2f1d342
Show file tree
Hide file tree
Showing 6 changed files with 2,040 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyfreebill/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class CompanyAdmin(admin.ModelAdmin):

search_fields = ['^name', ]
prepopulated_fields = {'slug': ('name',)}
readonly_fields = ('customer_balance', 'supplier_balance')
readonly_fields = ('customer_balance', 'supplier_balance', 'vat_number_validated')
fieldsets = (
('General', {
'fields': (('name', 'nickname'),
Expand Down
677 changes: 677 additions & 0 deletions pyfreebill/migrations/0066_auto__add_taxes__add_services.py

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions pyfreebill/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ class Meta:
verbose_name = _(u"Company")
verbose_name_plural = _(u"Companies")

def clean(self):
if self.vat_number:
try:
vatnumber.check_vies(self.vat_number)
except Exception, e:
raise ValidationError("""Wrong VAT number - validation made throw VIES services. %s""") % e

def save(self, *args, **kwargs):
if self.vat_number:
try:
Expand Down
7 changes: 4 additions & 3 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@ django-system-monitor==0.5
django-tables2==0.15.0
django-templated-email==0.4.9
GeoIP==1.3.2
netaddr==0.7.12
netaddr>=0.7.12
netifaces==0.10.4
psutil==2.1.1
psutil>=2.1.1
psycopg2==2.5.4
python-memcached==1.53
raven>=3
requests==2.4.0
pytz>=2014.4
suds>=0.4
switch2bill-common==2.8.5
vatnumber>=1.2
wsgiref==0.1.2
yawd-admin==0.7.0
vatnumber>=1.2

0 comments on commit 2f1d342

Please sign in to comment.