← Back to team overview

openerp-india team mailing list archive

Re: [Bug 1101909] Re: hr payroll rules python code

 

Hi Khushboo Bhatt, but it's a bug, because when i select python code
openerp told me that:
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
*# 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*
*
*
*
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
*
*
*
*# rules: object containing the rules code (previously computed)
---->>>  **this
is wrong??
*
*
*
*regards
*
*
*
*
*


2013/1/23 Federico Manuel Echeverri Choux <echeverrifm@xxxxxxxxx>

> Hello!! Khushboo Bhatt
> I change my rule and  It's work very well
>
> Thanks a lot
> *Echeverrifm*
>
>
> 2013/1/23 Khushboo Bhatt(openerp) <1101909@xxxxxxxxxxxxxxxxxx>
>
> Hello Federico,
>>
>> I have checked your issue with 6.1,7.0 and trunk also.If you want to use
>> code of any rules then you just simply write code of particular rule.
>>
>> Lets take your own example:
>> first rule is like:
>>
>> Code: TEST2
>> Name: TEST2
>> Fixed Amount = 100
>>
>> Second Rule:
>>
>> Code: TEST
>> Name: TEST
>> Python Code: result = TEST2
>>
>> So in this way you can create rules.
>>
>> And yes there is a problem of usability where we have defined help for
>> user like "result = rules.NET > categories.NET * 0.10" "
>> Here help is changed to "result = NET > categories.NET * 0.10" "
>>
>> So I m confirming this issue as usability issue.
>>
>> Thank you,
>> Khushboo.
>>
>> ** Tags added: usability
>>
>> ** Changed in: openobject-addons
>>        Status: New => Confirmed
>>
>> --
>> You received this bug notification because you are subscribed to the bug
>> report.
>> https://bugs.launchpad.net/bugs/1101909
>>
>> Title:
>>   hr payroll  rules python  code
>>
>> To manage notifications about this bug go to:
>> https://bugs.launchpad.net/openobject-addons/+bug/1101909/+subscriptions
>>
>
>

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1101909

Title:
  hr payroll  rules python  code

Status in OpenERP Addons (modules):
  Confirmed

Bug description:
  1) Steps to reproduce the issue you have observed

  I create two Rule and one Category.
  first rule is like:

  Code:  TEST2
  Name: TEST2
  Fixed Amount = 100

  Second Rule:

  Code:  TEST
  Name: TEST
  Python Code: result = rules.TEST2

  2) The result you observed

  File ".../addons_v6.1/addons/hr_payroll/hr_payroll.py", line 399, in compute_sheet
      lines = [(0,0,line) for line in self.pool.get('hr.payslip').get_payslip_lines(cr, uid, contract_ids, payslip.id, context=context)]
  File ".../addons_v6.1/addons/hr_payroll/hr_payroll.py", line 592, in get_payslip_lines
      tot_rule = amount * qty * rate / 100.0
  TypeError: unsupported operand type(s) for *: 'browse_record' and 'float'
  2013-01-19 21:21:16,736 11013 ERROR ? openerp.netsvc: unsupported operand type(s) for *: 'browse_record' and 'float'

  3) The result you expected

  I expected that rule TEST give me a result = 100 and when i use  rules: object containing the rules code (previously computed)
  it's doesnt work well

  4) The platform you are using (and browser version, if relevant)

  Ubuntu 12.04 LTS

  5) The OpenERP version you are using

  Openerp Server 6.1   REV.: 4333
  Openerp Client 6.1    REV.: 2085
  Openerp Addons 6.1 REV.: 7132

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1101909/+subscriptions


References