Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

Odoo12: TypeError: post() got an unexpected keyword argument 'invoice'

Naroči se

Get notified when there's activity on this post

This question has been flagged
invoicetypeerrorodoo12
3 Odgovori
17344 Prikazi
Avatar
Syed Hamza

I get this error when i try to create invoice. 


Odoo Server Error
Traceback (most recent call last):
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/http.py", line 656, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/http.py", line 314, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/tools/pycompat.py", line 87, in reraise
    raise value
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/http.py", line 698, in dispatch
    result = self._call_function(**self.params)
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/http.py", line 346, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/service/model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/http.py", line 339, in checked_call
    result = self.endpoint(*a, **kw)
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/http.py", line 941, in __call__
    return self.method(*args, **kw)
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/http.py", line 519, in response_wrap
    response = f(*args, **kw)
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/addons/web/controllers/main.py", line 966, in call_button
    action = self._call_kw(model, method, args, {})
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/addons/web/controllers/main.py", line 954, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/api.py", line 759, in call_kw
    return _call_kw_multi(method, model, args, kwargs)
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/api.py", line 746, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/env/env_zameen/addons/rsms/real_estate/models/file.py", line 353, in create_invoice
    invoice.action_invoice_open()
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/addons/sale/models/account_invoice.py", line 59, in action_invoice_open
    res = super(AccountInvoice, self).action_invoice_open()
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/thirdparty/financials/fiscal/models/fiscal_year.py", line 256, in action_invoice_open
    return super(AccountInvoice, self).action_invoice_open()
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/addons/account/models/account_invoice.py", line 988, in action_invoice_open
    to_open_invoices.action_move_create()
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/thirdparty/financials/account_asset/models/account_invoice.py", line 33, in action_move_create
    result = super(AccountInvoice, self).action_move_create()
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/addons/account/models/account_invoice.py", line 1341, in action_move_create
    move.post(invoice = inv)
TypeError: post() got an unexpected keyword argument 'invoice'

my code:


@api.multi
def create_invoice(self):
# check duplicity
list_of_product_id = [x.product_id.id for x in self.file_payment_ids]
for i in list_of_product_id:
if list_of_product_id.count(i) > 1:
raise ValidationError(_("Duplicity of products are not allowed"))
if self.file_payment_ids:
prod = [(0, 0, {
'product_id': rec.product_id.id,
'name': rec.product_id.name,
'account_id': rec.product_id.property_account_income_id.id,
# 'price_unit': rec.value if rec.payment_type == 'fix' else [self.sale_amount * rec.value / 100][0]
'price_unit': rec.initial_payment,
# 'is_fully_paid': rec.is_fully_paid
}) for rec in self.file_payment_ids]

invoice = self.env['account.invoice'].create({
'file_id': self, # this id is just for invoice create method i will extract this field from there and push remaining values
'name': self.name,
'type' : 'out_invoice',
'user_id':self.user_id.id,
'partner_id': self.membership_id.id,
'account_id': self.membership_id.property_account_receivable_id.id,
'property_invoice_type': 'initial_payment',
'date_invoice': self.booking_date,
'date_due': self.booking_date,
'invoice_line_ids': prod
})

invoice.action_invoice_open()

self.payment_states = 'open'

self.history_log('First Owner', invoice.create_date, self.membership_id.id,self.env.user.company_id.partner_id.id)
self.initial_invoice = False
self.env['confirmation'].confirmation_popup('Invoice')
Updated my Question:
here's the post method
_inherit = "account.move"
@api.multi
def post(self):
date_jv = self.date
fiscal_year_obj = self.env['fiscal.year'].search([('start_date', '<=', date_jv), ('end_date', '>=', date_jv)])
fiscal_month_obj = self.env['fiscal.month'].search(
[('open_close', '=', False), ('start_date', '<=', date_jv), ('end_date', '>=', date_jv)])

if date_jv:
inv_date = datetime.strptime(date_jv, "%Y-%m-%d")
else:
raise ValidationError(
"Please enter journal entry date!")
invdate_year = inv_date.year
if fiscal_year_obj:
if fiscal_year_obj[0].state != 'closed':
if fiscal_month_obj:
if fiscal_month_obj[0].state != 'closed':
return super(AccountMove, self).post()
else:
raise ValidationError(
"You are trying to access %r fiscal month that is already closed" % fiscal_month_obj[
0].name)
else:
raise ValidationError("month not found")

else:
raise ValidationError(
"You are trying to access %r fiscal year that is already closed" % fiscal_year_obj[0].name)
else:
raise ValidationError("year not found")

I don't know what is wrong. Any help ?

0
Avatar
Opusti
Sudhir Arya (ERP Harbor Consulting Services)

Search for the post method in your custom module and upload the method code in your question.

Avatar
Ravi Gadhia
Best Answer

you missed the invoice parameter which parent model has

@api.multi
def post(self, invoice=False):
date_jv = self.date
    iscal_year_obj = self.env['fiscal.year
 ​   ​    ​   ​     ​   ​    ​   ​

​

1
Avatar
Opusti
Avatar
Syed Hamza
Avtor Best Answer

updated my question with post method

0
Avatar
Opusti
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Open an invoice using XMLRPC
invoice odoo12
Avatar
Avatar
2
maj 20
5812
ODOO 12: TypeError: Mixing apples and oranges: product.product(3280,).concat( No product price at date!)
typeerror odoo12
Avatar
Avatar
2
feb. 20
4440
How to modify validated invoice?
invoice odoo12
Avatar
Avatar
Avatar
2
nov. 18
4978
How to control auto post for journal entry comes from invoices in Odoo12?
invoice journal_entry odoo12
Avatar
0
jan. 22
4212
[v12] propagate custom field from invoice to invoice report
invoice invoicereport odoo12
Avatar
Avatar
3
dec. 19
5466
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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