Odoo中文社区可以通过以下三个域名访问:shine-it.net , odoocn.org,odoo.net.cn

原论坛用户的基本信息和发帖这里都予以保留,请注意:原论坛用户无需重新注册新用户,但是您的密码需要重置

开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

如果您登录系统碰到问题,请在微信公众号留言:

【已解决】Odoo 8.0 创建工资条错误



  • 在“计算薪酬”部分添加了一个薪酬之后就报错:<br /><br />'Integrity Error', 'The operation cannot be completed, probably due to the following:\n- deletion: you may be trying to delete a record while other records still reference it\n- creation/update: a mandatory field is not correctly set\n\n[object with reference: contract_id - contract.id]'<br /><br />详细的出错信息如下,有没有人碰到过这个问题?<br /><br />2014-09-22 13:40:00,673 9150 ERROR udlrtech openerp.sql_db: bad query: INSERT INTO "hr_payslip_line" ("id", "condition_select", "code", "appears_on_payslip", "amount_select", "name", "sequence", "condition_python", "amount_python_compute", "amount_percentage", "amount", "company_id", "rate", "slip_id", "condition_range", "active", "category_id", "amount_fix", "quantity", "create_uid", "write_uid", "create_date", "write_date") VALUES(nextval('hr_payslip_line_id_seq'), 'none', 'base', true, 'fix', 'base', 5, '<br /># Available variables:<br />#----------------------<br /># payslip: object containing the payslips<br /># employee: hr.employee object<br /># contract: hr.contract object<br /># rules: object containing the rules code (previously computed)<br /># categories: object containing the computed salary rule categories (sum of amount of all rules belonging to that category).<br /># worked_days: object containing the computed worked days<br /># inputs: object containing the computed inputs<br /><br /># Note: returned value have to be set in the variable ''result''<br /><br />result = rules.NET > categories.NET * 0.10', '<br /># Available variables:<br />#----------------------<br /># payslip: object containing the payslips<br /># employee: hr.employee object<br /># contract: hr.contract object<br /># rules: object containing the rules code (previously computed)<br /># categories: object containing the computed salary rule categories (sum of amount of all rules belonging to that category).<br /># worked_days: object containing the computed worked days.<br /># inputs: object containing the computed inputs.<br /><br /># Note: returned value have to be set in the variable ''result''<br /><br />result = contract.wage * 0.10', '0.0000', '100.00', 1, '100.0000', 11, 'contract.wage', true, 1, '0.00', '1.00', 242, 242, (now() at time zone 'UTC'), (now() at time zone 'UTC')) RETURNING id<br />Traceback (most recent call last):<br />  File "/home/wanghenan/GreenOdoo-8.0-linux64/source/openerp/sql_db.py", line 234, in execute<br />    res = self._obj.execute(query, params)<br />IntegrityError: null value in column "contract_id" violates not-null constraint<br />DETAIL:  Failing row contains (41, none, base, 2014-09-22 13:40:00.658672, fix, 5, null, 242, 100.0000, null, t, contract.wage, t, null, null, 0.00, null, 242, null, null,<br /># Available variables:<br />#----------------------<br /># payslip: objec..., 100.00,<br /># Available variables:<br />#----------------------<br /># payslip: objec..., 1, base, null, 0.0000, null, 2014-09-22 13:40:00.658672, null, 1.00, 1, 11).<br /><br />2014-09-22 13:40:00,673 9150 ERROR udlrtech openerp.http: Exception during JSON request handling.<br />Traceback (most recent call last):<br />  File "/home/wanghenan/GreenOdoo-8.0-linux64/source/openerp/http.py", line 479, in _handle_exception<br />    return super(JsonRequest, self)._handle_exception(exception)<br />  File "/home/wanghenan/GreenOdoo-8.0-linux64/source/openerp/http.py", line 498, in dispatch<br />    result = self._call_function(**self.params)<br />  File "/home/wanghenan/GreenOdoo-8.0-linux64/source/openerp/http.py", line 314, in call_function<br />    return checked_call(self.db, *args, **kwargs)<br />  File "/home/wanghenan/GreenOdoo-8.0-linux64/source/openerp/service/model.py", line 149, in wrapper<br />    raise openerp.osv.orm.except_orm(('Integrity Error'), msg)<br />except_orm: ('Integrity Error', 'The operation cannot be completed, probably due to the following:\n- deletion: you may be trying to delete a record while other records still reference it\n- creation/update: a mandatory field is not correctly set\n\n[object with reference: contract_id - contract.id]')<br />



  • 在“计算薪酬”部分添加了一个薪酬之后就报错:<br /><br />'Integrity Error', 'The operation cannot be completed, probably due to the following:\n- deletion: you may be trying to delete a record while other records still reference it\n- creation/update: a mandatory field is not correctly set\n\n[object with reference: contract_id - contract.id]'<br /><br />详细的出错信息如下,有没有人碰到过这个问题?<br /><br />2014-09-22 13:40:00,673 9150 ERROR udlrtech openerp.sql_db: bad query: INSERT INTO "hr_payslip_line" ("id", "condition_select", "code", "appears_on_payslip", "amount_select", "name", "sequence", "condition_python", "amount_python_compute", "amount_percentage", "amount", "company_id", "rate", "slip_id", "condition_range", "active", "category_id", "amount_fix", "quantity", "create_uid", "write_uid", "create_date", "write_date") VALUES(nextval('hr_payslip_line_id_seq'), 'none', 'base', true, 'fix', 'base', 5, '<br /># Available variables:<br />#----------------------<br /># payslip: object containing the payslips<br /># employee: hr.employee object<br /># contract: hr.contract object<br /># rules: object containing the rules code (previously computed)<br /># categories: object containing the computed salary rule categories (sum of amount of all rules belonging to that category).<br /># worked_days: object containing the computed worked days<br /># inputs: object containing the computed inputs<br /><br /># Note: returned value have to be set in the variable ''result''<br /><br />result = rules.NET > categories.NET * 0.10', '<br /># Available variables:<br />#----------------------<br /># payslip: object containing the payslips<br /># employee: hr.employee object<br /># contract: hr.contract object<br /># rules: object containing the rules code (previously computed)<br /># categories: object containing the computed salary rule categories (sum of amount of all rules belonging to that category).<br /># worked_days: object containing the computed worked days.<br /># inputs: object containing the computed inputs.<br /><br /># Note: returned value have to be set in the variable ''result''<br /><br />result = contract.wage * 0.10', '0.0000', '100.00', 1, '100.0000', 11, 'contract.wage', true, 1, '0.00', '1.00', 242, 242, (now() at time zone 'UTC'), (now() at time zone 'UTC')) RETURNING id<br />Traceback (most recent call last):<br />  File "/home/wanghenan/GreenOdoo-8.0-linux64/source/openerp/sql_db.py", line 234, in execute<br />    res = self._obj.execute(query, params)<br />IntegrityError: null value in column "contract_id" violates not-null constraint<br />DETAIL:  Failing row contains (41, none, base, 2014-09-22 13:40:00.658672, fix, 5, null, 242, 100.0000, null, t, contract.wage, t, null, null, 0.00, null, 242, null, null,<br /># Available variables:<br />#----------------------<br /># payslip: objec..., 100.00,<br /># Available variables:<br />#----------------------<br /># payslip: objec..., 1, base, null, 0.0000, null, 2014-09-22 13:40:00.658672, null, 1.00, 1, 11).<br /><br />2014-09-22 13:40:00,673 9150 ERROR udlrtech openerp.http: Exception during JSON request handling.<br />Traceback (most recent call last):<br />  File "/home/wanghenan/GreenOdoo-8.0-linux64/source/openerp/http.py", line 479, in _handle_exception<br />    return super(JsonRequest, self)._handle_exception(exception)<br />  File "/home/wanghenan/GreenOdoo-8.0-linux64/source/openerp/http.py", line 498, in dispatch<br />    result = self._call_function(**self.params)<br />  File "/home/wanghenan/GreenOdoo-8.0-linux64/source/openerp/http.py", line 314, in call_function<br />    return checked_call(self.db, *args, **kwargs)<br />  File "/home/wanghenan/GreenOdoo-8.0-linux64/source/openerp/service/model.py", line 149, in wrapper<br />    raise openerp.osv.orm.except_orm(('Integrity Error'), msg)<br />except_orm: ('Integrity Error', 'The operation cannot be completed, probably due to the following:\n- deletion: you may be trying to delete a record while other records still reference it\n- creation/update: a mandatory field is not correctly set\n\n[object with reference: contract_id - contract.id]')<br />



  • 我的解决方法是:由于contract_id(其实还有employee_id和salary_rule_id)是外键,和contract.id相关联,先删除它,再加回来即可。(数据库表:hr_payslip_line)<br /><br />但是这样有问题,就是不能正确计算工资,估计是salary_rule_id的问题,还需要再研究一下完美的解决方法。



  • 出现这个错误主要是因为我对工资管理的流程理解错了,不应该手动添加薪酬,而是应该点击“计算”,则系统会自动添加由工资结构定义的薪酬,无需手动添加和修改,也就会绕过之前提到的问题了。<br />不要删除contract_id等,可能会造成意想不到的错误。



  • 仔细阅读OpenERP用户使用手册的薪酬管理部分,https://doc.odoo.com/7.0/zh_CN/book/4/4_11_HR/4_11_HR_payroll/


登录后回复
 

与 Odoo 中文社区 的连接断开,我们正在尝试重连,请耐心等待