Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Food & Hospitality
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Guest House
    • Distributor nápojů
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Trades
    • Údržbář
    • IT hardware a podpora
    • Solar Energy Systems
    • Výrobce obuvi
    • Úklidové služby
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Browse all Industries
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Services for Partners
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

extraction of field via xml

Odebírat

Get notified when there's activity on this post

This question has been flagged
xmlpython2.7
4 Odpovědi
5887 Zobrazení
Avatar
myriam

i have already created a new category in the module of payroll and of course a new salary rule .. i have a class "avance" related to contract ( the contract have many of "avance"). it's linked like below :

class hr_contract(osv.osv):
_inherit = 'hr.contract'
_name = 'hr.contract'

_columns = {
    'line_av_ids': fields.one2many('hr.avance.pret', 'avance_id', 'Avance et Prêt'),
}

hr_contract()

class hr_avance_pret(osv.osv):
_name = "hr.avance.pret"
_description = "Avance"
 _columns = {
'montant_echeance': fields.function(_compute_montant, method=True, string='Montant d\'échéance'),
'line_contrat': fields.many2one('hr.contract', "contrat"),
}


<record id="hr_payroll.avance" model="hr.salary.rule">
    <field name="name">Remboursement des Prêts</field>
    <field name="code">AVANCE PRET</field>
    <field name="sequence">100000</field>
    <field name="category_id" ref="hr_AVANCE"/>
    <field name="condition_select">none</field>
    <field name="amount_select">code</field>
    <field name="amount_python_compute">**result = contract.line_av_ids.montant_echeance** </field>
    <field name="appears_on_payslip" eval="False"/>
    <field name="note">la valeur des avances et des prêts.</field>
</record>

i have a pyhton error of "amount_pyhton_compute" i need to extract the "montant_echeance" of the calss "avance" I need your help please !!!!!!!!!!!

0
Avatar
Zrušit
Avatar
myriam
Autor Nejlepší odpověď
def _compute_montant(self, cr, uid, ids, field_name, arg, context={}):
    result = {}
    for id in ids:
        myself = self.browse(cr, uid, id, context=context)
        res = 0.0
        if myself:
            res = myself.montant_credit / myself.nbre_echeances
            result[id] = res
    return result

This function is in class hr_avance_pret. this function is correct. but my problème that i want to extract the "montant_echance" to use it in my salary rule. in the base module payroll i found you have to do like that to make a new salary rule like this exemple: (that's why i want to use the "amount_python_code")

<record id="hr_rule_secu" model="hr.salary.rule">
    <field name="name">Plafond Securite Sociale</field>
    <field name="code">SECU</field>
    <field name="sequence">1010</field>
    <field name="category_id" ref="SECU"/>
    <field name="appears_on_payslip" eval="False"/>
    <field name="condition_select">none</field>
    <field name="amount_select">code</field>
    <field name="amount_python_compute">result = contract.employee_id.company_id.plafond_secu</field>
</record>

Thank you for your apply!

1
Avatar
Zrušit
Avatar
Med Said BARA
Nejlepší odpověď

Try: contract.montant_echeance

0
Avatar
Zrušit
myriam
Autor

i still have the same error :-(

Avatar
Vivekrajan Rayappan
Nejlepší odpověď

Hi,

I can help you. Can you just tell me where you have defined the method "_compute_montant". Show me the code of the method.

and what is this amount_pyhton_compute? is it a method? if yes, tel me where you have got that

0
Avatar
Zrušit
myriam
Autor

heeelp please!!

Avatar
patrick
Nejlepší odpověď

The error is caused by the definition of the field 'amount_pyhton_compute' in the XML.

In your case, you probably want to create a function within hr_contract, which will calculate the value of what you want. At the moment I do not have access to my code, otherwise I might show you an example of how to do it.

0
Avatar
Zrušit
Enjoying the discussion? Don't just read, join in!

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
How to change the text color/font color in kanban view depending on a field value in odoo 10?
xml python2.7
Avatar
Avatar
Avatar
2
zář 23
5913
Remove "add an item" Vyřešeno
xml python2.7
Avatar
Avatar
Avatar
12
říj 23
36863
extraction attribute : <field name="amount_python_compute">
xml python2.7
Avatar
0
bře 15
6047
<field name="amount_python_compute">
xml python2.7
Avatar
Avatar
Avatar
Avatar
4
bře 15
6164
extraction attribute with: amount_python_compute
xml python2.7
Avatar
Avatar
2
bře 15
7099
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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