diff --git a/account_move_budget/__init__.py b/account_move_budget/__init__.py
index fd460805..0650744f 100644
--- a/account_move_budget/__init__.py
+++ b/account_move_budget/__init__.py
@@ -1,3 +1 @@
-
from . import models
-
diff --git a/account_move_budget/__manifest__.py b/account_move_budget/__manifest__.py
index 7283e69e..5009c4a1 100644
--- a/account_move_budget/__manifest__.py
+++ b/account_move_budget/__manifest__.py
@@ -7,15 +7,11 @@
"version": "12.0.1.0.0",
"category": "Accounting & Finance",
"website": "https://github.com/OCA/account-financial-tools",
- "author": "Eficent, "
- "Odoo Community Association (OCA)",
+ "author": "Eficent, " "Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
- "depends": [
- "account",
- "date_range",
- ],
+ "depends": ["account", "date_range"],
"data": [
"security/ir.model.access.csv",
"views/account_move_budget_line_views.xml",
diff --git a/account_move_budget/models/__init__.py b/account_move_budget/models/__init__.py
index be082f2c..0a26d503 100644
--- a/account_move_budget/models/__init__.py
+++ b/account_move_budget/models/__init__.py
@@ -1,3 +1,2 @@
-
from . import account_move_budget
from . import account_move_budget_line
diff --git a/account_move_budget/models/account_move_budget.py b/account_move_budget/models/account_move_budget.py
index d259ac62..45f18568 100644
--- a/account_move_budget/models/account_move_budget.py
+++ b/account_move_budget/models/account_move_budget.py
@@ -8,51 +8,30 @@ from odoo import _, api, fields, models
class AccountMoveBudget(models.Model):
_name = "account.move.budget"
_description = "Account Move Budget"
- _inherit = ['mail.thread', 'mail.activity.mixin']
+ _inherit = ["mail.thread", "mail.activity.mixin"]
@api.model
def _default_company(self):
- return self.env['res.company']. \
- _company_default_get('mis.budget')
+ return self.env["res.company"]._company_default_get("mis.budget")
- name = fields.Char(
- required=True,
- track_visibility='onchange',
- )
- description = fields.Char(
- track_visibility='onchange',
- )
- date_range_id = fields.Many2one(
- comodel_name='date.range',
- string='Date range',
- )
+ name = fields.Char(required=True, track_visibility="onchange")
+ description = fields.Char(track_visibility="onchange")
+ date_range_id = fields.Many2one(comodel_name="date.range", string="Date range")
date_from = fields.Date(
- required=True,
- string='From Date',
- track_visibility='onchange',
- )
- date_to = fields.Date(
- required=True,
- string='To Date',
- track_visibility='onchange',
+ required=True, string="From Date", track_visibility="onchange"
)
+ date_to = fields.Date(required=True, string="To Date", track_visibility="onchange")
state = fields.Selection(
- [('draft', 'Draft'),
- ('confirmed', 'Confirmed'),
- ('cancelled', 'Cancelled')],
+ [("draft", "Draft"), ("confirmed", "Confirmed"), ("cancelled", "Cancelled")],
required=True,
- default='draft',
- track_visibility='onchange',
+ default="draft",
+ track_visibility="onchange",
)
line_ids = fields.One2many(
- comodel_name='account.move.budget.line',
- inverse_name='budget_id',
- copy=True,
+ comodel_name="account.move.budget.line", inverse_name="budget_id", copy=True
)
company_id = fields.Many2one(
- comodel_name='res.company',
- string='Company',
- default=_default_company,
+ comodel_name="res.company", string="Company", default=_default_company
)
@api.multi
@@ -60,36 +39,38 @@ class AccountMoveBudget(models.Model):
self.ensure_one()
if default is None:
default = {}
- if 'name' not in default:
- default['name'] = _("%s (copy)") % self.name
+ if "name" not in default:
+ default["name"] = _("%s (copy)") % self.name
return super(AccountMoveBudget, self).copy(default=default)
- @api.onchange('date_range_id')
+ @api.onchange("date_range_id")
def _onchange_date_range(self):
for rec in self:
if rec.date_range_id:
rec.date_from = rec.date_range_id.date_start
rec.date_to = rec.date_range_id.date_end
- @api.onchange('date_from', 'date_to')
+ @api.onchange("date_from", "date_to")
def _onchange_dates(self):
for rec in self:
if rec.date_range_id:
- if rec.date_from != rec.date_range_id.date_start or \
- rec.date_to != rec.date_range_id.date_end:
+ if (
+ rec.date_from != rec.date_range_id.date_start
+ or rec.date_to != rec.date_range_id.date_end
+ ):
rec.date_range_id = False
@api.multi
def action_draft(self):
for rec in self:
- rec.state = 'draft'
+ rec.state = "draft"
@api.multi
def action_cancel(self):
for rec in self:
- rec.state = 'cancelled'
+ rec.state = "cancelled"
@api.multi
def action_confirm(self):
for rec in self:
- rec.state = 'confirmed'
+ rec.state = "confirmed"
diff --git a/account_move_budget/models/account_move_budget_line.py b/account_move_budget/models/account_move_budget_line.py
index 26354627..520a5462 100644
--- a/account_move_budget/models/account_move_budget_line.py
+++ b/account_move_budget/models/account_move_budget_line.py
@@ -11,77 +11,62 @@ class AccountMoveBudgetLine(models.Model):
_order = "date desc, id desc"
budget_id = fields.Many2one(
- comodel_name='account.move.budget',
+ comodel_name="account.move.budget",
string="Budget",
required=True,
- ondelete='cascade',
+ ondelete="cascade",
index=True,
)
name = fields.Char(string="Label")
- debit = fields.Monetary(
- default=0.0,
- currency_field='company_currency_id',
- )
- credit = fields.Monetary(
- default=0.0,
- currency_field='company_currency_id'
- )
+ debit = fields.Monetary(default=0.0, currency_field="company_currency_id")
+ credit = fields.Monetary(default=0.0, currency_field="company_currency_id")
balance = fields.Monetary(
- compute='_compute_store_balance',
+ compute="_compute_store_balance",
store=True,
- currency_field='company_currency_id',
+ currency_field="company_currency_id",
help="Technical field holding the debit - "
- "credit in order to open meaningful "
- "graph views from reports",
+ "credit in order to open meaningful "
+ "graph views from reports",
)
company_currency_id = fields.Many2one(
- 'res.currency',
- related='company_id.currency_id',
+ "res.currency",
+ related="company_id.currency_id",
string="Company Currency",
readonly=True,
- help='Utility field to express amount currency',
+ help="Utility field to express amount currency",
store=True,
)
account_id = fields.Many2one(
- 'account.account',
- string='Account',
+ "account.account",
+ string="Account",
required=True,
index=True,
ondelete="cascade",
- domain=[('deprecated', '=', False)],
- default=lambda self: self._context.get('account_id', False),
- )
- date = fields.Date(
- string='Date',
- index=True,
- required=True,
+ domain=[("deprecated", "=", False)],
+ default=lambda self: self._context.get("account_id", False),
)
+ date = fields.Date(string="Date", index=True, required=True)
analytic_account_id = fields.Many2one(
- 'account.analytic.account',
- string='Analytic Account',
+ "account.analytic.account", string="Analytic Account"
)
company_id = fields.Many2one(
- 'res.company',
- related='account_id.company_id',
- string='Company',
+ "res.company",
+ related="account_id.company_id",
+ string="Company",
store=True,
readonly=True,
)
- partner_id = fields.Many2one(
- 'res.partner',
- string='Partner',
- ondelete='restrict',
- )
+ partner_id = fields.Many2one("res.partner", string="Partner", ondelete="restrict")
- @api.depends('debit', 'credit')
+ @api.depends("debit", "credit")
def _compute_store_balance(self):
for line in self:
line.balance = line.debit - line.credit
- @api.constrains('date')
+ @api.constrains("date")
def _constraint_date(self):
for rec in self:
- if rec.budget_id.date_from > rec.date or \
- rec.budget_id.date_to < rec.date:
- raise ValidationError(_('The date must be within the '
- 'budget period.'))
+ if rec.budget_id.date_from > rec.date or rec.budget_id.date_to < rec.date:
+ raise ValidationError(
+ _("The date must be within the " "budget period.")
+ )
diff --git a/account_move_budget/views/account_move_budget_line_views.xml b/account_move_budget/views/account_move_budget_line_views.xml
index 12bf7a7f..59bab875 100644
--- a/account_move_budget/views/account_move_budget_line_views.xml
+++ b/account_move_budget/views/account_move_budget_line_views.xml
@@ -2,26 +2,26 @@
-
Account Move Budget Line tree
account.move.budget.line
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
Budget Items
account.move.budget.line
@@ -29,5 +29,4 @@
[('budget_id', '=', active_id)]
{'default_budget_id': active_id}
-
diff --git a/account_move_budget/views/account_move_budget_views.xml b/account_move_budget/views/account_move_budget_views.xml
index adbe4a6a..27036c18 100644
--- a/account_move_budget/views/account_move_budget_views.xml
+++ b/account_move_budget/views/account_move_budget_views.xml
@@ -1,80 +1,93 @@
-
+
-
-
account.move.budget.form
account.move.budget
-
account.move.budget.search
account.move.budget
-
-
+
+
-
account.move.budget.tree
account.move.budget
-
-
-
-
+
+
+
+
-
Account Move Budgets
account.move.budget
@@ -82,11 +95,12 @@
[]
{}
-
-