From 8379ec662f511b9bf1629ff52b2d7ea2b96bba4f Mon Sep 17 00:00:00 2001 From: MonsieurB Date: Tue, 7 Mar 2017 10:49:39 +0100 Subject: [PATCH] pr reviews --- product_quick_bom/README.rst | 6 +-- product_quick_bom/bom.py | 7 ++-- product_quick_bom/i18n/product_quick_bom.pot | 42 -------------------- product_quick_bom/product.py | 7 ++-- product_quick_bom/product_view.xml | 4 -- 5 files changed, 11 insertions(+), 55 deletions(-) delete mode 100644 product_quick_bom/i18n/product_quick_bom.pot diff --git a/product_quick_bom/README.rst b/product_quick_bom/README.rst index 88a77b8645..2697b28e99 100644 --- a/product_quick_bom/README.rst +++ b/product_quick_bom/README.rst @@ -20,7 +20,7 @@ To use this module, you need to: .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/{repo_id}/{branch} + :target: https://runbot.odoo-community.org/runbot/manufacture/10.0 .. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt .. branch is "8.0" for example @@ -33,10 +33,10 @@ For further information, please visit: Bug Tracker =========== -Bugs are tracked on `GitHub Issues `_. +Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback -`here `_. +`here `_. Credits diff --git a/product_quick_bom/bom.py b/product_quick_bom/bom.py index 075e5274b7..9e3313ab2b 100644 --- a/product_quick_bom/bom.py +++ b/product_quick_bom/bom.py @@ -2,7 +2,7 @@ # Copyright (C) 2015 Akretion (http://www.akretion.com). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import models, fields +from odoo import fields, models, _ class MrpBom(models.Model): @@ -11,7 +11,7 @@ class MrpBom(models.Model): _sql_constraint = ( 'uniq_product_template', 'uniq(product_tmpl_id)', - 'You can only have one Bom per product template', + _('You can only have one Bom per product template'), ) @@ -19,6 +19,7 @@ class MrpBomLine(models.Model): _inherit = 'mrp.bom.line' product_tmpl_id = fields.Many2one( - 'product.template', + comodel_name='product.template', related='bom_id.product_tmpl_id', + readonly=True, store=True) diff --git a/product_quick_bom/i18n/product_quick_bom.pot b/product_quick_bom/i18n/product_quick_bom.pot deleted file mode 100644 index 6e228f84ad..0000000000 --- a/product_quick_bom/i18n/product_quick_bom.pot +++ /dev/null @@ -1,42 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * product_quick_bom -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 8.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-09-13 16:25+0000\n" -"PO-Revision-Date: 2015-09-13 16:25+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: product_quick_bom -#: model:ir.model,name:product_quick_bom.model_mrp_bom -msgid "Bill of Material" -msgstr "" - -#. module: product_quick_bom -#: field:product.template,bom_line_ids:0 -msgid "Bom Line" -msgstr "" - -#. module: product_quick_bom -#: view:product.template:product_quick_bom.product_template_form_view -msgid "Bom line" -msgstr "" - -#. module: product_quick_bom -#: help:product.template,bom_line_ids:0 -msgid "If you product is manufactured you can selecthere the componant to product them" -msgstr "" - -#. module: product_quick_bom -#: model:ir.model,name:product_quick_bom.model_product_template -msgid "Product Template" -msgstr "" - diff --git a/product_quick_bom/product.py b/product_quick_bom/product.py index 893f6b7bce..f863a71e1e 100644 --- a/product_quick_bom/product.py +++ b/product_quick_bom/product.py @@ -2,15 +2,15 @@ # Copyright (C) 2015 Akretion (http://www.akretion.com). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import models, fields, api +from odoo import api, fields, models class ProductTemplate(models.Model): _inherit = 'product.template' bom_line_ids = fields.One2many( - 'mrp.bom.line', - 'product_tmpl_id', + comodel_name='mrp.bom.line', + inverse_name='product_tmpl_id', string='Bom Line', help='If you product is manufactured you can select' 'here the componant to product them') @@ -21,6 +21,7 @@ def _extract_bom_line(self, vals): @api.multi def _prepare_bom_vals(self, vals): + self.ensure_one() return { 'product_tmpl_id': self.id, 'bom_line_ids': vals, diff --git a/product_quick_bom/product_view.xml b/product_quick_bom/product_view.xml index eabbe6fb58..804c1267cd 100644 --- a/product_quick_bom/product_view.xml +++ b/product_quick_bom/product_view.xml @@ -1,7 +1,5 @@ - - product.template @@ -19,6 +17,4 @@ - -