From 9f8eae34d1d89d7cf01eef8a1a89dc431ef5f4e2 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 19 Jul 2018 13:35:27 +0200 Subject: [FIX] undefined variables (potential nameerror) Backport 9ec0455abc041b855dcab18e8e185baf806b9f14 and 6a601fe6dc848cdeca2ab8429210e3b5087275d9 as they fixed various possible NameError but did so in later sub-releases. --- addons/account/tests/test_reconciliation.py | 1 + addons/base_sparse_field/models/models.py | 3 ++- addons/mail/models/mail_channel.py | 4 ++-- addons/point_of_sale/models/pos_config.py | 4 ++-- addons/stock_account/models/account_invoice.py | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) (limited to 'addons') diff --git a/addons/account/tests/test_reconciliation.py b/addons/account/tests/test_reconciliation.py index 8f49ee0e734..73a450ae25a 100644 --- a/addons/account/tests/test_reconciliation.py +++ b/addons/account/tests/test_reconciliation.py @@ -1,3 +1,4 @@ +from odoo import api from odoo.addons.account.tests.account_test_classes import AccountingTestCase import time import unittest diff --git a/addons/base_sparse_field/models/models.py b/addons/base_sparse_field/models/models.py index ef5fc4e5dbf..77ea36a6bd8 100644 --- a/addons/base_sparse_field/models/models.py +++ b/addons/base_sparse_field/models/models.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- -from odoo import models, fields, api +from odoo import models, fields, api, _ +from odoo.exceptions import UserError class IrModelFields(models.Model): diff --git a/addons/mail/models/mail_channel.py b/addons/mail/models/mail_channel.py index cbbbfe855b3..8f701194494 100644 --- a/addons/mail/models/mail_channel.py +++ b/addons/mail/models/mail_channel.py @@ -4,7 +4,7 @@ import base64 from email.utils import formataddr import re -import uuid +from uuid import uuid4 from odoo import _, api, fields, models, modules, tools from odoo.exceptions import UserError @@ -56,7 +56,7 @@ class Channel(models.Model): ('channel', 'Channel')], 'Channel Type', default='channel') description = fields.Text('Description') - uuid = fields.Char('UUID', size=50, index=True, default=lambda self: '%s' % uuid.uuid4(), copy=False) + uuid = fields.Char('UUID', size=50, index=True, default=lambda self: str(uuid4()), copy=False) email_send = fields.Boolean('Send messages by email', default=False) # multi users channel channel_last_seen_partner_ids = fields.One2many('mail.channel.partner', 'channel_id', string='Last Seen') diff --git a/addons/point_of_sale/models/pos_config.py b/addons/point_of_sale/models/pos_config.py index cad08436916..afd0f6353a3 100644 --- a/addons/point_of_sale/models/pos_config.py +++ b/addons/point_of_sale/models/pos_config.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -import uuid +from uuid import uuid4 from odoo import api, fields, models, _ from odoo.exceptions import ValidationError @@ -110,7 +110,7 @@ class PosConfig(models.Model): proxy_ip = fields.Char(string='IP Address', size=45, help='The hostname or ip address of the hardware proxy, Will be autodetected if left empty.') active = fields.Boolean(default=True) - uuid = fields.Char(readonly=True, default=lambda self: str(uuid.uuid4()), + uuid = fields.Char(readonly=True, default=lambda self: str(uuid4()), help='A globally unique identifier for this pos configuration, used to prevent conflicts in client-generated data.') sequence_id = fields.Many2one('ir.sequence', string='Order IDs Sequence', readonly=True, help="This sequence is automatically created by Odoo but you can change it " diff --git a/addons/stock_account/models/account_invoice.py b/addons/stock_account/models/account_invoice.py index 5f9263dbbc1..60842b1bef4 100644 --- a/addons/stock_account/models/account_invoice.py +++ b/addons/stock_account/models/account_invoice.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import api, models +from odoo import api, models, fields import logging -- cgit v1.2.3