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

Change Terms and Conditions inside invoices

Suscribirse

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

Se marcó esta pregunta
invoicesales.orderv15
2 Respuestas
5374 Vistas
Avatar
Mohamad Ali Chamas

I am trying to change the terms and conditions note inside the invoices. I know that there is a setting that can be updated concerning this field but its not working correctly. I have updated all old invoices to a new T&C note and kept the one in the sales order as is. But, when creating an invoice from an SO, the old terms and conditions are appearing on it and when creating an invoice alone without creating it from the SO then it is taking the new note I identified in the settings. Is there a function I should override in order to fix the terms & conditions? if yes, what is it?

0
Avatar
Descartar
Avatar
Malay Khamar (Serpent Consulting Services Pvt. Ltd.)
Mejor respuesta

Hi , 
If you are creating the Regular Invoice , then you have to customise the below method and change the "narration" field value as per your need. 

Method :  https://github.com/odoo/odoo/blob/15.0/addons/sale/models/sale_order.py#L604

Field value : https://github.com/odoo/odoo/blob/15.0/addons/sale/models/sale_order.py#L618


And if you are creating the Invoices with Down payment functionality,  then you have to customise the below method and change the "narration" field value as per your need


Method: https://github.com/odoo/odoo/blob/15.0/addons/sale/wizard/sale_make_invoice_advance.py#L73

Field Value : https://github.com/odoo/odoo/blob/15.0/addons/sale/wizard/sale_make_invoice_advance.py#L79


Check this demo video to help you. 

     https://uploadnow.io/f/1GDCz3b


Hope it will help you.
Up vote please.

1
Avatar
Descartar
Avatar
NISHANT JAIN
Mejor respuesta

When you create an invoice from SO It will take T&C of SO.

But when creating an invoice alone without creating it from the SO then it will take the default note of setting


So in your case invoice is getting T&C of SO.


If you want to change this existing behaviour you have to override this two methods.

https://github.com/odoo/odoo/blob/15.0/addons/sale/models/sale_order.py#L604​

https://github.com/odoo/odoo/blob/15.0/addons/sale/wizard/sale_make_invoice_advance.py#L73

​

0
Avatar
Descartar
Mohamad Ali Chamas
Autor

I overrided these 2 methods and replaced: 'narration': self.note with 'narration': self.narration and order.narration but still it didn't work, do you have any idea why?

NISHANT JAIN

because sale order doesn't have narration field
narration field is in invoice

can you share your code so that i can help

Mohamad Ali Chamas
Autor

Yes I want to update the narration field inside invoice and keep it the same in the sales order. I used the same functions but updated from note to narration. Do you have any solution regarding this issue?

Malay Khamar (Serpent Consulting Services Pvt. Ltd.)

HI MohammadShamass, Mohammad Chamass,

If you want that invoice will take the default terms and condition as you configured.
Not the sale order terms and conditions. Then you need to comment or remove the "narration" field in the below method.

Method : https://github.com/odoo/odoo/blob/15.0/addons/sale/models/sale_order.py#L604

By removing the "narration" from the above method, Invoice will take the default
terms and condition.

Mohamad Ali Chamas
Autor

I commented the narration field from both methods but the problem still persists

Malay Khamar (Serpent Consulting Services Pvt. Ltd.)

I guess you have to check the final dictionary values at the end. It should not contains the "narration" key at all.
Please check the video i have shared in the updated answer.
Thanks

Mohamad Ali Chamas
Autor

Thanks for the video! But the problem is still persisting, the place you changed the terms and conditions is the same place I changed it. I also changed it from the user-defaults section. I also removed the narration fields in both functions but till now I don't have any solution that helped me.

Malay Khamar (Serpent Consulting Services Pvt. Ltd.)

Then, you have to check wether your custom code has used that method or not.

Mohamad Ali Chamas
Autor

This is the code, kindly check it:

from odoo import api, fields, models, _
from odoo.exceptions import AccessError, UserError
from odoo.tools import groupby

