Both suggestions make sense. I'll need the ytd* fields since some of the 
Canadian deductions are based on YTD calculations.

Agree that it should be part of the base engine, but I'll upload a separate 
module. Inheritance with hr_payroll seems to be a bit of a nightmare though - a 
lot of other examples I've seen have are overwriting the significant functions. 
Not keen on doing that, though, since I have another module I'd like to include 
(non-salary/timesheet based).

Thanks for the feedback, I'll let you know when the branch is up.

On 2012-10-02, at 12:38 PM, Daniel Reis <[email protected]> wrote:

> I have the following suggestions:
>   - name the class as "class hr_payroll_employee_rules", so it encompasses 
> both deductions and allowances.
>   - you'll need also 'value': fields.float ... Note that this usually will 
> hold a currency amount, but is same cases you might need it to represent a 
> quantity.
> 
> As for the ytd_occurence and ytd_amount, I probably would skip them right now.
> Probably mos cases can be handled the the start - end dates.
> IMHO this sort of calculation should be a feature of the payroll rule engine, 
> but that's a whole new problem...
> 
> Regarding the date ranges, date fields are represented by the ORM as 
> 'yyyy-mm-dd' strings,so there sould be no problem.
> 
> DR
> 
> Subject: Re: [Openerp-community] Payroll - Personal Deductions
> From: [email protected]
> Date: Tue, 2 Oct 2012 11:13:48 -0400
> CC: [email protected]
> To: [email protected]
> 
> Daniel and list, to clarify further and incorporate your suggestions could 
> add the following:
> 
> Add class hr_payroll_employee_deductions with the columns:
> 
>               'name': fields.char
>               'code': fields.char
>               'employee_id': fields.many2one
>               'ytd_amount': fields.function('_get_ytd_amount', etc, etc), 
>               'ytd_occurence': fields.function('_get_ytd_occurence', etc, 
> etc),
>               'date_start': fields.date
>               'date_end': fields.date
> 
> This would be available on the employee or contract form, and country 
> specific defaults could be loaded with 0 amounts.
> 
> Include functions _get_ytd_occurence, _get_ytd_amount. Also add a function to 
> return a browseable object based on the code, although I think this may 
> require overwriting browse() instead (?). Or I might be able to just add an 
> additional field which returns a browseable object or dictionary of the 
> values.
> 
> To the Available Variables (hr_payroll) add employee_deductions that will 
> allow use of employee_deductions.X.ytd_amount, 
> employee_deductions.X.date_start, etc (where X is the code from 
> hr_payroll_employee_deductions). With that approach, you could add rules with 
> Condition based on: Range and the range based on date or a minimum/maximum of 
> YTD amount. I haven't tried using the range for dates or looked at the 
> function so it may also require modification.
> 
> The only issue I can see with this is that all unique deductions would need 
> to have a corresponding rule within the salary structure, but there should be 
> a limited number of deductions.
> 
> 
> On 2012-10-02, at 9:48 AM, Daniel Reis <[email protected]> wrote:
> 
> My explanation was not very clear, I'm sorry.
> 
> AFAIK, Salary Rules are declared in Salary Structures.
> You can't associate a Salary Rule directly to an Employee. 
> Closest thing you can do is to create a specific Salary Structure for that 
> person. It'll do the job, but I think it's rather clumsy.
> 
> I feel that the possibility to also associate Salary Rules directly with 
> Contracts/Employees would allow to solve this issue.
> This way it would be easy, for example, to add a specific fixed deduction to 
> an employee.
> Additionally, if it includes a "date from" and "date to", or a "number of 
> occurrences", it could the user with the cases where the deductions are to be 
> made during a 4 month period  or in the next 3 payslips.
> 
> Regards
> Daniel Reis
> 
> 
> From: [email protected]
> Date: Tue, 2 Oct 2012 09:06:33 -0400
> To: [email protected]
> Subject: Re: [Openerp-community] Payroll - Personal Deductions
> 
> Not sure I'm following. Wouldn't that be the same as the existing Salary 
> Rules, since you'd need to enter a separate one per employee? I think the one 
> additional requirement that you mentioned (and I'm looking into) is have a 
> different cycle than the actual pay cycle - for example a deduction/allowance 
> could be made once monthly when the pay cycle is weekly. 
> 
> My thinking for country specific variables add single fields to the employee 
> object and a single salary rule that uses that field for all employees that 
> require it. I realize that's likely a country specific way of doing it, but 
> it could be added to whatever rules are standard for that country as the 
> local payroll module.
> 
> Does that make sense, or were you thinking something else?
> 
> On 2012-10-02, at 8:42 AM, Daniel Reis <[email protected]> wrote:
> 
> In my experience, typical payroll sw has a "Fixed Values" table and "Variable 
> Values" table  (weekly, monthly, etc) associated with employees.
> To add a fixed allowance to an employee you just add a row woth the code, 
> value and date period.
> 
> If anyone is willing to add such a feature to OpenERP I'm willing to help.
> 
> Regards
> Daniel Reis
> 
> 
> Date: Tue, 2 Oct 2012 09:16:29 +0800
> From: [email protected]
> To: [email protected]
> Subject: Re: [Openerp-community] Payroll - Personal Deductions
> 
> Adding a field in the employee or contract and referring to it in the payroll 
> rules is probably the easiest.
> 
> <Logo-Elico90.gif>
> Eric CAUDAL, Elico Corp, Shanghai.
> [email protected]
> Cell: + 86 186 2136 1670. Skype: elico.corp
> Premium Certified Training Partner - OpenERP Ready Partner.
> 
> <CTP-Premium-Partner-logo-300x62.png>
> http://www.openerp.net.cn
> On 10/02/2012 08:45 AM, John Boyle wrote:
> Hi folks,
> 
> Just wondering what's the best way to handle personal deductions for payroll? 
> Specifically, I'm referring to cases where there's a deduction for many/most 
> employees but the amount differs by employee.
> 
> Adding a specific rule for each employees deduction seems a little tedious. 
> Should a field be added to the Employee or Contract and a single rule used? 
> Or is there a better way?
> 
> Thanks!
> John
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-community
> Post to     : [email protected]
> Unsubscribe : https://launchpad.net/~openerp-community
> More help   : https://help.launchpad.net/ListHelp
> 
> 
> _______________________________________________ Mailing list: 
> https://launchpad.net/~openerp-community Post to : 
> [email protected] Unsubscribe : 
> https://launchpad.net/~openerp-community More help : 
> https://help.launchpad.net/ListHelp
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-community
> Post to     : [email protected]
> Unsubscribe : https://launchpad.net/~openerp-community
> More help   : https://help.launchpad.net/ListHelp
> 
> 
> _______________________________________________ Mailing list: 
> https://launchpad.net/~openerp-community Post to : 
> [email protected] : 
> https://launchpad.net/~openerp-community More help : 
> https://help.launchpad.net/ListHelp
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-community
> Post to     : [email protected]
> Unsubscribe : https://launchpad.net/~openerp-community
> More help   : https://help.launchpad.net/ListHelp

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp

Reply via email to