Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Guest House
    • Drankenhandelaar
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Solar Energy Systems
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC Services
    Others
    • Nonprofit Organization
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

manual invoice numbering

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
invoicesequence
1 Beantwoorden
12136 Weergaven
Avatar
Ayhan KIZILTAN

How do I enter Invoice Numbers manually?

1
Avatar
Annuleer
Avatar
patrick
Beste antwoord

By default the invoice number is generated. If you want to ad it manually, you have to create a new module, which extends account_invoice, and you override the methods create and/or save.

But it is dangerous to type the invoice numbers manually, because you can forget it, you can skip numbers or use numbers multiple times.

Depending on the reason you want to type the numbers manually, it can already be done, or changed easily. If you can tell us the reason(s), we might be able to help you with it.

Example script:

# -*- coding: UTF-8 -*-
import openerplib
import datetime
import psycopg2

h = "localhost"
db= 'database'
u = "admin"
p = 'password'

h_sql = h
db_sql = db
u_sql = "openerp"
p_sql = "openerp"

line = '-' *45 + '\n'
file_dbo_factuur = 'dbo_Factuur.csv'
file_dbo_factuurregel = 'dbo_Factuurregels.csv'
f_result = 'factuur_Result.txt'
f_error = 'factuur_Error.csv'
file_finance = 'factuur_finance.csv'

invoiceAdded = 0
invoiceRejected = 0

################################################################################
## VARIOUS ROUTINES
################################################################################
def printHeading():
  f_res.write(line)
  dateX = str(datetime.datetime.now())
  f_res.write('-' * 10 + dateX+'\n')

def initConnection(h, db, u, p):
  printHeading()
  f_res.write('Connecting to %s \nuser: %s\ndatabase: %s\n' %(h, u, db))
  return openerplib.get_connection(
    hostname=h, database=db, login=u, password=p)

def addValsToDB(c, m, vals):
  printHeading()
  f_res.write('Adding data to %s\n' %(m))
  print 'Adding data to', m
  model = c.get_model(m)
  result = []
  i = 0
  for v in vals:
    result.append(model.create(v))
    i += 1
    x, y = divmod(i, 100)
    if y == 0:
      f_res.write('Added already %d records to %s\n' %(x*100, m))

  f_res.write('Number of records added: %d\n' %(len(result)))
  return result

def writeData(c, m, ids, vals):
  printHeading()
  f_res.write('Modifying data of model %s with id(s) = %s\n' %(m, ids))
  print 'Modifying data of model', m, 'with id =', ids
  model = c.get_model(m)
  return model.write(ids, vals)
################################################################################
## SCRIPT SPECIFIC ROUTINE(S)
################################################################################
def addInvoice(c, factuur, lines):
  global invoiceAdded
  global invoiceRejected

  #check invoice itself
  factuur_split = factuur.split(';')
  m = 'account.invoice'
  vals = []

# do your checks

  if sjoemel: #so old order
    resOrder = order_obj.onchange_partner_id(0, partner)['value']

    origin = 'Factuur %s, van order voor 2013' %(factuur_split[2])
    currency = factuur_split[9]
    if currency == '1': # Euro
      pass
    elif currency == '6': # USD
      currency = '3'
    elif currency == '7': # GBP
      currency = '152'

    fiscal = resOrder['fiscal_position']
    reference = factuur_split[30]
    user = 1 #fixed to admin
    payment = resOrder['payment_term']
    comment = factuur_split[13]

  else: #order uit 2013
    origin = order['name']
    currency = order['currency_id'][0]
    partner = order['partner_id'][0]
    if order['fiscal_position'] == False:
      fiscal = False
    else:
      fiscal = order['fiscal_position'][0]
    reference = order['client_order_ref']
    user = order['user_id'][0]
    payment = order['payment_term'][0]
    comment = order['note']

  agent = klant_agent.get(partner, False)
  agent_code = agent_id_code.get(agent, '')

  klant = partner_obj.read(partner)
  hb_inkoop_org = klant['hb_inkoop_org']

  vals.append({
    'origin': origin,
    'date_due': factuur_split[30],
    'check_total': 0.0,
    'partner_bank_id': False,
    'supplier_invoice_number': False,
    'paypal_url': False,
    'company_id': 1,
    'currency_id': currency,
    'partner_id': partner,
    'fiscal_position': fiscal,
    'user_id': user,
    'reference': reference,
    'message_is_follower': False,
    'payment_term': payment,
    'reference_type': 'none',
    'journal_id': 11,
    'account_id': 166,
    'type': 'out_invoice',
    'internal_number': 'Q:%s' %(factuur_split[2]),
    'reconciled': False,
    'move_name': '/',
    'section_id': False,
    'date_invoice': factuur_split[3],
    'name': factuur_split[29], #? 
    'comment': comment,
    'sent': False,
    'agent_id': agent,
    'agent_code': agent_code,
    'message_unread': False,
  })

  invoiceID = addValsToDB(connection, m, vals)[0]

  # add the various lines to the invoice.
  vals = []
  m = 'account.invoice.line'

  invoice_line_tax_id = []
  if fiscal == 1: #NL
    invoice_line_tax_id = [2]
