-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
109 additions
and
38 deletions.
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
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,2 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_allow_billable_wizard,access_allow_billable_wizard,model_allow_billable_wizard,base.group_user,1,1,1,0 |
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,17 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<odoo> | ||
<record id="view_edit_project_billable_inherit_form" model="ir.ui.view"> | ||
<field name="name">project.project.view.inherit</field> | ||
<field name="model">project.project</field> | ||
<field name="inherit_id" ref="sale_project.view_edit_project_inherit_form"/> | ||
<field name="arch" type="xml"> | ||
<field name="allow_billable" position="attributes"> | ||
<attribute name="readonly">allow_billable</attribute> | ||
<attribute name="force_save">1</attribute> | ||
</field> | ||
<field name="allow_billable" position="after"> | ||
<button string="Deactivate Billable" name="change_allow_billable" type="object" class="btn-primary" invisible="not allow_billable"/> | ||
</field> | ||
</field> | ||
</record> | ||
</odoo> |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import res_config_settings | ||
from . import project_change_billable |
25 changes: 25 additions & 0 deletions
25
sale_timesheet_ux/wizards/project_change_biillable_views.xml
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,25 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<odoo> | ||
<data> | ||
|
||
<record id="change_allow_billable_wizzard" model="ir.ui.view"> | ||
<field name="name">allow.billable.wizard.form</field> | ||
<field name="model">allow.billable.wizard</field> | ||
<field name="arch" type="xml"> | ||
<form> | ||
<field name="project_id" invisible="1"/> | ||
<group> | ||
<label for='project_id' string="Confirm Allow Billable Change"/> | ||
<p>Are you sure you want to change the 'Allow Billable' field to False for this project?</p> | ||
</group> | ||
<footer> | ||
<button name="confirm_change" string="Yes, Change it" type="object" class="btn-primary"/> | ||
<button name="cancel_change" string="Cancel" type="object" class="btn btn-default"/> | ||
</footer> | ||
</form> | ||
</field> | ||
</record> | ||
|
||
</data> | ||
|
||
</odoo> |
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,20 @@ | ||
from odoo import models, fields, api | ||
|
||
class AllowBillableWizard(models.TransientModel): | ||
_name = 'allow.billable.wizard' | ||
_description = 'Confirmar cambio de valor de Allow Billable' | ||
|
||
project_id = fields.Many2one('project.project', string='Project', default=lambda self: self.default_get_project_id()) | ||
|
||
@api.model | ||
def default_get_project_id(self): | ||
project = self.env['project.project'].search([('id', '=', self.env.context.get('project_id'))]) | ||
return project | ||
|
||
def confirm_change(self): | ||
self.project_id.allow_billable = False | ||
return {'type': 'ir.actions.act_window_close'} | ||
|
||
def cancel_change(self): | ||
self.project_id.allow_billable = True | ||
return {'type': 'ir.actions.act_window_close'} |
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