Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Discuss
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

How to edit Total value from order form

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
ordertotal
15 Replies
7946 Tampilan
Avatar
Matthieu

Hello,


I tried differents things but my problem is that I don't know how to edit one field in the order form of point of sale. I'm currently using Odoo 9.

You can see the field, in the red circle, here :

http://i.imgur.com/DjEYJiS.png

Maybe, the changes to do are in a python or javascript file.


Please, help me.


Thanks.

0
Avatar
Buang
Juan Vicente Pascual

search for the text 'def _amount_all_wrapper' in sale module so you can see what this method do, then you need to override it creating a custom module. What kind of change do you want to make to the amount_total field?

Matthieu
Penulis

Hi Juan, Thank you for your help ! I searched in the sale module and I also did a "cat * | grep -R -e "_amount_all_wrapper" > /home/matthieu/result.txt but I didn't found it, it's why I'm asking for the file to find it. To answer your question, I did a custom module and I need to add to this value the value of the attribute "coupon_nb" from an inherit of pos_order from Point Of Sale. Thanks so much for your help !

Avatar
Matthieu
Penulis Jawaban Terbai

Finally, it works.

My code is here :

class pos_order(osv.osv):

_name = 'pos.order'

_inherit = 'pos.order'

def _amount_all(self, cr, uid, ids, name, args, context=None):

res = super(pos_order, self)._amount_all(cr, uid, ids, name, args, context)

for order in self.browse(cr, uid, ids, context=context):

res[order.id]['amount_total'] += 42

return res

_columns = {

'amount_tax': fields.function(_amount_all, string='Taxes', digits=0, multi='all'),

'amount_total': fields.function(_amount_all, string='Total', digits=0, multi='all'),

'amount_paid': fields.function(_amount_all, string='Paid', states={'draft': [('readonly', False)]}, readonly=True, digits=0, multi='all'),

'amount_return': fields.function(_amount_all, string='Returned', digits=0, multi='all'),

}





0
Avatar
Buang
Avatar
Prakash
Jawaban Terbai

the field you are considering is the function/compute fields ,you can't change it value from front end , you can change it value only by overriding the _amount_all    method only.


@api.depends('order_line.price_total')
def _amount_all(self):
for order in self:
    amount_untaxed = amount_tax = 0.0
for line in order.order_line:
    amount_untaxed += line.price_subtotal
    amount_tax += line.price_tax
 order.update({
'amount_untaxed': order.pricelist_id.currency_id.round(amount_untaxed),
'amount_tax': order.pricelist_id.currency_id.round(amount_tax),
'amount_total': amount_untaxed + amount_tax,
 })

in odoo9 https://github.com/odoo/odoo/blob/9.0/addons/sale/sale.py#L24 


amount_total = fields.Monetary(string='Total', store=True, readonly=True, compute='_amount_all', track_visibility='always')
1
Avatar
Buang
Matthieu
Penulis

Thank you, but where is this method ? I've only found in point_of_sale.py : 'amount_total': fields.function(_amount_all, string='Total', digits=0, multi='all')

Prakash

Hi Matthieu , i have update my answer above ,just open this link https://github.com/odoo/odoo/blob/9.0/addons/sale/sale.py#L24

Matthieu
Penulis

Ok, but my value is from an inherit of pos.order (https://github.com/odoo/odoo/blob/9.0/addons/point_of_sale/point_of_sale.py). So if I want to add it to amount_total of sale.py, how can I do ? Manythanks for your help !

OdooBot
open this https://github.com/odoo/odoo/blob/9.0/addons/point_of_sale/point_of_sale.py#L842

On Wed, May 11, 2016 at 11:01 PM, Matthieu <matthieu.artaud@gmail.com> wrote:

Ok, but my value is from an inherit of pos.order (https://github.com/odoo/odoo/blob/9.0/addons/point_of_sale/point_of_sale.py). So if I want to add it to amount_total of sale.py, how can I do ? Manythanks for your help !

--
Matthieu

Sent by Odoo S.A. using Odoo

Matthieu
Penulis

Well, if this can really modify the field "Total" of orders, I think I didn't inherit it correctly. Here is my code : http://pastebin.com/1xF83Nt1 But the value is not changed at all :( Thanks a lot for all the answers !

Matthieu
Penulis

I tried differents things : -> I tried to directly edit the point_of_sale.py and I edited the line as it : res[order.id]['amount_total'] = res[order.id]['amount_tax'] + amount_untaxed + 42. The result was changed, so it was a sucess. -> I added a log in my function to see if it is executed. The log message was not written so I think the problem is that my function is not overriting the original one at all. I gonna try to see why, but if you find the problem, help me please !

Juan Vicente Pascual

Have you added the module name in the __openerp__.py file in depends tag?

Matthieu
Penulis

I have found the reason : the function name is _amount_all But the functions wich start with underscore (_) are private. So I can't inherit it.

Matthieu
Penulis

Yes, Juan, I did it

Avatar
Juan Vicente Pascual
Jawaban Terbai

The function you need is in the sale module in file sale.py,

this is the code,

def _amount_all_wrapper(self, cr, uid, ids, field_name, arg, context=None):

""" Wrapper because of direct method passing as parameter for function fields """

return self._amount_all(cr, uid, ids, field_name, arg, context=context)

def _amount_all(self, cr, uid, ids, field_name, arg, context=None):

cur_obj = self.pool.get('res.currency')

res = {}

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

for line in order.order_line:

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']

return res

just override the function  _amount_all  to change the price based on your coupon.

This functions are from v8.

Kind regards.

0
Avatar
Buang
Matthieu
Penulis

Thank you, this function doesn't exist anymore in Odoo 9 but I think _amount_all is the same, up to date. I'll try !

Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
How to modify amount_total from pos_order
order total amount
Avatar
Avatar
Avatar
4
Mei 16
5531
How can I change the address of my Warehouse (Purchase Order)? Diselesaikan
order
Avatar
Avatar
1
Jan 24
3111
OrderReceipt.xml
order
Avatar
Avatar
1
Des 22
4074
How to display 'total' under a column containing numeric values in tree view Diselesaikan
total
Avatar
Avatar
1
Okt 24
26776
Discount on Purchase order
order
Avatar
Avatar
Avatar
2
Agu 21
3821
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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