Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • Apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Godkendelser
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-virksomhedsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp

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

  • CRM
  • e-Commerce
  • Bogføring
  • Lager
  • PoS
  • Projekt
  • MRP
All apps
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Hjælp

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

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
invoicetypeerrorodoo12
3 Besvarelser
17268 Visninger
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
Kassér
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
Bedste svar

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
Kassér
Avatar
Syed Hamza
Forfatter Bedste svar

updated my question with post method

0
Avatar
Kassér
Enjoying the discussion? Don't just read, join in!

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

Tilmeld dig
Related Posts Besvarelser Visninger Aktivitet
Open an invoice using XMLRPC
invoice odoo12
Avatar
Avatar
2
maj 20
5723
ODOO 12: TypeError: Mixing apples and oranges: product.product(3280,).concat( No product price at date!)
typeerror odoo12
Avatar
Avatar
2
feb. 20
4410
How to modify validated invoice?
invoice odoo12
Avatar
Avatar
Avatar
2
nov. 18
4927
How to control auto post for journal entry comes from invoices in Odoo12?
invoice journal_entry odoo12
Avatar
0
jan. 22
4166
[v12] propagate custom field from invoice to invoice report
invoice invoicereport odoo12
Avatar
Avatar
3
dec. 19
5408
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة 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 er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

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