Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Sociale media-marketing
    • E-mailmarketing
    • Sms-marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

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

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
accountinginheritancetaxodooodoo9
4785 Weergaven
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
Annuleer
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
Setting up tax cloud on Odoo v10
accounting tax odoo
Avatar
2
sep. 17
3893
Accounting Sale Entries have no taxes if generated via PoS (Odoo9) Opgelost
accounting pos tax odoo9
Avatar
Avatar
2
jul. 16
3706
Indian GST based pos bill
accounting tax tag GST odoo9
Avatar
Avatar
1
mei 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
8131
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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