【已解决】Odoo 8.0 创建工资条错误
- 
在“计算薪酬”部分添加了一个薪酬之后就报错: 
 '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]'
 详细的出错信息如下,有没有人碰到过这个问题?
 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, '
 # Available variables:
 #----------------------
 # payslip: object containing the payslips
 # employee: hr.employee object
 # contract: hr.contract object
 # rules: object containing the rules code (previously computed)
 # categories: object containing the computed salary rule categories (sum of amount of all rules belonging to that category).
 # worked_days: object containing the computed worked days
 # inputs: object containing the computed inputs
 # Note: returned value have to be set in the variable ''result''
 result = rules.NET > categories.NET * 0.10', '
 # Available variables:
 #----------------------
 # payslip: object containing the payslips
 # employee: hr.employee object
 # contract: hr.contract object
 # rules: object containing the rules code (previously computed)
 # categories: object containing the computed salary rule categories (sum of amount of all rules belonging to that category).
 # worked_days: object containing the computed worked days.
 # inputs: object containing the computed inputs.
 # Note: returned value have to be set in the variable ''result''
 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
 Traceback (most recent call last):
 File "/home/wanghenan/GreenOdoo-8.0-linux64/source/openerp/sql_db.py", line 234, in execute
 res = self._obj.execute(query, params)
 IntegrityError: null value in column "contract_id" violates not-null constraint
 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,
 # Available variables:
 #----------------------
 # payslip: objec..., 100.00,
 # Available variables:
 #----------------------
 # payslip: objec..., 1, base, null, 0.0000, null, 2014-09-22 13:40:00.658672, null, 1.00, 1, 11).
 2014-09-22 13:40:00,673 9150 ERROR udlrtech openerp.http: Exception during JSON request handling.
 Traceback (most recent call last):
 File "/home/wanghenan/GreenOdoo-8.0-linux64/source/openerp/http.py", line 479, in _handle_exception
 return super(JsonRequest, self)._handle_exception(exception)
 File "/home/wanghenan/GreenOdoo-8.0-linux64/source/openerp/http.py", line 498, in dispatch
 result = self._call_function(**self.params)
 File "/home/wanghenan/GreenOdoo-8.0-linux64/source/openerp/http.py", line 314, in call_function
 return checked_call(self.db, *args, **kwargs)
 File "/home/wanghenan/GreenOdoo-8.0-linux64/source/openerp/service/model.py", line 149, in wrapper
 raise openerp.osv.orm.except_orm(('Integrity Error'), msg)
 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]')
- 
仔细阅读OpenERP用户使用手册的薪酬管理部分,https://doc.odoo.com/7.0/zh_CN/book/4/4_11_HR/4_11_HR_payroll/