Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

receivable amount not updated (move not balanced) after adding new tax line

Odoberať

Get notified when there's activity on this post

This question has been flagged
invoicebalanceaccount.move
2868 Zobrazenia
Avatar
Yahia

I have a module that create new tax to invoice for cash payment mode; 

the tax is added to move.lines but it's value not added to receivable account to get a balanced move.


ERROR:

The move (Draft Invoice INV/2024/00002) is not balanced. The total of debits equals 416.50 DA and the total of credits equals 421.50 DA. You might want to specify a default account on journal "Customer Invoices" to automatically balance each move. 


following is a code:

   def ks_update_timbre_fiscal_dz_15(self):
for rec in self:
already_exists = self.line_ids.filtered(
lambda line: line.name and line.name.find('Timbre Fiscal') == 0)
terms_lines = self.line_ids.filtered(
lambda line: line.account_id.account_type in ('asset_receivable', 'liability_payable'))

other_lines = self.line_ids.filtered(
lambda line: line.account_id.account_type not in ('asset_receivable', 'liability_payable'))
if already_exists:
amount = rec.ks_amount_global_tax
if rec.ks_sales_tax_account_id \
and (rec.move_type == "out_invoice"
or rec.move_type == "out_refund")\
and rec.ks_global_tax_rate > 0:
if rec.move_type == "out_invoice":
already_exists.update({
'debit': amount 'credit': amount > 0.0 and amount or 0.0,
})
else:
already_exists.update({
'debit': amount > 0.0 and amount or 0.0,
'credit': amount })
else:
already_exists.update({
'debit': amount 'credit': amount > 0.0 and amount or 0.0,
})
total_balance = sum(other_lines.mapped('balance'))
total_amount_currency = sum(other_lines.mapped('amount_currency'))
terms_lines.update({
'amount_currency': -total_amount_currency,
'debit': total_balance 'credit': total_balance > 0.0 and total_balance or 0.0,
})
if not already_exists and rec.ks_global_tax_rate > 0:
in_draft_mode = self != self._origin
if not in_draft_mode:
rec._recompute_timbre_fiscal_dz_15_lines()

@api.onchange('ks_global_tax_rate', 'line_ids')
def _recompute_timbre_fiscal_dz_15_lines(self):
for rec in self:
type_list = ['out_invoice', 'out_refund', 'in_invoice', 'in_refund']
if rec.ks_global_tax_rate > 0 and rec.move_type in type_list:
if rec.is_invoice(include_receipts=True):
in_draft_mode = self != self._origin
ks_name = "Timbre Fiscal"
ks_name = ks_name + \
" @" + str(self.ks_global_tax_rate) + "%"
terms_lines = self.line_ids.filtered(
lambda line: line.account_id.account_type in ('asset_receivable', 'liability_payable'))


already_exists = self.line_ids.filtered(
lambda line: line.name and line.name.find('Timbre Fiscal') == 0)
if already_exists:
amount = self.ks_amount_global_tax
if self.ks_sales_tax_account_id \
and (self.move_type == "out_invoice"
or self.move_type == "out_refund"):
already_exists.update({
'name': ks_name,
'debit': amount 'credit': amount > 0.0 and amount or 0.0,
})

else:
new_tax_line = self.env['account.move.line']
create_method = in_draft_mode and \
self.env['account.move.line'].new or\
self.env['account.move.line'].create

if self.ks_sales_tax_account_id \
and (self.move_type == "out_invoice"
or self.move_type == "out_refund"):
amount = self.ks_amount_global_tax
dict = {
'move_name': self.name,
'name': ks_name,
'price_unit': self.ks_amount_global_tax,
'quantity': 1,
'debit': amount 'credit': amount > 0.0 and amount or 0.0,
'account_id': self.ks_sales_tax_account_id,
'move_id': self._origin,
'date': self.date,
'partner_id': terms_lines.partner_id.id,
'company_id': terms_lines.company_id.id,
'company_currency_id': terms_lines.company_currency_id.id,
}
if self.move_type == "out_invoice":
dict.update({

'debit': amount 'credit': amount > 0.0 and amount or 0.0,
})
else:
dict.update({
'debit': amount > 0.0 and amount or 0.0,
'credit': amount })
if in_draft_mode:
self.line_ids += create_method(dict)
# Updation of Invoice Line Id
duplicate_id = self.invoice_line_ids.filtered(
lambda line: line.name and line.name.find('Timbre Fiscal') == 0)
self.invoice_line_ids = self.invoice_line_ids - duplicate_id
else:
dict.update({
'price_unit': 0.0,
'debit': 0.0,
'credit': 0.0,
})
self.line_ids = [(0, 0, dict)]


