Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

How to add partner to invoice template?

Odoberať

Get notified when there's activity on this post

This question has been flagged
account.invoicetemplateextend
2 Replies
6472 Zobrazenia
Avatar
Pavel Pavlov

Hello,

I’m struggling to add some data that I need to my Invoice report…
In Delivery Slip(Tech name: stock.picking.list.out) I get the Invoice
Address from [[ display_address(picking.partner_invoice_id.parent_id) ]]
and Delivery Address from [[ display_address(picking.partner_shipping_id) ]]

I’d like to use same information in my Invoice(Tech name: account.invoice) template,
but the invoice object does not contain the Invoice and Delivery addresses. It has only
display_address(o.partner_id), which is not the one that I need for my invoice document.

I found a nice mapping table in the database “sale_order_invoice_rel” and managed to
build a SQL query that does what I need, but I can’t figure out how to perform the same thing
in the invoice report, when I modify it with Open Office. My query is

SELECT 
  account_invoice.id,
  sale_order.partner_id, 
  sale_order.partner_invoice_id, 
  sale_order.partner_shipping_id

FROM 
  public.sale_order_invoice_rel, 
  public.sale_order, 
  public.account_invoice
WHERE 
  sale_order_invoice_rel.order_id = sale_order.id AND
  account_invoice.id = sale_order_invoice_rel.invoice_id;

and it returns what I need… for example:
“id ;partner_id; partner_invoice_id; partner_shipping_id
1;5;6;7”

Question is how do I get those IDs in the Invoice template via RML tags or where can I extend a python method, that is being used to provide to the template this o object that contains the invoice data…
I found invoice_print method in account.account_invoice, that according to the comment should be ”This function prints the invoice and mark it as sent, so that we can see more easily the next step of the workflow”, but not sure how to extend it – it doesn’t return this o object, so that I could extend it…

If you’ve done something similar please tell me how it worked for you.
Can I somehow modify the report or extend the python code and which method?

Best Regards,
Pavel Pavlov

0
Avatar
Zrušiť
Avatar
Shashank Verma
Best Answer

Hello pavel

py file

class account_invoice(report_sxw.rml_parse):

def __init__(self, cr, uid, name, context):
    super(account_invoice, self).__init__(cr, uid, name, context=context)
    self.localcontext.update({
       'my_new_detail':_my_new_detail
    })


 def _my_new_detail(self,ids):


    return obj_browse

rml file

para style="terp_default_2">[[repeatIn( _my_new_detail(picking), 'my_detail')]]</para>

<blocktable colwidths="410.0" style="Header_Order_Reference_Tbl" &gt;<="" p="">

 <tr>

    <td>
      <para style="terp_default_1cm_above_space">[my_detail.fieldname ]]</para>
    </td>

  </tr>

Hope this might help you.

0
Avatar
Zrušiť
Avatar
Pavel Pavlov
Autor Best Answer

Hello,

shashank verma, thank you for sharing your idea! I believe what you wrote will work, thou I haven't tried it, because after banging my head in this almost whole night I found a smoother solution!

class account_invoice(osv.osv):
_inherit = 'account.invoice'
_columns = {
'zSO': fields.many2many('sale.order', 'sale_order_invoice_rel', 'invoice_id', 'order_id', 'Invoices', readonly=True, help="List of Sales Orders related to this Invoice"),              
}

Then in the Invoice report I do [[ display_address(o.zSOid[0].partner_shipping_id) ]] and it works! The benefit of using this approach instead of the other one above is that this way no native SQL shall be used and you go thru the openERP framework to get to the DB layer.

Both solutions will work, but please mark this one as answer. thank you!

Regards, Pavel Pavlov

0
Avatar
Zrušiť
Enjoying the discussion? Don't just read, join in!

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

Registrácia
Related Posts Replies Zobrazenia Aktivita
qweb extend template doesn't show on view
qweb kanban template extend
Avatar
0
apr 21
3352
how to extend qweb template "wysiwyg.widgets.video" in odoo14?
qweb template extend v14
Avatar
Avatar
1
dec 20
4048
How to execute a funtion in JS file?
template js extend odoo9
Avatar
Avatar
1
máj 16
6405
Related fields from sales orders in accounting invoices
account.invoice
Avatar
0
mar 25
1710
Template Color
template
Avatar
0
jan 25
1767
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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