class AccountMoveInh(models.Model):
_inherit = 'account.move'

def _prepare_invoice(self):
"""
Prepare the dict of values to create the new invoice for a sales order. This method may be
overridden to implement custom invoice generation (making sure to call super() to establish
a clean extension chain).
"""
self.ensure_one()
journal = self.env['account.move'].with_context(default_move_type='out_invoice')._get_default_journal()
if not journal:
raise UserError(_('Please define an accounting sales journal for the company %s (%s).', self.company_id.name,
self.company_id.id))

invoice_vals = {
'ref': self.client_order_ref or '',
'move_type': 'out_invoice',
'currency_id': self.pricelist_id.currency_id.id,
'campaign_id': self.campaign_id.id,
'medium_id': self.medium_id.id,
'source_id': self.source_id.id,
'user_id': self.user_id.id,
'invoice_user_id': self.user_id.id,
'team_id': self.team_id.id,
'partner_id': self.partner_invoice_id.id,
'partner_shipping_id': self.partner_shipping_id.id,
'fiscal_position_id': (self.fiscal_position_id or self.fiscal_position_id.get_fiscal_position(
self.partner_invoice_id.id)).id,
'partner_bank_id': self.company_id.partner_id.bank_ids.filtered(
lambda bank: bank.company_id.id in (self.company_id.id, False))[:1].id,
'journal_id': journal.id, # company comes from the journal
'invoice_origin': self.name,
'invoice_payment_term_id': self.payment_term_id.id,
'payment_reference': self.reference,
'transaction_ids': [(6, 0, self.transaction_ids.ids)],
'invoice_line_ids': [],
'company_id': self.company_id.id,
}
invoice_vals=super(AccountMoveInh)._prepare_invoice(self)
return invoice_vals

def _prepare_invoice_values(self, order, name, amount, so_line):

invoice_vals = {
'ref': order.client_order_ref,
'move_type': 'out_invoice',
'invoice_origin': order.name,
'invoice_user_id': order.user_id.id,
'partner_id': order.partner_invoice_id.id,
'fiscal_position_id': (
order.fiscal_position_id or order.fiscal_position_id.get_fiscal_position(order.partner_id.id)).id,
'partner_shipping_id': order.partner_shipping_id.id,
'currency_id': order.pricelist_id.currency_id.id,
'payment_reference': order.reference,
'invoice_payment_term_id': order.payment_term_id.id,
'partner_bank_id': order.company_id.partner_id.bank_ids[:1].id,
'team_id': order.team_id.id,
'campaign_id': order.campaign_id.id,
'medium_id': order.medium_id.id,
'source_id': order.source_id.id,
'invoice_line_ids': [(0, 0, {
'name': name,
'price_unit': amount,
'quantity': 1.0,
'product_id': self.product_id.id,
'product_uom_id': so_line.product_uom.id,
'tax_ids': [(6, 0, so_line.tax_id.ids)],
'sale_line_ids': [(6, 0, [so_line.id])],
'analytic_tag_ids': [(6, 0, so_line.analytic_tag_ids.ids)],
'analytic_account_id': order.analytic_account_id.id if not so_line.display_type and order.analytic_account_id.id else False,
})],
}
invoice_vals=super(AccountMoveInh)._prepare_invoice_values(self, order, name, amount, so_line)
return invoice_vals

¿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
how to count invoice in smart button in odoo 15 ? Resuelto
invoice v15
Avatar
Avatar
Avatar
2
ene 23
5525
Connect sales order with already confirmed invoice Resuelto
invoice sales.order
Avatar
Avatar
2
dic 22
3904
how is working invoice count smart button in odoo
invoice v15
Avatar
Avatar
1
jun 22
3858
How to know which invoice a payment belong to?
invoice v15
Avatar
Avatar
1
may 22
4153
Change invoice prefix in V15 (Community edition)
invoice v15
Avatar
Avatar
1
dic 21
3380
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