if self.move_type == "in_invoice":
dict.update({
'debit': amount > 0.0 and amount or 0.0,
'credit': amount })
else:
dict.update({
'debit': amount 'credit': amount > 0.0 and amount or 0.0,
})
self.line_ids += create_method(dict)
# updation of invoice line id
duplicate_id = self.invoice_line_ids.filtered(
lambda line: line.name and line.name.find('Timbre Fiscal') == 0)
self.invoice_line_ids = self.invoice_line_ids - duplicate_id

if in_draft_mode:
# Update the payement account amount
terms_lines = self.line_ids.filtered(
lambda line: line.account_id.account_type in ('asset_receivable', 'liability_payable'))
other_lines = self.line_ids.filtered(
lambda line: line.account_id.account_type not in ('asset_receivable', 'liability_payable'))

total_balance = sum(other_lines.mapped('balance'))
total_amount_currency = sum(other_lines.mapped('amount_currency'))
terms_lines.update({
'amount_currency': -total_amount_currency,
'debit': total_balance 'credit': total_balance > 0.0 and total_balance or 0.0,
})
else:
terms_lines = self.line_ids.filtered(
lambda line: line.account_id.account_type in ('asset_receivable', 'liability_payable'))
other_lines = self.line_ids.filtered(
lambda line: line.account_id.account_type not in ('asset_receivable', 'liability_payable'))
already_exists = self.line_ids.filtered(
lambda line: line.name and line.name.find('Timbre Fiscal') == 0)
total_balance = sum(other_lines.mapped('balance')) - amount
total_amount_currency = sum(other_lines.mapped('amount_currency'))
dict1 = {
'debit': amount 'credit': amount > 0.0 and amount or 0.0,
}
dict2 = {
'debit': total_balance 'credit': total_balance > 0.0 and total_balance or 0.0,
}
if terms_lines:
self.line_ids = [(1, already_exists.id, dict1), (1, terms_lines[0].id, dict2)]
print()

elif self.ks_global_tax_rate already_exists = self.line_ids.filtered(
lambda line: line.name and line.name.find('Timbre Fiscal') == 0)
if already_exists:
self.line_ids -= already_exists
terms_lines = self.line_ids.filtered(
lambda line: line.account_id.account_type in ('asset_receivable', 'liability_payable'))
other_lines = self.line_ids.filtered(
lambda line: line.account_id.account_type not in ('asset_receivable', 'liability_payable'))
total_balance = sum(other_lines.mapped('balance'))
total_amount_currency = sum(other_lines.mapped('amount_currency'))
terms_lines.update({
'amount_currency': -total_amount_currency,
'debit': total_balance 'credit': total_balance > 0.0 and total_balance or 0.0,
})


0
Avatar
Zrušiť
Enjoying the discussion? Don't just read, join in!

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

Registrácia
Related Posts Replies Zobrazenia Aktivita
Add a new tax to invoice (worked on odoo15 and not on odoo16)
invoice tax balance account.move lineitem
Avatar
0
feb 24
1913
Error in studio domain
invoice account.move studio
Avatar
Avatar
1
feb 23
2445
Creating invoice in accounting module
invoice account.move sale.order
Avatar
Avatar
1
aug 21
4307
set account.move reference to the invoice number
invoice reference account.move
Avatar
0
mar 15
5026
Issue: Newly Created account.move Records Not Showing in Odoo Interface
invoice xmlrpc account.move interface
Avatar
Avatar
Avatar
Avatar
4
feb 24
4416
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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