Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • Apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Godkendelser
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-virksomhedsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp

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

  • CRM
  • e-Commerce
  • Bogføring
  • Lager
  • PoS
  • Projekt
  • MRP
All apps
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Hjælp

How to sum of them separate from currencies?

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
orders
3 Besvarelser
8422 Visninger
Avatar
Rick

Hi,guys

we have a difficult question

On same sale order need to show multi currencies,but how to sum of separate from them?

E.g:

Total:

USD 500.00

EUR 200.00

CNY 100

Any good idea?

0
Avatar
Kassér
fasluca

Currency comes from price list. you can only select one currency for a price list..then how you are going to set this three currencies in same SO?

in which currency you want the sum??

Rick
Forfatter

Tks for your reply.There is only one currency on the same sales order that does not meet my requirements.I need multi currencies on same sales order.

fasluca

So you may have customized SO line to set different currency in each line..

You have to enable multi currency and one of them should be Base..

you haven't said which one is your base currency? ie in which currency you wan the sum)

Rick
Forfatter

My base currency is CNY, Now I can sum the base currency. In addition I need to sum these foreign currency lines

fasluca

if you have currency field in SO line...then you can calculate total easily

for line in self.order_line:

if line.currency_id.name == USD:

usd_total += line.subtotal

if line.currency_id.name == EUR:

eur_total += line.subtotal

if line.currency_id.name == CYN:

cyn_total += line.subtotal

like this

Rick
Forfatter

super!I'll try it! Thanks

fasluca

Make it as answer if you succeed

Rick
Forfatter

okay.

Avatar
Artem
Bedste svar

It is really hard to show or I know nothing about Odoo.

Add to your model something like this

@api.one
def _compute_amount_each_currency(self):
sums=dict([(l.currency_id.name,0) for l in self.expense_ticket_line_ids])
for line in self.expense_ticket_line_ids:
sums[line.currency_id.name]+=line.amount_currency
 self.amount_each_currency=json.dumps(sums)
amount_each_currency = fields.Text(compute='_compute_amount_each_currency')

So we have got the field with the sums for each currency. This is the easiest part.

And now show time!

I'm still upset that <templetes> is available only in a kanban view. Am I right?

So in a form view I see only two ways. The first is to add another text field with appropriate text like 'Totals EUR: xxx, CYN: xxx, USD: xxx' in one line and add this field to the view. Baldly but I can't find another way.

A report is more flexible and here we can make it nice looking.  Create a model with the render_html function

class ReportSometing(models.AbstractModel):
    @api.one
    def render_html(self, data=None):
    [...]
    if objects[0]:
     sums=json.loads(objects[0].amount_each_currency)
      sums=[[key,value] for key,value in sums.items()]
    else:
     sums=[]
    docargs = {
        'sums': sums,
    }
    [...]

and convert the field with each currency totals into the list of lists of a currency name and its amount.

Insert into the report something like the following and get the profit.

<t t-foreach="sums" t-as="i">
     <p><t t-esc="i[0]"/><t t-esc="i[1]"/></p>
</t>

Season with any decoration.


Well.. the second way is to create a separate table with sums for each currency like the class AccountInvoiceLine(models.Model). The code is in brief. I did not test the whole idea.

class ExpenseTicket(models.Model):
    expense_ticket_currency_ids = fields.One2many('expense.ticket.currency', 'expenseticket_id')

class ExpenseTicketCurrency(models.Model):
_name = "expense.ticket.currency"
expenseticket_id = fields.Many2one('expense.ticket', string='', ondelete='cascade', index=True)
    currency_id = fields.Many2one('res.currency',string='Currency')
    amount_currency=fields.Monetary(string='Amount', currency_field='currency_id')

In a view we can use 'tree'

<field name="expense_ticket_currency_ids">
 <tree string="">
 <field name="currency_id"/>
 <field name="amount_currency"/>
 </tree>
</field>

The last part is to write functions to store data into ExpenseTicketCurrency.

0
Avatar
Kassér
Avatar
Rick
Forfatter Bedste svar

Question again

 

There are some products(services type) on the sales order line of the same sales order, which are in different currencies.

How to sum them group by different currencies and show on sale order form?

E.g:

Ocean Freight USD 10.00

Truck charge USD 5.00

Documents Fee EUR 50.00

Discharge Fee CNY 100


                                      Total : USD xx.xx

                                                  EUR xx.xx

                                                  CNY xx.xx

                                                                                    

Any good idea?

0
Avatar
Kassér
Artem

The answer is below. I do not know your format of invoice lines but referring to invoice lines of the standard accounting module the code should be changed and added to '_compute_amount(self)' of the AccountInvoice.

amount_untaxed_sums=dict([(l.currency_id.name,0) for l in self.invoice_line_ids])

for line in self.invoice_line_ids:

amount_untaxed_sums[line.currency_id.name]+=line.price_subtotal

I did not test the code in Odoo but it should work.

Rick
Forfatter

Tks for your reply.I'll try it .

Artem

The code sums up perfectly, but I have problems with the show part.

Artem

Please check my answer I believe it contains many good ideas.

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

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

Tilmeld dig
Related Posts Besvarelser Visninger Aktivitet
[newbie] order management only
orders
Avatar
2
okt. 25
3224
Odoo 17 Online, how to create purchase orders for non stock goods
orders
Avatar
Avatar
1
mar. 24
3417
Create a new order line on a sale order with Automated Action Løst
orders
Avatar
Avatar
1
mar. 23
6927
How Can Admin Receive Notification for Order placed in Shop - Odoo 10
orders
Avatar
Avatar
Avatar
2
mar. 21
10538
Creating recurring invoice Løst
orders subscription
Avatar
Avatar
Avatar
2
okt. 25
16776
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة 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 er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

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