콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
8190 화면

I try to migrate the module hr_payslip_ytd_amount to the new API, but I get a traceback with the error:

ParseError: "Invalid view definition

Error details:
Field `total_ytd` does not exist

Error context:
View `hr.payslip.form`
[view_id: 2915, xml_id: n/a, model: hr.payslip, parent_id: 1629]
None" while parsing /opt/odoo9/custom/addons/hr_payslip_ytd_amount/views/hr_payslip_view.xml:5, near
<record id="view_hr_payslip_form" model="ir.ui.view">
            <field name="name">hr.payslip.form</field>
            <field name="model">hr.payslip</field>
            <field name="inherit_id" ref="hr_payroll.view_hr_payslip_form"/>
            <field name="arch" type="xml">
                <xpath expr="//field[@name='line_ids']//field[@name='total']" position="after">
                        <field name="total_ytd"/>
                </xpath>
            </field>
        </record>

I assume it is related to a invalid definition of the field "total_ytd". The corresponding code is the following (I did only replace "_columns" with "_fields"):

from openerp import fields, models, api
import openerp.addons.decimal_precision as dp

class hr_payslip_line(models.Model):
    _inherit = 'hr.payslip.line'
    _fields = {
        'total_ytd': fields.float(
            'Total Year-to-date',
            digits_compute=dp.get_precision('Payroll'))
    }

I can't find any help which is understandable for a python-newbie.

아바타
취소

try this:

from openerp import fields, models, api

import openerp.addons.decimal_precision as dp

class hr_payslip_line(models.Model):

_inherit = 'hr.payslip.line'

total_ytd = fields.Float(string='Total Year-to-date', digits=dp.get_precision('Payroll'))

작성자

Unfortunately, this does not work. The field is not added to the model and therefore I get the same view error.

관련 게시물 답글 화면 활동
0
6월 15
4079
3
5월 25
1747
1
4월 25
1292
3
9월 24
14207
2
7월 24
1328