forked from OCA/product-attribute
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '12.0-imp-product_bom_revision-name-get' of git+ssh://gi…
…thub.com/efatto/product-attribute into 12.0
- Loading branch information
Showing
1 changed file
with
12 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,10 +1,21 @@ | ||
# Copyright 2019 C2i Change 2 improve - Eduardo Magdalena <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
from odoo import _, api, fields, models | ||
|
||
|
||
class MrpBom(models.Model): | ||
_inherit = 'mrp.bom' | ||
|
||
bom_revision = fields.Char(string="Revision") | ||
|
||
@api.multi | ||
def name_get(self): | ||
result = [] | ||
for bom in self: | ||
rec_name = "%s %s" % ( | ||
_("[Rev. %s]") % bom.bom_revision if bom.bom_revision else '', | ||
bom.product_tmpl_id.name, | ||
) | ||
result.append((bom.id, rec_name)) | ||
return result |