Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Food & Hospitality
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Guest House
    • Distributor nápojů
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Trades
    • Údržbář
    • IT hardware a podpora
    • Solar Energy Systems
    • Výrobce obuvi
    • Úklidové služby
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Browse all Industries
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Services for Partners
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Change Terms and Conditions inside invoices

Odebírat

Get notified when there's activity on this post

This question has been flagged
invoicesales.orderv15
2 Odpovědi
5365 Zobrazení
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
Zrušit
Avatar
Malay Khamar (Serpent Consulting Services Pvt. Ltd.)
Nejlepší odpověď

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
Zrušit
Avatar
NISHANT JAIN
Nejlepší odpověď

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
Zrušit
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

Enjoying the discussion? Don't just read, join in!

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
how to count invoice in smart button in odoo 15 ? Vyřešeno
invoice v15
Avatar
Avatar
Avatar
2
led 23
5521
Connect sales order with already confirmed invoice Vyřešeno
invoice sales.order
Avatar
Avatar
2
pro 22
3900
how is working invoice count smart button in odoo
invoice v15
Avatar
Avatar
1
čvn 22
3853
How to know which invoice a payment belong to?
invoice v15
Avatar
Avatar
1
kvě 22
4149
Change invoice prefix in V15 (Community edition)
invoice v15
Avatar
Avatar
1
pro 21
3371
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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