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 display account move line (in_invoice) in list view including taxes entries?

Odoberať

Get notified when there's activity on this post

This question has been flagged
accountingfilter
2 Replies
4535 Zobrazenia
Avatar
RALPH IDOKO

The requirement is to have a menu that will display account move line entries with expense account selected on the vendor bills. If taxes are applied, the listing should include all tax entries.  See the expected output: https://i.sstatic.net/2A4IgAM6.jpg.

See my current domain:

<record id="action_account_move_line" model="ir.actions.act_window">
    <field name="name">Expense Analysis</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">account.move.line</field>
    <field name="view_mode">tree,pivot,graph</field>
    <field name="domain">[('account_id.deprecated', '=', False),('account_id.internal_group', 'in', ['expense']),('exclude_from_invoice_tab','=',False)]</field>
    <field name="view_id" eval="expense_line_tree_view"/>
</record>

The above domain only fetched the move line entries without the taxes. See the current result: https://i.sstatic.net/JXR7852C.jpg

Gracia.

0
Avatar
Zrušiť
Avatar
RALPH IDOKO
Autor Best Answer

Thank you Andry. Your suggested workaround was so invaluable. However, hard-coding IDs into domain might cause avoidable issues further down the line especially if you are not working with a final version of your database as the IDs will be regenerated if a new database is created.

My adopted approach was to create an sql view with init method containing sql statements using UNION and JOIN. That way, it became easy to grab the desired tables and fields.

See complete class below:

from odoo import models, fields, tools

class ExpenseAnalysisWithTaxes(models.Model):
_name = ".expense.analysis.with.taxes"
_description = "Expense Analysis"
_auto = False # This is a SQL view, not a normal table

id = fields.Integer("ID", readonly=True)
date = fields.Date("Date", readonly=True)
name = fields.Char("Description of Job", readonly=True)
move_name = fields.Char("Payment Reference", readonly=True)
partner_id = fields.Many2one("res.partner", "Partner", readonly=True)
account_id = fields.Many2one("account.account", "Account", readonly=True)
account_name = fields.Char("Account Name", readonly=True)
price_subtotal = fields.Monetary("Total Amount", readonly=True)
currency_id = fields.Many2one("res.currency", "Currency", readonly=True, default=lambda self: self.env.company.currency_id)

def init(self):
"""Create the SQL view dynamically when the module is installed or updated."""
tools.drop_view_if_exists(self._cr, "expense_analysis_with_taxes")
self._cr.execute("""
CREATE OR REPLACE VIEW expense_analysis_with_taxes AS (
-- Expense lines
SELECT
aml.id AS id,
aml.date AS date,
aml.name AS name,
am.name AS move_name,
aml.partner_id AS partner_id,
aml.account_id AS account_id,
aa.name AS account_name,
aml.price_total AS price_subtotal
FROM account_move_line aml
JOIN account_account aa ON aml.account_id = aa.id
JOIN account_move am ON aml.move_id = am.id
WHERE am.move_type IN ('in_invoice','in_receipt')
AND aa.internal_group = 'expense'

UNION ALL

-- Tax lines (identified via tax_line_id)
SELECT
aml.id AS id,
aml.date AS date,
CONCAT('Tax: ', at.name) AS name,
am.name AS move_name,
aml.partner_id AS partner_id,
aml.account_id AS account_id,
aa.name AS account_name,
ABS(aml.price_subtotal) AS price_subtotal
FROM account_move_line aml
JOIN account_account aa ON aml.account_id = aa.id
JOIN account_move am ON aml.move_id = am.id
JOIN account_tax at ON aml.tax_line_id = at.id
WHERE am.move_type IN ('in_invoice','in_receipt')
) ORDER BY id DESC;
""")
Based on this, I then defined a menu, window action and tree view.

Hope this helps someone.


0
Avatar
Zrušiť
Avatar
Andry Ang
Best Answer

Hi Raplh,

I have a workaround for your case. First you need to know few things:

  1. Tax payable is a liabilities account which have a different account_type than expense
  2. There is no grouping on tax payable accounts except you create one for them
  3. You used filter on internal_group, this includes 3 account types: Expenses, Depreciation, and Cost of Revenue. Double check if you really need "internal_group" or "account_type"

For tax accounts, you might need to hard code the ids into the domain tuples.

Hope this helps

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
a favorites or bookmarking needed!
configuration accounting filter
Avatar
0
jan 25
1212
filter all contacts from "active" companies
accounting filter contacts
Avatar
Avatar
1
nov 22
2784
{{GUIA`$Avianca$𓆩×͜×𓆪 𝐏𝐀}}¿Cómo llamar a Avianca desde Panamá?
accounting
Avatar
0
nov 25
58
Invoice Printing Error in Odoo V19 – GCC/Saudi Localization
accounting
Avatar
Avatar
1
nov 25
172
After Odoo 18 to Odoo 19 upgrade - how do I manage Bills for products that already posted to the interim account? - مشكلة بعد الترقية من Odoo 18 إلى Odoo 19.
accounting
Avatar
Avatar
1
nov 25
213
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