Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Diskusi
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

Change Terms and Conditions inside invoices

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
invoicesales.orderv15
2 Replies
5378 Tampilan
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
Buang
Avatar
Malay Khamar (Serpent Consulting Services Pvt. Ltd.)
Jawaban Terbai

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
Buang
Avatar
NISHANT JAIN
Jawaban Terbai

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
Buang
Mohamad Ali Chamas
Penulis

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
Penulis

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
Penulis

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
Penulis

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
Penulis

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

Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
how to count invoice in smart button in odoo 15 ? Diselesaikan
invoice v15
Avatar
Avatar
Avatar
2
Jan 23
5525
Connect sales order with already confirmed invoice Diselesaikan
invoice sales.order
Avatar
Avatar
2
Des 22
3905
how is working invoice count smart button in odoo
invoice v15
Avatar
Avatar
1
Jun 22
3859
How to know which invoice a payment belong to?
invoice v15
Avatar
Avatar
1
Mei 22
4155
Change invoice prefix in V15 (Community edition)
invoice v15
Avatar
Avatar
1
Des 21
3380
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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