Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

How to send a field value from sale order to invoice?

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
invoicevaluessale.order.formhowtosend
10 Răspunsuri
16339 Vizualizări
Imagine profil
evon_dun

I added a custom field to sale order and i want to send this value from sale order to invoice view. I tried adding it through sale_line_invoice wizard and in _prepare_invoice method in sale.order. Also i added that field to account.invoice and its view. I then restarted my server, cleared cache and updated my module. But when i create any order and click on Create final invoice i get this error: Unknown Error can't adapt type 'browse_record'.

2
Imagine profil
Abandonează
Imagine profil
Davide Corio
Cel mai bun răspuns

the _prepare_invoice method of sale.order is what you need. the comment says:

Prepare the dict of values to create the new invoice for a sales order.

so you need to override this method in a custom module of yours, in order to extend the invoice_vals dictionary, with something like:

class my_sale_order(osv.Model):
    _inherit = "sale.order"
    def _prepare_invoice(self, cr, uid, order, lines, context=None):
        ## your code
my_sale_order()
1
Imagine profil
Abandonează
evon_dun
Autor

hey m not having any custom module but i just added a single custom field to sale order earlier and now i want to use that field in invoice too with the values.

Davide Corio

then i guess you edited the openerp source code. it's always preferable to create a custom module and inherit the code, otherwise you're going to lose your changes with the next openerp update

evon_dun
Autor

i know but i succesfully did everything but now my field shows this value which is obviously some error browse_record(res.reference, 1)

Davide Corio

you're referring to an object instead of an attribute. probably your_value.name will fix this

evon_dun
Autor

thanks a lot it works now with the attribute.

Imagine profil
Tintumon
Cel mai bun răspuns

 For creating "account.invoice" from "sale.order" there is four selection option

  • delivered

  • all

  • percentage

  • fixed

I tried a function "def action_invoice_create(self, grouped=False, final=False): " using super in inherited sale.order. It works fine for sending a field value from sale.order to account.invoice, when the selection field is "delivered" or "all".

Instead of "def action_invoice_create(self, grouped=False, final=False): " I tried with "def _prepare_invoice(self, cr, uid, order, lines, context=None):" also. But same happened it's not working for "percentage" and "fixed" selections.

So I used another function "def _create_invoice(self, order, so_line, amount):" using super in inherited wizard/sale_make_invoice_advance.py

It propagated the field value from sale.order to account.invoice successfully. I have tested it in debug also.

Does it right way to achieve? or any other way?

Note: I worked on ODOO9

0
Imagine profil
Abandonează
Imagine profil
Amit Parik (amp)
Cel mai bun răspuns

Hello Evon,

You are doing a great, but you did a mistake on write a value on dict of _prepare_invoice_line. You have directly write a object instead of the field value. You have to use the field on vals by using the '.'. For example I have added a two field on sale order line as well as invoice line. 1.lot_id (many2one) 2.package_name (char).

So you have to pass this value on vals like this on _prepare_invoice_line method where the dict is generated as a vals for create the invoice line.

Suppose line_obj_browse is my browse object then

vals = { 'lot_id' : line_obj_browse.lot_id.id, 'package_name': line_obj_browse.package_name, }

0
Imagine profil
Abandonează
evon_dun
Autor

I did it the same way

Imagine profil
René
Cel mai bun răspuns

Can you please eplain me how you would extend the method "_prepare_inoive" with only one custom-field "example-field" ?

How should I modify the original method in my custom module?

Thanks René

0
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
[SOLVED] Bulk send invoices with pay now link in email Rezolvat
invoice send paynow odoo12ce
Imagine profil
1
dec. 23
5527
import new field values from sale_order to invoice
invoice values sale.order odooV8
Imagine profil
0
dec. 15
3934
Invalid template id / QWebTemplateNotFound
invoice draft quotation send
Imagine profil
0
oct. 15
7512
Aeroo Report Designer, how to get the values?
invoice values report aeroo
Imagine profil
0
mar. 15
4703
Why is that send E-mail button in invoice doesn't send to Portal's User. ?
invoice email customer send
Imagine profil
Imagine profil
2
mar. 15
6931
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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