Zum Inhalt springen
Odoo Menü
  • Anmelden
  • Jetzt gratis testen
  • Apps
    Finanzen
    • Buchhaltung
    • Rechnungsstellung
    • Spesenabrechnung
    • Tabellenkalkulation (BI)
    • Dokumente
    • E-Signatur
    Vertrieb
    • CRM
    • Vertrieb
    • Kassensystem – Shop
    • Kassensystem – Restaurant
    • Abonnements
    • Vermietung
    Websites
    • Website-Builder
    • E-Commerce
    • Blog
    • Forum
    • Livechat
    • E-Learning
    Lieferkette
    • Lager
    • Fertigung
    • PLM
    • Einkauf
    • Wartung
    • Qualität
    Personalwesen
    • Mitarbeiter
    • Personalbeschaffung
    • Abwesenheiten
    • Mitarbeiterbeurteilung
    • Personalempfehlungen
    • Fuhrpark
    Marketing-
    • Social Marketing
    • E-Mail-Marketing
    • SMS-Marketing
    • Veranstaltungen
    • Marketing-Automatisierung
    • Umfragen
    Dienstleistungen
    • Projekte
    • Zeiterfassung
    • Außendienst
    • Kundendienst
    • Planung
    • Termine
    Produktivität
    • Dialog
    • Genehmigungen
    • IoT
    • VoIP
    • Wissensdatenbank
    • WhatsApp
    Apps von Drittanbietern Odoo Studio Odoo Cloud-Plattform
  • Branchen
    Einzelhandel
    • Buchladen
    • Kleidergeschäft
    • Möbelhaus
    • Lebensmittelgeschäft
    • Baumarkt
    • Spielwarengeschäft
    Essen & Gastgewerbe
    • Bar und Kneipe
    • Restaurant
    • Fast Food
    • Gästehaus
    • Getränkehändler
    • Hotel
    Immobilien
    • Immobilienagentur
    • Architekturbüro
    • Baugewerbe
    • Immobilienverwaltung
    • Gartenarbeit
    • Eigentümervereinigung
    Beratung
    • Buchhaltungsfirma
    • Odoo-Partner
    • Marketingagentur
    • Anwaltskanzlei
    • Talentakquise
    • Prüfung & Zertifizierung
    Fertigung
    • Textil
    • Metall
    • Möbel
    • Speisen
    • Brauerei
    • Firmengeschenke
    Gesundheit & Fitness
    • Sportklub
    • Brillengeschäft
    • Fitnessstudio
    • Therapeut
    • Apotheke
    • Friseursalon
    Handel
    • Handyman
    • IT-Hardware & -Support
    • Solarenergiesysteme
    • Schuster
    • Reinigungsdienstleistungen
    • HLK-Dienstleistungen
    Sonstiges
    • Gemeinnützige Organisation
    • Umweltschutzagentur
    • Plakatwandvermietung
    • Fotostudio
    • Fahrrad-Leasing
    • Software-Händler
    Alle Branchen ansehen
  • Community
    Lernen
    • Tutorials
    • Dokumentation
    • Zertifizierungen
    • Schulung
    • Blog
    • Podcast
    Bildung fördern
    • Bildungsprogramm
    • Scale-Up! Planspiel
    • Odoo besuchen
    Software anfragen
    • Herunterladen
    • Editionen vergleichen
    • Releases
    Zusammenarbeiten
    • Github
    • Forum
    • Veranstaltungen
    • Übersetzungen
    • Partner werden
    • Dienstleistungen für Partner
    • Buchhaltungsfirma registrieren
    Services anfragen
    • Partner finden
    • Buchhalter finden
    • Einen Experten treffen
    • Implementierungsservices
    • Kundenreferenzen
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Eine Demo erhalten
  • Preiskalkulation
  • Hilfe

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

  • CRM
  • e-Commerce
  • Buchhaltung
  • Lager
  • PoS
  • Projekte
  • MRP
All apps
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Hilfe

How to change tax computation in odoo9 with my custom module and avoid breaking things?

Abonnieren

Erhalten Sie eine Benachrichtigung, wenn es eine Aktivität zu diesem Beitrag gibt

Diese Frage wurde gekennzeichnet
accountinginheritancetaxodooodoo9
4786 Ansichten
Avatar
Klo

I want to add a module that will change tax computation (def _compute_all in class account.tax) if special check box (field.Boolean) in form view is checked. I use check box since I think it gives clearer information to the user is it active or not.

