Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyectos
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

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

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
invoicebalanceaccount.move
2878 Vistas
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
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
Add a new tax to invoice (worked on odoo15 and not on odoo16)
invoice tax balance account.move lineitem
Avatar
0
feb 24
1920
Error in studio domain
invoice account.move studio
Avatar
Avatar
1
feb 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
5032
Issue: Newly Created account.move Records Not Showing in Odoo Interface
invoice xmlrpc account.move interface
Avatar
Avatar
Avatar
Avatar
4
feb 24
4425
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

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