Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

is there any way to unlink line items on onchange?

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
one2manyon_changeline
1 Răspunde
9026 Vizualizări
Imagine profil
Jamshid Chungath

in my onchange line items get changed.,if there is no value,the previous onchange value still can u plz help me

here is my onchange function:

 def get_salary_line(self, cr, uid, ids, emp_id, context = None):
        hr_payslip_id = self.pool.get('hr.payslip').search(cr, uid, [('employee_id','=',emp_id)], context = context)
        res= []
        for payslip_obj in self.pool.get('hr.payslip').browse(cr, uid, hr_payslip_id, context = context):
            line_ids2 = []
            res = {'value':{
                      'allowance_line_ids':[],
                      
                      }
            } 
           
            for line in payslip_obj.line_ids:
                if line.category_id:
               
                    vals = {
                                'name': line.name,
                                'code':line.code,
                                'category_id':line.category_id and line.category_id.id,
                                'contract_id':ids
                                }
                    if line.code !='BASIC' and line.code !='NET' and line.code !='GROSS':
                        line_ids2.append(vals)
                else:
                    print 'haiiiiiiiiiiiiisddffffffffffffffffffffffffffffffffffffffffffffffffffffff'       
                 
        
            res['value'].update({
                    'allowance_line_ids': line_ids2,
                    })
            
        return res

0
Imagine profil
Abandonează
Imagine profil
Deepa Venkatesh
Cel mai bun răspuns

Hi,

Yes you can unlink o2m records from onchange...

 

Instead of this:

res = {'value':{     'allowance_line_ids':[],     }

Rewite this

res = {'value':{

          'allowance_line_ids': map(lambda x: (2,x), [x.id for x in ALLOWANCE_LINE_IDS]),    

    }

 

Note:

For O2M :: (2, ID) will remove and delete the linked record with id = ID (calls unlink on ID, that will delete the object    completely, and the link to it as well)...

Refer this: Doc

 

 

 

2
Imagine profil
Abandonează
Jamshid Chungath
Autor

'allowance_line_ids': map(lambda x: (2,x), [x.id for x in ALLOWANCE_LINE_IDS]), how can we get this ALLOWANCE_LINE_IDS? ALLOWANCE_LINE_IDS=self.browse(cr, uid, ids, context=context).allowance_line_ids is that right? but my onchange has no effect

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

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
How to use Onchange function in one2many
one2many on_change
Imagine profil
Imagine profil
1
mar. 15
6533
create and edit items of a one2many field through on_change method
one2many on_change active_id
Imagine profil
0
ian. 17
9576
How to add line items in jasper report?
one2many line jasper_reports
Imagine profil
Imagine profil
Imagine profil
2
mar. 15
11100
Dataerror updating function field of one2many object using on_change event
one2many on_change function_field
Imagine profil
0
mar. 15
5716
What data structure does one2many fields have, when they are passed as arguments in onchange method? Rezolvat
one2many on_change v7
Imagine profil
Imagine profil
1
mar. 15
5204
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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