Skip to content

Commit

Permalink
[UPD] Modify addon project_budget
Browse files Browse the repository at this point in the history
  • Loading branch information
marrasbinovo committed Oct 31, 2024
1 parent 3cd6e17 commit 5bfc3b8
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 27 deletions.
8 changes: 3 additions & 5 deletions project_budget/models/crossovered_budget.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,16 @@ def button_recompute_line_amount(self):
def open_pivot_view(self):
self.ensure_one()
self.button_recompute_line_amount()
action = self.env.ref("account_budget_oca.act_crossovered_budget_lines_view")
action_dict = action.read()[0]
action_dict.update(
action = self.env["ir.actions.actions"]._for_xml_id("account_budget_oca.act_crossovered_budget_lines_view")
action.update(
{
"view_mode": "pivot",
"view_id": False,
"views": [],
"domain": [("crossovered_budget_id", "=", self.id)],
}
)
return action_dict

return action

class CrossoveredBudgetLines(models.Model):
_inherit = "crossovered.budget.lines"
Expand Down
8 changes: 0 additions & 8 deletions project_budget/views/project_project_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@
<field name="analytic_account_id" position="after">
<field name="current_budget_id" invisible="1"/>
</field>
<button name="%(project_budget_action)d" position="after">
<button class="oe_stat_button" type="action"
name="%(project_budget_action)d" icon="fa-tasks"
context="{'search_default_current_budget_filter': 1}">
<field string="Current Budget" name="current_budget_count"
widget="statinfo"/>
</button>
</button>
</field>
</record>

Expand Down
24 changes: 12 additions & 12 deletions project_budget_characterization/i18n/es.po
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_budget_characterization
# * project_budget_characterization
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-01 10:20+0000\n"
"PO-Revision-Date: 2018-10-01 10:20+0000\n"
"Last-Translator: <>\n"
"POT-Creation-Date: 2024-10-31 07:26+0000\n"
"PO-Revision-Date: 2024-10-31 07:26+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: project_budget_characterization
#: model:ir.model.fields,field_description:project_budget_characterization.field_crossovered_budget_lines_res_area_id
#: model:ir.ui.view,arch_db:project_budget_characterization.crossovered_budget_lines_search_view
#: model:ir.model.fields,field_description:project_budget_characterization.field_crossovered_budget_lines__res_area_id
#: model_terms:ir.ui.view,arch_db:project_budget_characterization.crossovered_budget_lines_search_view
msgid "Area"
msgstr "Área"

#. module: project_budget_characterization
#: model:ir.model.fields,field_description:project_budget_characterization.field_crossovered_budget_lines_res_area_type_id
#: model:ir.ui.view,arch_db:project_budget_characterization.crossovered_budget_lines_search_view
#: model:ir.model.fields,field_description:project_budget_characterization.field_crossovered_budget_lines__res_area_type_id
#: model_terms:ir.ui.view,arch_db:project_budget_characterization.crossovered_budget_lines_search_view
msgid "Area Type"
msgstr "Tipo"

#. module: project_budget_characterization
#: model:ir.model,name:project_budget_characterization.model_crossovered_budget_lines
msgid "Budget Line"
msgstr "Línea de presupuesto"
msgstr "Línea de Presupuesto"

#. module: project_budget_characterization
#: model:ir.model.fields,field_description:project_budget_characterization.field_crossovered_budget_lines_res_team_id
#: model:ir.ui.view,arch_db:project_budget_characterization.crossovered_budget_lines_search_view
#: model:ir.model.fields,field_description:project_budget_characterization.field_crossovered_budget_lines__res_team_id
#: model_terms:ir.ui.view,arch_db:project_budget_characterization.crossovered_budget_lines_search_view
msgid "Team"
msgstr "Equipo"

20 changes: 18 additions & 2 deletions project_characterization/models/project_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,24 @@ def _onchange_area_id(self):

@api.onchange("res_area_id", "res_area_type_id")
def _onchange_area_type(self):
if self.analytic_account_id:
self.analytic_account_id._onchange_area_type()
self.ensure_one()
get_param = self.env['ir.config_parameter'].sudo().get_param
manual_code = get_param('project_characterization.manual_code', 'False').lower() == 'true'
if not manual_code:
if self.res_area_id and self.res_area_type_id:
try:
projects = self.search([
('res_area_id', '=', self.res_area_id.id),
('res_area_type_id', '=', self.res_area_type_id.id)
])
count = int(sorted(
projects.mapped('num_code'), key=int, reverse=True)[0])
except Exception:
count = self.search_count([
('res_area_id', '=', self.res_area_id.id),
('res_area_type_id', '=', self.res_area_type_id.id)
])
self.num_code = count + 1


class ResArea(models.Model):
Expand Down

0 comments on commit 5bfc3b8

Please sign in to comment.