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
    • Diskusi
    • 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

convert function from odoo14 to odoo 16 with custom updates

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
upgradeodoo16features
3099 Tampilan
Avatar
Asmaa

I am trying to upgrade custom module in odoo14 to odoo16
the code in custom 14 override  _prepare_move_line_default_vals function an d made changes in it this is the code:


def _prepare_move_line_default_vals(self, write_off_line_vals=None):
''' Prepare the dictionary to create the default account.move.lines for the current payment.
:param write_off_line_vals: Optional dictionary to create a write-off account.move.line easily containing:
* amount: The amount to be added to the counterpart amount.
* name: The label to set on the line.
* account_id: The account on which create the write-off.
:return: A list of python dictionary to be passed to the account.move.line's 'create' method.
'''
self
.ensure_one()
write_off_line_vals = write_off_line_vals or {}

if not self.journal_id.payment_debit_account_id or not self.journal_id.payment_credit_account_id:
raise UserError(_(
"You can't create a new payment without an outstanding payments/receipts account set on the %s journal.",
self
.journal_id.display_name))

# Compute amounts.
write_off_amount = write_off_line_vals.get('amount', 0.0)

if self.payment_type == 'inbound':
# Receive money.
counterpart_amount = -self.amount
write_off_amount *= -1
elif self
.payment_type == 'outbound':
# Send money.
counterpart_amount = self.amount
else:
counterpart_amount = 0.0
write_off_amount = 0.0

balance = counterpart_amount / self.currency_rate
counterpart_amount_currency = counterpart_amount
write_off_balance = self.currency_id._convert(write_off_amount, self.company_id.currency_id, self.company_id, self.date)
write_off_amount_currency = write_off_amount
currency_id = self.currency_id.id

if self.is_internal_transfer:
if self.payment_type == 'inbound':
liquidity_line_name = _('Transfer to %s', self.journal_id.name)
else: # payment.payment_type == 'outbound':
liquidity_line_name = _('Transfer from %s', self.journal_id.name)
else:
liquidity_line_name = self.payment_reference

# Compute a default label to set on the journal items.

payment_display_name = {
'outbound-customer': _("Customer Reimbursement"),
'inbound-customer'
: _("Customer Payment"),
'outbound-supplier'
: _("Vendor Payment"),
'inbound-supplier'
: _("Vendor Reimbursement"),
}

default_line_name = self.env['account.move.line']._get_default_line_name(
_("Internal Transfer") if self.is_internal_transfer else payment_display_name['%s-%s' % (self.payment_type, self.partner_type)],
self
.amount,
self
.currency_id,
self
.date,
partner
=self.partner_id,
)

line_vals_list = [
# Liquidity line.
{
'name': liquidity_line_name or default_line_name,
'date_maturity'
: self.date,
'amount_currency'
: -counterpart_amount_currency,
'currency_id'
: currency_id,
'debit'
: balance < 0.0 and -balance or 0.0,
'credit'
: balance > 0.0 and balance or 0.0,
'partner_id'
: self.partner_id.id,
'account_id'
: self.journal_id.payment_debit_account_id.id if balance < 0.0 else self.journal_id.payment_credit_account_id.id,
},
# Receivable / Payable.
{
'name': self.payment_reference or default_line_name,
'date_maturity'
: self.date,
'amount_currency'
: counterpart_amount_currency + write_off_amount_currency if currency_id else 0.0,
'currency_id'
: currency_id,
'debit'
: balance + write_off_balance > 0.0 and balance + write_off_balance or 0.0,
'credit'
: balance + write_off_balance < 0.0 and -balance - write_off_balance or 0.0,
'partner_id'
: self.partner_id.id,
'account_id'
: self.destination_account_id.id,
},
]
if write_off_balance:
# Write-off line.
line_vals_list.append({
'name': write_off_line_vals.get('name') or default_line_name,
'amount_currency'
: -write_off_amount_currency,
'currency_id'
: currency_id,
'debit'
: write_off_balance < 0.0 and -write_off_balance or 0.0,
'credit'
: write_off_balance > 0.0 and write_off_balance or 0.0,
'partner_id'
: self.partner_id.id,
'account_id'
: write_off_line_vals.get('account_id'),
})
return line_vals_list




