Merge lp:~openerp-dev/openobject-addons/trunk-bug-1090224 into lp:openobject-addons

Proposed by Dharmang Soni (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-1090224
Merge into: lp:openobject-addons
Diff against target: 12 lines (+1/-1)
1 file modified
hr_holidays/hr_holidays.py (+1/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-1090224
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+151421@code.launchpad.net

This proposal supersedes a proposal from 2013-02-22.

Description of the change

When department of employee is changed the leave stores old department id

To post a comment you must log in.
Revision history for this message
Michael Telahun Makonnen (mmakonnen) wrote : Posted in a previous version of this proposal

Hi there,

I believe that for related and function fields unless you store the value in the database you cannot search or filter on it. So, in this case instead of just setting store=False it might be better to use store={...}

See here for an example: http://doc.openerp.com/v6.0/developer/2_5_Objects_Fields_Methods/field_type.html#store-parameter

Revision history for this message
Jose Antonio Morales Ponce(vauxoo) - - http://www.vauxoo.com (josemoralesp) wrote : Posted in a previous version of this proposal

Hi

To search on function fields you need make a fnct_search and return the
search parameters, without store=True
El 25/02/2013 09:46, "Michael Telahun Makonnen" <email address hidden>
escribió:

> Hi there,
>
> I believe that for related and function fields unless you store the value
> in the database you cannot search or filter on it. So, in this case
> instead of just setting store=False it might be better to use store={...}
>
> See here for an example:
> http://doc.openerp.com/v6.0/developer/2_5_Objects_Fields_Methods/field_type.html#store-parameter
>
> --
>
> https://code.launchpad.net/~openerp-community/openobject-addons/trunk-bug-1090224/+merge/149980
> Your team OpenERP Community is subscribed to branch
> lp:~openerp-community/openobject-addons/trunk-bug-1090224.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-community
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~openerp-community
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Michael Telahun Makonnen (mmakonnen) wrote : Posted in a previous version of this proposal

Ok. I hadn't thought of that.
My main point was that it should be searchable. Otherwise, it's broken.

Which way is the recommended way?
1. store=False and use fnct_search
    or
2. store={...} (and have the value in the db updated when the related
field changes).

I'm just wondering for my own future reference.

Regards,
Mike.

Revision history for this message
Jose Antonio Morales Ponce(vauxoo) - - http://www.vauxoo.com (josemoralesp) wrote : Posted in a previous version of this proposal

Well it all depends on whether you want the record or field is not in the
db.

If you want the field will not save, store = False to be, it will make the
sensible and calculated field to display automatic, fnct_search there if
you need because there is being saved.

If you are using store = {model: method} the field is saved in the db and
calculated each time you have a change in the selected model, as this is
saved no need to use a fnct_search.

It's about what you need at that time, if you want to save the field or not
El 25/02/2013 10:26, "Michael Telahun Makonnen" <email address hidden>
escribió:

> Ok. I hadn't thought of that.
> My main point was that it should be searchable. Otherwise, it's broken.
>
> Which way is the recommended way?
> 1. store=False and use fnct_search
> or
> 2. store={...} (and have the value in the db updated when the related
> field changes).
>
> I'm just wondering for my own future reference.
>
> Regards,
> Mike.
>
> --
>
> https://code.launchpad.net/~openerp-community/openobject-addons/trunk-bug-1090224/+merge/149980
> Your team OpenERP Community is subscribed to branch
> lp:~openerp-community/openobject-addons/trunk-bug-1090224.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-community
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~openerp-community
> More help : https://help.launchpad.net/ListHelp
>

8547. By Dharmang Soni (OpenERP)

[MERGE] with trunk

Unmerged revisions

8547. By Dharmang Soni (OpenERP)

[MERGE] with trunk

8546. By Dharmang Soni (OpenERP)

merge with trunk

8545. By Dharmang Soni (OpenERP)

[FIX] hr_holiday : When department of employee is changed the leave stores old department id

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hr_holidays/hr_holidays.py'
2--- hr_holidays/hr_holidays.py 2013-02-24 13:21:11 +0000
3+++ hr_holidays/hr_holidays.py 2013-03-04 07:19:24 +0000
4@@ -162,7 +162,7 @@
5 'type': fields.selection([('remove','Leave Request'),('add','Allocation Request')], 'Request Type', required=True, readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}, help="Choose 'Leave Request' if someone wants to take an off-day. \nChoose 'Allocation Request' if you want to increase the number of leaves available for someone", select=True),
6 'parent_id': fields.many2one('hr.holidays', 'Parent'),
7 'linked_request_ids': fields.one2many('hr.holidays', 'parent_id', 'Linked Requests',),
8- 'department_id':fields.related('employee_id', 'department_id', string='Department', type='many2one', relation='hr.department', readonly=True, store=True),
9+ 'department_id':fields.related('employee_id', 'department_id', string='Department', type='many2one', relation='hr.department', readonly=True, store=False),
10 'category_id': fields.many2one('hr.employee.category', "Employee Tag", help='Category of Employee', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),
11 'holiday_type': fields.selection([('employee','By Employee'),('category','By Employee Tag')], 'Allocation Mode', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}, help='By Employee: Allocation/Request for individual Employee, By Employee Tag: Allocation/Request for group of employees in category', required=True),
12 'manager_id2': fields.many2one('hr.employee', 'Second Approval', readonly=True, help='This area is automaticly filled by the user who validate the leave with second level (If Leave type need second validation)'),

Subscribers

People subscribed via source and target branches

to all changes: