Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

How to avoid double entry?

Odebírat

Get notified when there's activity on this post

This question has been flagged
functionentriesinsertsale.orderduplicate
5080 Zobrazení
Avatar
evon_dun

I added a field cartage about an half year ago, and i tried adding another field the exact same way. I get only one issue that is the entry i insert gets a double insert. Please anyone could help?

>     def _amount_all(self, cr, uid, ids, field_name, arg, context=None):
>         cur_obj = self.pool.get('res.currency')
>         res = {}
>         cartageflag = 'false'
>         ordercartageflag = 'true'
>         line_id = 0
>         order_id = 0
>         cartage_price = 0
>         oldcartage = 0
>         oldlabour = 0
>         labour_price = 0
>         labourflag = 'false'
>         orderlabourflag = 'true'
>         checklabourflag = 'false'
>         oid = 0
> 
> 
>         for order in self.browse(cr, uid, ids, context=context):
>             res[order.id] = {
>                 'amount_untaxed': 0.0,
>                 'amount_tax': 0.0,
>                 'amount_total': 0.0,
>           }
>             val = val1 = 0.0
>             cur = order.pricelist_id.currency_id        
> 
>             if order.cartage > 0.0:
>                 cartageflag = 'true'
>             if order.labour > 0.0:
>                 labourflag = 'true'
> 
>             for line in order.order_line:
>                 if cartageflag == 'true':
>                     if line.name == 'Cartage':
>                         ordercartageflag = 'false'            line_id
> = line.id             oldcartage = line.price_unit            cr.execute('update
> sale_order_line set price_unit=%s
> where id=%s',(order.cartage,line.id,))
>       
>           #line.update({'price_unit':order.cartage})
>       if labourflag == 'true':
>                     if line.name == 'Labour':
>                         orderlabourflag = 'false'
>                         line_id = line.id
>                         oldlabour = line.price_unit
>                         cr.execute('update sale_order_line set
> price_unit=%s where
> id=%s',(order.labour,line.id,))
>                 val1 += line.price_subtotal
>                 val += self._amount_line_tax(cr, uid, line,
> context=context)             
> 
>             res[order.id]['amount_tax'] =
> cur_obj.round(cr, uid, cur, val)
>             res[order.id]['amount_untaxed'] =
> cur_obj.round(cr, uid, cur, val1)
>             res[order.id]['amount_total'] =
> res[order.id]['amount_untaxed'] +
> res[order.id]['amount_tax']
>             
>             if ordercartageflag == 'true':
>                 res[order.id]['amount_total'] =
> res[order.id]['amount_total'] +
> order.cartage            
>             elif ordercartageflag == 'false':
>                 if oldcartage != order.cartage:
>                     res[order.id]['amount_total'] =
> (res[order.id]['amount_total'] +
> order.cartage) - oldcartage
>                     
>             if orderlabourflag == 'true':
>                 res[order.id]['amount_total'] =
> res[order.id]['amount_total'] +
> order.labour            
>             elif orderlabourflag == 'false':
>                 if oldlabour != order.labour:
>                     res[order.id]['amount_total'] =
> (res[order.id]['amount_total'] +
> order.labour) - oldlabour
> 
> 
>         
>         oid = order.id
>         if cartageflag == 'true' and ordercartageflag == 'true':
>             self.pool.get('sale.order.line').create(cr,
> uid, {
>                 'order_id':oid,
>                 'name':'Cartage',               
>                 'price_unit':order.cartage,
>                 'product_uos_qty':1,                
>                 'product_uom':1,
>                 'product_uom_qty':1,
>                 'delay':7,
>                 'discount': 0.0})
> 
>             if labourflag == 'true' and orderlabourflag == 'true':
>                 self.pool.get('sale.order.line').create(cr,
> uid, {
>                     'order_id':oid,
>                     'name':'Labour',               
>                     'price_unit':order.labour,
>                     'product_uos_qty':1,                
>                     'product_uom':1,
>                     'product_uom_qty':1,
>                     'delay':7,
>                     'discount': 0.0})




        return res
0
Avatar
Zrušit
Enjoying the discussion? Don't just read, join in!

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Function _get_default_shop
function sale.order
Avatar
Avatar
1
bře 15
3545
How to remove duplicate products from the system without affecting sales orders for those duplicate products ? Vyřešeno
sales product sale.order duplicate
Avatar
Avatar
Avatar
Avatar
3
led 24
16346
List quotations + sale orders from within a function
function view quotation sale.order
Avatar
0
úno 16
3620
How can I hide the 'duplicate' option in the 'more' button for a specific object Vyřešeno
duplicate
Avatar
Avatar
Avatar
Avatar
Avatar
4
říj 25
16811
production of not enough materials for a PO
function
Avatar
Avatar
Avatar
2
zář 25
1183
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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