-
Notifications
You must be signed in to change notification settings - Fork 239
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
1 parent
a55ea16
commit f99c823
Showing
55 changed files
with
1,359 additions
and
1,366 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
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,30 +1,32 @@ | ||
# Copyright (C) 2018 - TODAY, Open Source Integrators | ||
# Copyright (C) 2020 Open Source Integrators | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class FSMCategory(models.Model): | ||
_name = 'fsm.category' | ||
_description = 'Field Service Worker Category' | ||
_name = "fsm.category" | ||
_description = "Field Service Worker Category" | ||
|
||
name = fields.Char(string='Name', required='True') | ||
parent_id = fields.Many2one('fsm.category', string='Parent') | ||
color = fields.Integer('Color Index', default=10) | ||
name = fields.Char(string="Name", required="True") | ||
parent_id = fields.Many2one("fsm.category", string="Parent") | ||
color = fields.Integer("Color Index", default=10) | ||
full_name = fields.Char(string="Full Name", compute="_compute_full_name") | ||
description = fields.Char(string='Description') | ||
description = fields.Char(string="Description") | ||
company_id = fields.Many2one( | ||
'res.company', string='Company', required=True, index=True, | ||
"res.company", | ||
string="Company", | ||
required=True, | ||
index=True, | ||
default=lambda self: self.env.user.company_id, | ||
help="Company related to this category") | ||
help="Company related to this category", | ||
) | ||
|
||
_sql_constraints = [ | ||
('name_uniq', 'unique (name)', "Category name already exists!"), | ||
] | ||
_sql_constraints = [("name_uniq", "unique (name)", "Category name already exists!")] | ||
|
||
def _compute_full_name(self): | ||
for record in self: | ||
if record.parent_id: | ||
record.full_name = (record.parent_id.name + '/' + record.name) | ||
record.full_name = record.parent_id.name + "/" + record.name | ||
else: | ||
record.full_name = record.name |
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
Oops, something went wrong.