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

Odoo 10 copy one2many line on client side

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
webclientlistviewbuttonsodoo10
4305 Tampilan
Avatar
Nick Booker

I'm trying to allow a user to duplicate a line on a one2many (sales order line to be precise) on the client side.  The customer expressly doesn't want to have to save the sales order in order to do this.

I've tried to add a copy button to the right hand side of ListView:

    <t t-extend="ListView.row">
<t t-jquery=".o_list_record_delete" t-operation="after">
<td t-if="options.deletable">
<button type="button" aria-hidden="true"
class="o_icon_button o_kf_so_line_copy_button">
<i class="fa fa-copy"/>
</button>
<!-- <a class="o_kf_so_line_copy_button"><i class="fa fa-copy"/></a> -->
</td>
</t>
</t>
<t t-extend="ListView">
<!-- TODO little quirk is that striping doesn't carry into copy column. Fix this at end if time and solution otherwise works. -->
<t t-jquery='t[t-set="columns_count"]' t-operation="after">
<t t-set="columns_count" value="columns_count + (options.deletable ? 1 : 0)"/>
</t>
<t t-jquery=".o_list_record_delete" t-operation="after">
<td t-if="options.deletable" class="o_kf_so_line_copy"/>
</t>
</t>

Note a couple of attempts one using <button> and another using <a>.

Here is my javascript where I try to set up a click handler:

odoo.define('acme_flobbits_management.SOLineCopyWidgets', function (require) {
"use strict";


var core = require('web.core');
var Widget = require('web.Widget');
var utils = require('web.utils');
var ListView = require('web.ListView');
var SOLineCopyDialog = require('acme_flobbits_management.SOLineCopyDialog');
ListView.include({
reload_content: function() {
var self = this;
var reloaded = this._super();
reloaded.then(function() {
var $elements = self.$el.find('.o_kf_so_line_copy_button');
// Finding the elements OK
$elements.click(function(e) {
// But this click handler's getting ignored when it's a "span"
// Declaring as button lets it work, but then Odoo ListView gets its knickers in a twist
// list_view.js 996 will give clues for this and for how to get at the data we need!
e.preventDefault();
e.stopPropagation();
SOLineCopyDialog.createSOLineCopyDialog(self);
});
});
return reloaded;
}
});
});


Using the <button> tag, Odoo throws a wobbly on load because the javascript is looking for any button tags nested inside the td and making its own click handler that requires a 'field' data attribute, but my button doesn't bind to a field so I don't think that makes sense.

Using the <a> tag, Odoo happily lets me do it, but the click is ignored and passed through to the row, so the Sale Order Line form is popped up as if I'd clicked elsewhere on the row instead of running the javascript I've tried to connect to the <a> tag's click event.

Looking in the Firefox debugger, there is indeed no little [ev] marker next to my <a> tag in the inspector.

Q1: Firstly, am I approaching this the right way overall (by extending ListView)?  Or is there some standard way to add a column of buttons to a specific field's one2many table, only in Edit mode, and perform some client-side-only action in response to it while keeping knowledge of the record being copied and allowing the one2many view to be updated after adding what I assume will be a new (0, False, {fields}) thing to Javascript's copy of the field.

Q2: Secondly, if I am approaching this the right way, how do I:

  a) get my click handler to be registered and triggered?

  b) find out in my extended ListView whether a particular attribute of the tree in my view arch XML, e.g. <tree kf_copyable_so_line="1"/>, has been set?


0
Avatar
Buang
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 change the position of setup button from by default left to right side inside the column ?
treeview listview buttons
Avatar
0
Des 23
2259
Can one change the form view that is displayed on a NOT editable list?
listview formview odoo10
Avatar
0
Nov 19
4392
How to filter list view by related field Diselesaikan
filter listview odoo10
Avatar
Avatar
6
Agu 18
11676
Please Help me, I cant any action on 'Validate' button?
buttons js odoo10
Avatar
0
Apr 18
4331
One2many list view Buttons
listview buttons one2many_list
Avatar
0
Jan 18
4974
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