Pular para o conteúdo
Odoo Menu
  • Entrar
  • Experimente grátis
  • Aplicativos
    Finanças
    • Financeiro
    • Faturamento
    • Despesas
    • Planilhas (BI)
    • Documentos
    • Assinar Documentos
    Vendas
    • CRM
    • Vendas
    • PDV Loja
    • PDV Restaurantes
    • Assinaturas
    • Locação
    Websites
    • Criador de Sites
    • e-Commerce
    • Blog
    • Fórum
    • Chat ao Vivo
    • e-Learning
    Cadeia de mantimentos
    • Inventário
    • Fabricação
    • PLM - Ciclo de Vida do Produto
    • Compras
    • Manutenção
    • Qualidade
    Recursos Humanos
    • Funcionários
    • Recrutamento
    • Folgas
    • Avaliações
    • Indicações
    • Frota
    Marketing
    • Redes Sociais
    • Marketing por E-mail
    • Marketing por SMS
    • Eventos
    • Automação de Marketing
    • Pesquisas
    Serviços
    • Projeto
    • Planilhas de Horas
    • Serviço de Campo
    • Central de Ajuda
    • Planejamento
    • Compromissos
    Produtividade
    • Mensagens
    • Aprovações
    • Internet das Coisas
    • VoIP
    • Conhecimento
    • WhatsApp
    Aplicativos de terceiros Odoo Studio Plataforma Odoo Cloud
  • Setores
    Varejo
    • Loja de livros
    • Loja de roupas
    • Loja de móveis
    • Mercearia
    • Loja de ferramentas
    • Loja de brinquedos
    Comida e hospitalidade
    • Bar e Pub
    • Restaurante
    • Fast Food
    • Hospedagem
    • Distribuidor de bebidas
    • Hotel
    Imóveis
    • Imobiliária
    • Escritório de arquitetura
    • Construção
    • Administração de propriedades
    • Jardinagem
    • Associação de proprietários de imóveis
    Consultoria
    • Escritório de Contabilidade
    • Parceiro Odoo
    • Agência de marketing
    • Escritório de advocacia
    • Aquisição de talentos
    • Auditoria e Certificação
    Fabricação
    • Têxtil
    • Metal
    • Móveis
    • Alimentação
    • Cervejaria
    • Presentes corporativos
    Saúde e Boa forma
    • Clube esportivo
    • Loja de óculos
    • Academia
    • Profissionais de bem-estar
    • Farmácia
    • Salão de cabeleireiro
    Comércio
    • Handyman
    • Hardware e Suporte de TI
    • Sistemas de energia solar
    • Sapataria
    • Serviços de limpeza
    • Serviços de climatização
    Outros
    • Organização sem fins lucrativos
    • Agência Ambiental
    • Aluguel de outdoors
    • Fotografia
    • Aluguel de bicicletas
    • Revendedor de software
    Navegar por todos os setores
  • Comunidade
    Aprenda
    • Tutoriais
    • Documentação
    • Certificações
    • Treinamento
    • Blog
    • Podcast
    Empodere a Educação
    • Programa de educação
    • Scale Up! Jogo de Negócios
    • Visite a Odoo
    Obtenha o Software
    • Baixar
    • Comparar edições
    • Releases
    Colaborar
    • Github
    • Fórum
    • Eventos
    • Traduções
    • Torne-se um parceiro
    • Serviços para parceiros
    • Cadastre seu escritório contábil
    Obtenha os serviços
    • Encontre um parceiro
    • Encontre um Contador
    • Conheça um consultor
    • Serviços de Implementação
    • Referências de Clientes
    • Suporte
    • Upgrades
    Github YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Faça uma demonstração
  • Preços
  • Ajuda

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

  • CRM
  • e-Commerce
  • Financeiro
  • Inventário
  • PoS
  • Projeto
  • MRP
All apps
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
Ajuda

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

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
invoicebalanceaccount.move
2892 Visualizações
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
Cancelar
Está gostando da discussão? Não fique apenas lendo, participe!

Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!

Inscreva-se
Publicações relacionadas Respostas Visualizações Atividade
Add a new tax to invoice (worked on odoo15 and not on odoo16)
invoice tax balance account.move lineitem
Avatar
0
fev. 24
1924
Error in studio domain
invoice account.move studio
Avatar
Avatar
1
fev. 23
2446
Creating invoice in accounting module
invoice account.move sale.order
Avatar
Avatar
1
ago. 21
4310
set account.move reference to the invoice number
invoice reference account.move
Avatar
0
mar. 15
5033
Issue: Newly Created account.move Records Not Showing in Odoo Interface
invoice xmlrpc account.move interface
Avatar
Avatar
Avatar
Avatar
4
fev. 24
4442
Comunidade
  • Tutoriais
  • Documentação
  • Fórum
Open Source
  • Baixar
  • Github
  • Runbot
  • Traduções
Serviços
  • Odoo.sh Hosting
  • Suporte
  • Upgrade
  • Desenvolvimentos personalizados
  • Educação
  • Encontre um Contador
  • Encontre um parceiro
  • Torne-se um parceiro
Sobre nós
  • Nossa empresa
  • Ativos da marca
  • Contato
  • Empregos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidade
  • Segurança
الْعَرَبيّة 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 é um conjunto de aplicativos de negócios em código aberto que cobre todas as necessidades de sua empresa: CRM, comércio eletrônico, contabilidade, estoque, ponto de venda, gerenciamento de projetos, etc.

A proposta de valor exclusiva Odoo é ser, ao mesmo tempo, muito fácil de usar e totalmente integrado.

Site feito com

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