Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

how to change default digits of precision?

Naroči se

Get notified when there's activity on this post

This question has been flagged
_inherits
1 Odgovori
20392 Prikazi
Avatar
binfeng
from openerp.osv import osv, fields

import openerp.addons.decimal_precision as dp

class mrp_bom(osv.osv): _inherit = 'mrp.bom' _columns = {

    'cost_price': fields.related('product_id','cost_price',type='float',**digits_compute = dp.get_precision('Product Price')**,relation="product.product", string="Cost Parts Of Bom", store=False),
        }

I want to inherit ‘mrp.bom' to add a field,but i can not change default digits of precision, How can i do that?

0
Avatar
Opusti
Avatar
Thierry Godin
Best Answer

Hi , you can change decimal precision by going to :

Configuration / Technical / DB Structure/ Decimal precision

Best regards

Edit : You may take a look at point_of_sale/static/src/js/widget_base.js around line 20

build_currency_template: function(){

            if(this.pos && this.pos.get('currency')){
                this.currency = this.pos.get('currency');
            }else{
                this.currency = {symbol: '$', position: 'after', rounding: 0.01};
            }

            var decimals = Math.max(0,Math.ceil(Math.log(1.0 / this.currency.rounding) / Math.log(10)));

            this.format_currency = function(amount){
                if(typeof amount === 'number'){
                    amount = Math.round(amount*100)/100;
                    amount = amount.toFixed(decimals);
                }
                if(this.currency.position === 'after'){
                    return amount + ' ' + this.currency.symbol;
                }else{
                    return this.currency.symbol + ' ' + amount;
                }
            }

        },

You can change the decimal value here :

this.currency = {symbol: '$', position: 'after', rounding: 0.01};

format_currency() is the function called in pos.xml to display prices.

<t t-name="ProductWidget">
        <li class='product'>
            <a href="#">
                <div class="product-img">
                    <img src='' /> <!-- the product thumbnail -->
                    <t t-if="!widget.model.get('to_weight')">
                        <span class="price-tag">
                            <t t-esc="widget.format_currency(widget.model.get('price'))"/>   
                        </span>
                    </t>
                    <t t-if="widget.model.get('to_weight')">
                        <span class="price-tag">
                            <t t-esc="widget.format_currency(widget.model.get('price'))+'/Kg'"/>
                        </span>
                    </t>
                </div>
                <div class="product-name">
                    <t t-esc="widget.model.get('name')"/>
                </div>
            </a>
        </li>
    </t>

Maybe you have to reload OpenERP

0
Avatar
Opusti
binfeng
Avtor

I have changed the 'Product Price' digits to 4,but here inherit cost_price still is 2.

Thierry Godin

Just for let you know that I have updated my answer.

binfeng
Avtor

Thank you very much! It is very hard to me.whatever I will try.

Enjoying the discussion? Don't just read, join in!

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

Prijavi
Related Posts Odgovori Prikazi Aktivnost
unable to add column in res.users table Solved
_inherits
Avatar
Avatar
Avatar
Avatar
Avatar
17
dec. 21
25741
Reg - _inherits OpenERP
_inherits
Avatar
Avatar
1
jul. 15
7801
TypeError: The model "fleet.vehicle" specifies an unexisting parent class "fleet.vehicle"
_inherits
Avatar
Avatar
Avatar
2
mar. 15
9646
aading a new menuitem in fleet module
_inherits
Avatar
Avatar
2
mar. 15
6168
inherited view from base_calendar view
_inherits
Avatar
Avatar
2
mar. 15
11466
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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