I just can't get it to work. Fields (float and boolean checkbox) were added and usable but odoo just ignores my changes in tax computation (I test it in POS by adding few products with my custom tax with custom computation).


What is the proper way to do this (way that will not break stuff in the future) and that will work with other modules (basically use same data fields as original odoo-made account module)?


1. Am I even looking at the right method (def_compute_all), class(account.tax) and module (account)?

2. Where is the actual class and method that gives final result to other modules (like POS, Sales, rest of Accounting) and fields?

3. Is that code with  @api.v8 and @api.v7 just legacy, or do I have to dynamically change it too?

4. Is there any documentation on developing accounting or tax modules? I am completely lost .


original compute_all method in class AccountTax in module accounting (that might be totally wrong method to change dynamically, or even wrong class?)

def _compute_amount(self, base_amount, price_unit, quantity=1.0, product=None, partner=None):
    self.ensure_one()
    if self.amount_type == 'fixed':
        return math.copysign(self.amount, base_amount) * quantity
    if (self.amount_type == 'percent' and not self.price_include) or (self.amount_type == 'division' and self.price_include):
        return base_amount * self.amount / 100
    if self.amount_type == 'percent' and self.price_include:
        return base_amount - (base_amount / (1 + self.amount / 100))
    if self.amount_type == 'division' and not self.price_include:
        return base_amount / (1 - self.amount / 100) - base_amount


my module:

class MyTaxCompute(models.Model):
    _inherit = 'account.tax'

    custom_tax = fields.Boolean(string='Custom tax computation')
    custom_tax_field1 = fields.Float(string='Tax 1')
    custom_tax_field2 = fields.Float(string='Tax 2')
    
        def _compute_amount(self, base_amount, price_unit, quantity=1.0, product=None, partner=None):         if self.custom_tax:         #my code here         #res = ...         else:         res = super(MyTaxCompute, self)._compute_amount(base_amount, price_unit, quantity, product, partner)     return res


my view

<record id="view_tax_form_inherited" model="ir.ui.view">
    <field name="name">account.tax.form.inherited</field>
    <field name="model">account.tax</field>
    <field name="inherit_id" ref="account.view_tax_form"/>
    <field name="arch" type="xml">

        <xpath expr="//page/group" position="after">
<!-- my custom boolean selection field -->
            <field name="custom_tax" string="Custom tax computation"/>
<!-- my custom float fields to put tax rates in -->
            <field name="custom_tax_field1" string="Tax 1"/>
            <field name="custom_tax_field2" string="Tax 2"/>
        </xpath>
    </field>
</record> 
0
Avatar
Verwerfen
Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!

Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!

Registrieren
Verknüpfte Beiträge Antworten Ansichten Aktivität
Setting up tax cloud on Odoo v10
accounting tax odoo
Avatar
2
Sept. 17
3893
Accounting Sale Entries have no taxes if generated via PoS (Odoo9) Gelöst
accounting pos tax odoo9
Avatar
Avatar
2
Juli 16
3706
Indian GST based pos bill
accounting tax tag GST odoo9
Avatar
Avatar
1
Mai 18
6591
How to use sales and purchase of OpenERP 7 together with accounting of Odoo 9
accounting reporting openerp7 odoo odoo9
Avatar
Avatar
1
Jan. 16
3434
Add custom filter in financial reports odoo17
accounting odoo
Avatar
Avatar
Avatar
3
Jan. 25
8132
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Herunterladen
  • Github
  • Runbot
  • Übersetzungen
Dienstleistungen
  • Odoo.sh-Hosting
  • Support
  • Upgrade
  • Individuelle Entwicklungen
  • Bildung
  • Buchhalter finden
  • Partner finden
  • Partner werden
Über uns
  • Unsere Firma
  • Markenwerte
  • Kontakt
  • Karriere
  • Veranstaltungen
  • Podcast
  • Blog
  • Kunden
  • Rechtliches • Datenschutz
  • Sicherheit
الْعَرَبيّة 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 ist eine Suite von Open-Source-Betriebsanwendungen, die alle Bedürfnisse Ihres Unternehmens abdecken: CRM, E-Commerce, Buchhaltung, Lager, Kassensystem, Projektmanagement etc.

Das einzigartige Wertversprechen von Odoo ist, dass es gleichzeitig sehr einfach zu bedienen und voll integriert ist.

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