Перейти к содержимому
Odoo Меню
  • Войти
  • Попробовать бесплатно
  • Модули
    Финансы
    • Бухгалтерия
    • Выставление счетов
    • Расходы
    • Таблицы
    • Документооборот
    • Подпись
    Продажи
    • CRM
    • Продажи
    • POS Магазин
    • POS Ресторан
    • Подписки
    • Аренда
    Вебсайты
    • Конструктор вебсайтов
    • eCommerce
    • Блог
    • Форум
    • Онлайн-чат
    • Электронное обучение
    Логистика
    • Склад
    • Производство
    • PLM
    • Закупки
    • Обслуживание
    • Качество
    Отдел кадров
    • Сотрудники
    • Подбор персонала
    • Отпуска
    • Оценка персонала
    • Реферальная программа
    • Автопарк
    Маркетинг
    • SMM
    • E-mail рассылки
    • СМС рассылки
    • Мероприятия
    • Автоматизация маркетинга
    • Опросы
    Услуги
    • Проекты
    • Табели
    • Выездной сервис
    • Поддержка
    • Планирование
    • Встречи
    Продуктивность
    • Обсуждения
    • Согласование
    • IoT
    • VoIP-телефония
    • Knowledge
    • WhatsApp
    Сторонние приложения Модуль Студия Odoo Платформа Odoo Cloud
  • Индустрии
    Розничная торговля
    • Книжный магазин
    • Магазин одежды
    • Мебельный магазин
    • Продуктовый магазин
    • Строительный магазин
    • Магазин игрушек
    Гостинично-ресторанный бизнес
    • Бар и паб
    • Ресторан
    • Фастфуд
    • Гостевой дом
    • Дистрибьютор напитков
    • Отель
    Недвижимость
    • Агентство недвижимости
    • Архитектурное бюро
    • Строительство
    • Управление недвижимостью
    • Ландшафтный дизайн
    • Товарищество собственников жилья
    Консалтинг
    • Бухгалтерская фирма
    • Партнер Odoo
    • Маркетинговое агентство
    • Юридическая фирма
    • Подбор персонала
    • Аудиторское бюро
    Производство
    • Текстиль
    • Металл
    • Мебель
    • Продукты питания
    • Пивоварня
    • Корпоративные сувениры
    Здоровье и фитнес
    • Спортивный комплекс
    • Магазин оптики
    • Фитнес-клуб
    • Велнес-центр
    • Аптека
    • Салон красоты
    Услуги
    • Специалист по бытовым услугам
    • Продажа и обслуживание IT-оборудования
    • Солнечные энергосистемы
    • Производство обуви
    • Клининг
    • Системы ОВКВ
    Прочее
    • Некоммерческая организация
    • Консалтинг в сфере устойчивого развития
    • Аренда рекламных щитов
    • Бизнес по фотосъемке
    • Прокат велосипедов
    • Реселлер программного обеспечения
    Все индустрии
  • Community
    Обучение
    • Видео уроки
    • Документация
    • Сертификация
    • Тренинг
    • Блог
    • Подкаст
    Образование и развитие
    • Образовательная программа
    • Деловая игра Scale Up!
    • Экскурсия в офис Odoo
    ПО
    • Скачать
    • Сравнить версии
    • Релизы
    Сотрудничество
    • Github
    • Форум
    • Мероприятия
    • Перевод
    • Стать партнером
    • Услуги для партнеров
    • Зарегистрировать бухгалтерскую фирму
    Услуги
    • Найти партнера
    • Найти бухгалтера
    • Встреча с экспертом
    • Услуги по внедрению
    • Отзывы клиентов
    • Поддержка
    • Обновления
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Заказать демонстрацию
  • Цены
  • Поддержка

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

  • CRM
  • e-Commerce
  • Бухгалтерия
  • Склад
  • PoS
  • Проекты
  • MRP
All apps
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Все посты Люди Значки
Теги (Смотреть все)
odoo accounting v14 pos v15
Об этом форуме
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Все посты Люди Значки
Теги (Смотреть все)
odoo accounting v14 pos v15
Об этом форуме
Помощь

manual invoice numbering

Подписаться

Получайте уведомления о появлении активности в этом посте

Этот вопрос был отмечен
invoicesequence
1 Ответить
12131 Представления
Аватар
Ayhan KIZILTAN

How do I enter Invoice Numbers manually?

1
Аватар
Отменить
Аватар
patrick
Лучший ответ

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
Аватар
Отменить
Ayhan KIZILTAN
Автор

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
Автор

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.

Не оставайтесь в стороне – присоединяйтесь к обсуждению!

Создайте аккаунт сегодня, чтобы получить доступ к эксклюзивным функциям и стать частью нашего замечательного сообщества!

Регистрация
Похожие посты Ответы Просмотры Активность
How to change Invoice sequence via xml in Odoo 15 or newer?
invoice sequence
Аватар
0
сент. 24
2047
Odoo 17.1 - How to never reset invoice number
invoice sequence
Аватар
Аватар
2
мар. 24
3919
How to select manually a sequence for an invoice? Решено
invoice sequence
Аватар
Аватар
2
февр. 23
4552
Manually set invoice number Решено
invoice sequence
Аватар
Аватар
Аватар
Аватар
Аватар
6
окт. 20
39293
Error in Sequence when creating and editing invoice
invoice sequence
Аватар
Аватар
1
сент. 20
5101
Сообщество
  • Видео уроки
  • Документация
  • Форум
Открытый исходный код
  • Скачать
  • Github
  • Runbot
  • Перевод
Услуги
  • Хостинг Odoo.sh
  • Поддержка
  • Обновление
  • Индивидуальные решения по доработке
  • Образование
  • Найти бухгалтера
  • Найти партнера
  • Стать партнером
О нас
  • Наша компания
  • Активы бренда
  • Cвяжитесь с нами
  • Вакансии
  • Мероприятия
  • Подкаст
  • Блог
  • Клиенты
  • Правовые документы • Конфиденциальность
  • Безопасность
الْعَرَبيّة 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 – это набор бизнес-модулей с открытым исходным кодом, который закроет все потребности вашей компании: CRM, E-commerce, Бухгалтерия, Склад, POS, управление проектами и др.

Odoo сочетает в себе простоту использования и полную интеграцию всех бизнес-процессов в одной системе.

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