#  elif fiscal == 2: # EU
  elif fiscal == 3: # EU
    invoice_line_tax_id = [15]
#  elif fiscal == 3: # Non EU
  elif fiscal == 4: # Non EU
    invoice_line_tax_id = [12]
  else:
    invoice_line_tax_id = [2]

  for line_split in resFactLines:
    orderlineOld = line_split[13]
    if orderlineOld:
      orderlineID = old_orderline_obj.search([('orderline_id', '=', line_split[3])])
      orderline = old_orderline_obj.read(orderlineID)[0]
      product = prod_obj.read(int(orderline['product_id']))
    else:
      orderlineID = orderline_obj.search([('hb_id_q', '=', line_split[3])])
      orderLine = orderline_obj.read(orderlineID)[0]
      product = prod_obj.read(orderLine['product_id'][0])

    priceArticle = float(line_split[6])

    vals.append({
    'origin': origin,
    'uos_id': 1,
    'asset_category_id': False,
    'account_id': 458,
    'name': product['name'],
    'sequence': 5,
    'invoice_id': invoiceID,
    'price_unit': priceArticle, 
     'company_id': 1,
    'invoice_line_tax_id': [[6, 0, invoice_line_tax_id]],
    'discount': line_split[4],
    'account_analytic_id': False,
    'quantity': line_split[5],
    'partner_id': partner,
    'product_id': product['id'],
  })

  factuurLineIDs = addValsToDB(connection, m, vals)

  # Validate invoice
  context = {}
  context['active_ids'] = [invoiceID]
  x = factuur_confirm_obj.invoice_confirm([invoiceID], context)

#start of script
f_factuur = open(file_dbo_factuur, 'r')
f_fout = open(f_error, 'a')
f_res = open(f_result, 'a')
startTime = str(datetime.datetime.now())
print startTime
f_fout.write('error code;Omschrijving;factuur;factuurID;order;orderregel\n')

#finance
f_fin = open(file_finance, 'w+')
f_fin.write('Factuur Q;bedrag Q;Factuur openERP;bedrag openERP;verschil (Q - OpenERP)\n')

connection = initConnection(h, db, u, p)
f_res.write('Connecting with SQL:\nuser: %s\ndatabase: %s\n' %(u_sql, db_sql))
conn_string = "dbname='%s' user='%s' password='%s'" %(db_sql, u_sql, p_sql)
conn_sql = psycopg2.connect(conn_string)
cursor = conn_sql.cursor()

# search partners with agent
statement = "select partner_id, agent_id from res_partner_agent"
klant_agent = {}
cursor.execute(statement)
result = cursor.fetchall()
for r in result:
    klant_agent[r[0]] = r[1]

statement = "select hb_id_q, id from res_partner"
partner_Q_id = {}
cursor.execute(statement)
result = cursor.fetchall()
for r in result:
    partner_Q_id[r[0]] = r[1]

f_factuur = open(file_dbo_factuur_nw, 'r')
f_factuurline = open(file_dbo_factuurregel, 'r')
# get rid of the headings
header_f = f_factuur.readline()
header_l = f_factuurline.readline()
# get the first entry of the factuurline
line_factuur = f_factuurline.readline()
numberOfLines = 1 #because of line above

factuur_obj = connection.get_model('account.invoice')
factuurline_obj = connection.get_model('account.invoice.line')
order_obj = connection.get_model('sale.order')
orderline_obj = connection.get_model('sale.order.line')
prod_obj = connection.get_model('product.product')
old_order_obj = connection.get_model('hb.order')
old_orderline_obj = connection.get_model('hb.order.line')
partner_obj = connection.get_model('res.partner')
#nodig om facturen te bevestigen....
factuur_confirm_obj = connection.get_model('account.invoice.confirm')

partner_q_id = {}
statement = "select hb_id_q, id from res_partner where customer = True"
cursor.execute(statement)
result = cursor.fetchall()
for r in result:
  partner_q_id[r[0]] = r[1]

partner_id_obj = {}

s = ''
numberOfRecords = 0

