-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] project_budget: wizard to select budget date
- Loading branch information
Showing
8 changed files
with
138 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from . import models | ||
from . import wizards |
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,4 @@ | ||
# Copyright 2019 Oihane Crucelaegui - AvanzOSC | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import project_initial_budget |
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,27 @@ | ||
# Copyright 2019 Oihane Crucelaegui - AvanzOSC | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class ProjectInitialBudget(models.TransientModel): | ||
_name = 'project.initial.budget' | ||
_description = 'Wizard to create initial budget' | ||
|
||
project_ids = fields.Many2many( | ||
comodel_name='project.project', string='Project') | ||
date = fields.Date( | ||
string='Budget Date', default=lambda s: fields.Date.context_today(s)) | ||
|
||
@api.model | ||
def default_get(self, fields): | ||
rec = super(ProjectInitialBudget, self).default_get(fields) | ||
rec.update({ | ||
'project_ids': [(6, 0, self.env.context.get('active_ids'))], | ||
}) | ||
return rec | ||
|
||
@api.multi | ||
def create_initial_project_budget(self): | ||
self.ensure_one() | ||
self.project_ids.create_initial_project_budget(date=self.date) |
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,28 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<odoo> | ||
<record id="project_initial_budget_view_form" model="ir.ui.view"> | ||
<field name="model">project.initial.budget</field> | ||
<field name="arch" type="xml"> | ||
<form> | ||
<group name="main"> | ||
<field name="project_ids" invisible="True"/> | ||
<field name="date" required="True"/> | ||
</group> | ||
<footer> | ||
<button name="create_initial_project_budget" type="object" | ||
string="Create Initial Budget" class="oe_highlight" /> | ||
or | ||
<button string="Cancel" class="oe_link" special="cancel"/> | ||
</footer> | ||
</form> | ||
</field> | ||
</record> | ||
|
||
<act_window id="project_initial_budget_wizard_action" | ||
key2="client_action_multi" | ||
name="Create Initial Budget" | ||
res_model="project.initial.budget" | ||
src_model="project.project" | ||
view_mode="form" | ||
target="new" /> | ||
</odoo> |