i need to convert it to odoo16 with the same changes in custom 14 how can i do that?
this the code of this function in odoo 16:
def _prepare_move_line_default_vals(self, write_off_line_vals=None):
''' Prepare the dictionary to create the default account.move.lines for the current payment.
:param write_off_line_vals: Optional list of dictionaries to create a write-off account.move.line easily containing:
* amount: The amount to be added to the counterpart amount.
* name: The label to set on the line.
* account_id: The account on which create the write-off.
:return: A list of python dictionary to be passed to the account.move.line's 'create' method.
'''
self
.ensure_one()
write_off_line_vals = write_off_line_vals or {}

if not self.outstanding_account_id:
raise UserError(_(
"You can't create a new payment without an outstanding payments/receipts account set either on the company or the %s payment method in the %s journal.",
self
.payment_method_line_id.name, self.journal_id.display_name))

# Compute amounts.
write_off_line_vals_list = write_off_line_vals or []
write_off_amount_currency = sum(x['amount_currency'] for x in write_off_line_vals_list)
write_off_balance = sum(x['balance'] for x in write_off_line_vals_list)

if self.payment_type == 'inbound':
# Receive money.
liquidity_amount_currency = self.amount
elif self.payment_type == 'outbound':
# Send money.
liquidity_amount_currency = -self.amount
else:
liquidity_amount_currency = 0.0

liquidity_balance = self.currency_id._convert(
liquidity_amount_currency,
self
.company_id.currency_id,
self
.company_id,
self
.date,
)
counterpart_amount_currency = -liquidity_amount_currency - write_off_amount_currency
counterpart_balance = -liquidity_balance - write_off_balance
currency_id = self.currency_id.id

# Compute a default label to set on the journal items.
liquidity_line_name = ''.join(x[1] for x in self._get_liquidity_aml_display_name_list())
counterpart_line_name = ''.join(x[1] for x in self._get_counterpart_aml_display_name_list())

line_vals_list = [
# Liquidity line.
{
'name': liquidity_line_name,
'date_maturity'
: self.date,
'amount_currency'
: liquidity_amount_currency,
'currency_id'
: currency_id,
'debit'
: liquidity_balance if liquidity_balance > 0.0 else 0.0,
'credit'
: -liquidity_balance if liquidity_balance < 0.0 else 0.0,
'partner_id'
: self.partner_id.id,
'account_id'
: self.outstanding_account_id.id,
},
# Receivable / Payable.
{
'name': counterpart_line_name,
'date_maturity'
: self.date,
'amount_currency'
: counterpart_amount_currency,
'currency_id'
: currency_id,
'debit'
: counterpart_balance if counterpart_balance > 0.0 else 0.0,
'credit'
: -counterpart_balance if counterpart_balance < 0.0 else 0.0,
'partner_id'
: self.partner_id.id,
'account_id'
: self.destination_account_id.id,
},
]
return line_vals_list + write_off_line_vals_list

0
Avatar
Buang
Axel Mendoza

you are having and issue or something with your code update?

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
Running into two big problems migrating from v15 to v16
upgrade v15 odoo16features
Avatar
Avatar
1
Jul 25
3151
upgrade database (One App Free) to the new version Diselesaikan
upgrade odoo16features ONEappfree
Avatar
Avatar
1
Jun 23
3692
FileNotFoundError after v17 to v18 upgrade
upgrade
Avatar
Avatar
1
Sep 25
1231
Upgrade v18->v19 on-premise
upgrade
Avatar
Avatar
Avatar
2
Sep 25
4693
DeprecationWarning: The longpolling-port is a deprecated alias to the gevent-port option, please use the latter Diselesaikan
odoo16features
Avatar
Avatar
Avatar
Avatar
Avatar
5
Sep 25
24317
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