for factuur in f_factuur:
  lines = []

  numberOfRecords += 1
  factuur_result = factuur.split(';')
  if len(factuur_result) != lengte_f:
    print 'Factuur niet goede lengte. %s' %(factuur)
    continue
  s = factuur

  while s:
      if line_factuur == '\n': # end of file
        if len(lines) > 0:
          result = addInvoice(connection, s, lines)
        print 'Einde, wegens alleen \\n'
        break

      if line_factuur == '': # end of file?!
        if len(lines) > 0:
          result = addInvoice(connection, s, lines)
        print 'Einde, wegens lege regel'
        break

      if line_factuur == '\r\n': # zou niet mogen!
        print line_factuur
        print line_result

      line_result = line_factuur.replace('\n','').split(';')

      if factuur_result[0] < line_result[2]: #order lines later than order
        if len(lines) > 0:
          result = addInvoice(connection, s, lines)
        else:
          f_fout.write('06;Factuur %s zonder regels\n' %(factuur_result[0]))
        break

      if factuur_result[0] == line_result[2]: # order line part of order
        lines.append(line_factuur)

      line_factuur = f_factuurline.readline()
      numberOfLines += 1

  s = ''

print line
print 'Records:', numberOfRecords
print 'Lines  :', numberOfLines
print 'Invoices made in openERP:', invoiceAdded
print 'Invoices rejected by openERP:', invoiceRejected
print line

f_res.write(line+'\n')
f_res.write('Invoices read: %d\n' %(numberOfRecords))
f_res.write('Invoicelines read: %d\n' %(numberOfLines))
f_res.write('Invoices made in openERP: %d\n' %(invoiceAdded))
f_res.write('Invoices rejected by openERP: %d\n' %(invoiceRejected))
f_res.write(line+'\n')

eindTime = str(datetime.datetime.now())
f_fout.write(eindTime+'\n')
f_res.write(eindTime+'\n')
f_fin.write(eindTime+'\n')

f_fin.close()
f_fout.close()
f_res.close()

print eindTime
print 'einde'
print line
1
Avatar
Annuleer
Ayhan KIZILTAN
Auteur

I want to enter the invoice numbers manually because I have to enter the invoices which I already created manually before I began to use OpenERP. So each invoice has its own sequences. After I complete all the previous invoice entries I will begin to use the invoice numbers generated by the software.

patrick

If needed, I can show a small script to do the import for you. Just let me know if you are interested. You want to place your own invoice number as account_invoice.internal_number. This field will be used to generate/display the invoice number

Ayhan KIZILTAN
Auteur

Yes I am interested.

AJ Schrafel Paper Corp

i agree with patrick, importing the invoices is a much better idea than manually keying data.

Nagah El-Msiry

Dear I'm facing the same problem and i want to import invoices with pregenerated numbers as beginign balances, (will that affect accounting side also or i have to make entry with total balance ?)

SYNAP SYSTEM

The first thing I tried with OpenERP was editing old invoices (and still don't know how to do it). It seems that I may not be the only one...

AJ Schrafel Paper Corp

once an invoice is out of draft state, you cannot edit it. You need to either have your customer pay the invoice short and issue a credit memo to zero out the balance OR you need to issue a credit for the entire invoice and re-invoice at the correct amount. This is a basic principle of accounting that openERP must follow otherwise it would not be taken seriously as an accounting package.

SYNAP SYSTEM

By "old invoices" I doesn't mean "paid invoices". I mean "invoices which was edited out of OpenERP". Fact is that if we had already issued paper wrote invoices with manually-attributed reference numbers, it's not possible to create the same invoice in OpenERP with the same reference number, as it's automatically generated and not editable.

AJ Schrafel Paper Corp

You can load them directly into the database using pgadmin or custom scripting to put the information into the database. But this method might lead to unforeseen issues.

SYNAP SYSTEM

Of course! We can do anything this way... But the purpose of a framework is not to make us choose between "not doing something" and "doing it the bad way". OpenERP is quite well designed. But it's very difficult to convince a customer when we are not even able to import it's own data for a demo.

Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
How to change Invoice sequence via xml in Odoo 15 or newer?
invoice sequence
Avatar
0
sep. 24
2050
Odoo 17.1 - How to never reset invoice number
invoice sequence
Avatar
Avatar
2
mrt. 24
3923
How to select manually a sequence for an invoice? Opgelost
invoice sequence
Avatar
Avatar
2
feb. 23
4564
Manually set invoice number Opgelost
invoice sequence
Avatar
Avatar
Avatar
Avatar
Avatar
6
okt. 20
39298
Error in Sequence when creating and editing invoice
invoice sequence
Avatar
Avatar
1
sep. 20
5103
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now