Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def post(cls, invoices):
- Move = Pool().get('account.move')#crem un nou registre del Model account.move
- cls.set_number(invoices)#Definim el el numero de les factures
- moves = [] #Declarem l'array moguiments
- for invoice in invoices:
- move = invoice.get_move()
- if move != invoice.move:#Si el moguiment es diferent al moguiment de la factura, el moguiment de la factura el guardarem a una array.
- invoice.move = move
- moves.append(move)
- if invoice.state != 'posted': #Si ed firefent a publicat fem que canvi a oublicat,
- invoice.state = 'posted'
- if moves:#Si tenim moguiments els guardarem i les factures
- Move.save(moves)
- cls.save(invoices) #Guardem les facures
- Move.post([i.move for i in invoices if i.move.state != 'posted'])#Busquem les factures que no etiguin publicades
- reconciled = []#Definim una array
- for invoice in invoices: #Recorrem les factures i les que siguin de tipus output les imprimim i les que siguin reconciliades les guardem a l'array.
- if invoice.type == 'out':
- invoice.print_invoice()
- if invoice.reconciled:
- reconciled.append(invoice)
- if reconciled:#Les que tenim a l'array reconciliades les fiquem al proces.
- cls.__queue__.process(reconciled)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement