-
-
Notifications
You must be signed in to change notification settings - Fork 665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] 9.0 migration of hr_holidays_legal_leave #267
Merged
pedrobaeza
merged 5 commits into
OCA:9.0
from
gurneyalex:9.0-mig_hr_holidays_legal_leave
Oct 27, 2016
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
854038f
Backport changes from the 10.0 port of the module
gurneyalex ed6aa1c
fixup! Backport changes from the 10.0 port of the module
gurneyalex 2b2cc61
fix: change version + add reference to res_company.py in models/__ini…
damdam-s 02d8159
update configuration part
damdam-s df9830f
[IMP] add company_id field for easier configuration
damdam-s File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# -*- coding: utf-8 -*- | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from openerp import fields, models, api | ||
|
||
|
||
class HolidaysType(models.Model): | ||
_inherit = "hr.holidays.status" | ||
|
||
is_annual = fields.Boolean( | ||
'Legal/Annual', | ||
compute='_compute_is_annual', | ||
inverse='_inverse_is_annual', | ||
help='Use this Leave type as Legal/Annual for current company. ' | ||
'One and only one leave type can have this checkbox. ' | ||
'You cannot unset it directly. ' | ||
'Set it on another Leave type instead. ' | ||
) | ||
|
||
@api.multi | ||
def _compute_is_annual(self): | ||
company = self.env.user.company_id | ||
self.filtered(lambda x: x == company.legal_holidays_status_id)\ | ||
.update({'is_annual': True}) | ||
|
||
@api.multi | ||
def _inverse_is_annual(self): | ||
self.ensure_one() | ||
company = self.env.user.company_id | ||
if self.is_annual: | ||
company.legal_holidays_status_id = self.id |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="edit_holiday_status_form" model="ir.ui.view"> | ||
<field name="name">hr.holidays.status.form</field> | ||
<field name="model">hr.holidays.status</field> | ||
<field name="inherit_id" ref="hr_holidays.edit_holiday_status_form" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='name']" | ||
position="after"> | ||
<field name="is_annual" /> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I know this is what is now in v10, I'm seeing that this is not comfortable for user with access to several companies. We should have a
company_id
field that is filled by default with user company, but with the possibility to be switched. This is similar to Accounting settings.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pedrobaeza you're right (I think) but is it correct to have a different behaviour between 9 and 10 versions ?
If you want me to do it, I can but I will make a PR on v10 too to have the same behaviour.
@gurneyalex @feketemihai cc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please. I think it's a good change. We can cherry-pick the commit directly in v10 when done in v9.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pedrobaeza done in df9830f. Is it what you wanted ?