跳转至内容
  • 版块
  • 标签
  • 热门
  • 用户
  • 群组
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(Flatly)
  • 不使用皮肤
折叠

Odoo 中文社区

  1. 主页
  2. 版块
  3. Odoo 新手求助
  4. 【已解决】Odoo 8.0 创建工资条错误

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

已定时 已固定 已锁定 已移动 Odoo 新手求助
5 帖子 1 发布者 11.0k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • W 离线
    W 离线
    whn09
    写于 最后由 编辑
    #1

    在“计算薪酬”部分添加了一个薪酬之后就报错:

    '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]')

    1 条回复 最后回复
    0
    • W 离线
      W 离线
      whn09
      写于 最后由 编辑
      #2

      我的解决方法是:由于contract_id(其实还有employee_id和salary_rule_id)是外键,和contract.id相关联,先删除它,再加回来即可。(数据库表:hr_payslip_line)

      但是这样有问题,就是不能正确计算工资,估计是salary_rule_id的问题,还需要再研究一下完美的解决方法。

      1 条回复 最后回复
      0
      • W 离线
        W 离线
        whn09
        写于 最后由 编辑
        #3

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

        1 条回复 最后回复
        0
        • W 离线
          W 离线
          whn09
          写于 最后由 编辑
          #4

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

          1 条回复 最后回复
          0

          • 登录

          • 没有帐号? 注册

          • 登录或注册以进行搜索。
          • 第一个帖子
            最后一个帖子
          0
          • 版块
          • 标签
          • 热门
          • 用户
          • 群组