Skip to content

Commit

Permalink
rel #132 party_iva_condition versiones <= 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
lukio committed Dec 23, 2019
1 parent 98d41cb commit b215295
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,19 +787,9 @@ def _credit(self):

@classmethod
def set_number(cls, invoices):
super(Invoice, cls).set_number(invoices)

for invoice in invoices:
# Posted and paid invoices are tested by check_modify so we can
# not modify tax_identifier nor number
if invoice.state in {'posted', 'paid'}:
continue
# Generated invoice may not fill the party iva_condition
if not invoice.party_iva_condition and invoice.type == 'out':
invoice.party_iva_condition = invoice.party.iva_condition
cls.save(invoices)

def get_next_number(self, pattern=None):
'''
Set number to the invoice
'''
pool = Pool()
Period = pool.get('account.period')
SequenceStrict = pool.get('ir.sequence.strict')
Expand All @@ -813,6 +803,9 @@ def get_next_number(self, pattern=None):
continue
if not invoice.tax_identifier:
invoice.tax_identifier = invoice.get_tax_identifier()
# Generated invoice may not fill the party iva_condition
if not invoice.party_iva_condition and invoice.type == 'out':
invoice.party_iva_condition = invoice.party.iva_condition

if invoice.number:
continue
Expand Down

0 comments on commit b215295

Please sign in to comment.