diff --git a/addons/sale_stock/models/account_invoice.py b/addons/sale_stock/models/account_invoice.py
index 1397e433345..4bd9efe8021 100644
--- a/addons/sale_stock/models/account_invoice.py
+++ b/addons/sale_stock/models/account_invoice.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from openerp import fields, models
+from odoo import fields, models
class AccountInvoice(models.Model):
diff --git a/addons/sale_stock/models/procurement.py b/addons/sale_stock/models/procurement.py
index c49d639e8b0..93c07aaf7c0 100644
--- a/addons/sale_stock/models/procurement.py
+++ b/addons/sale_stock/models/procurement.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from openerp import models
+from odoo import models
class ProcurementOrder(models.Model):
diff --git a/addons/sale_stock/models/product.py b/addons/sale_stock/models/product.py
index c383b7f640e..a3c3b678cbf 100644
--- a/addons/sale_stock/models/product.py
+++ b/addons/sale_stock/models/product.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from openerp import api, models
+from odoo import api, models
class ProductProduct(models.Model):
diff --git a/addons/sale_stock/models/res_company.py b/addons/sale_stock/models/res_company.py
index 7b1e382f1aa..1677868c718 100644
--- a/addons/sale_stock/models/res_company.py
+++ b/addons/sale_stock/models/res_company.py
@@ -1,13 +1,15 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from openerp import fields, models
+from odoo import fields, models
+
class company(models.Model):
_inherit = 'res.company'
- security_lead = fields.Float('Sales Safety Days', required=True, default = 0.0,
- help="Margin of error for dates promised to customers. "\
- "Products will be scheduled for procurement and delivery "\
- "that many days earlier than the actual promised date, to "\
+ security_lead = fields.Float(
+ 'Sales Safety Days', default=0.0, required=True,
+ help="Margin of error for dates promised to customers. "
+ "Products will be scheduled for procurement and delivery "
+ "that many days earlier than the actual promised date, to "
"cope with unexpected delays in the supply chain.")
diff --git a/addons/sale_stock/models/sale_config_settings.py b/addons/sale_stock/models/sale_config_settings.py
index ef3cf1af33e..32baad15126 100644
--- a/addons/sale_stock/models/sale_config_settings.py
+++ b/addons/sale_stock/models/sale_config_settings.py
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from openerp import SUPERUSER_ID
-from openerp import api, fields, models, _
-from openerp.exceptions import AccessError
+from odoo import api, fields, models, _
+from odoo.exceptions import AccessError
+
class SaleConfiguration(models.TransientModel):
_inherit = 'sale.config.settings'
@@ -43,5 +43,4 @@ class SaleConfiguration(models.TransientModel):
default_picking_policy = 'one' if self.default_picking_policy else 'direct'
self.env['ir.values'].sudo().set_default('sale.order', 'picking_policy', default_picking_policy)
- res = super(SaleConfiguration, self).set_sale_defaults()
- return res
+ return super(SaleConfiguration, self).set_sale_defaults()
diff --git a/addons/sale_stock/models/sale_order.py b/addons/sale_stock/models/sale_order.py
index ae54eb3a591..88accc4c053 100644
--- a/addons/sale_stock/models/sale_order.py
+++ b/addons/sale_stock/models/sale_order.py
@@ -2,9 +2,10 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime, timedelta
-from openerp import api, fields, models, _
-from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, float_compare
-from openerp.exceptions import UserError
+
+from odoo import api, fields, models, _
+from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT, float_compare
+from odoo.exceptions import UserError
class SaleOrder(models.Model):
@@ -16,13 +17,16 @@ class SaleOrder(models.Model):
warehouse_ids = self.env['stock.warehouse'].search([('company_id', '=', company)], limit=1)
return warehouse_ids
- incoterm = fields.Many2one('stock.incoterms', 'Incoterms', help="International Commercial Terms are a series of predefined commercial terms used in international transactions.")
+ incoterm = fields.Many2one(
+ 'stock.incoterms', 'Incoterms',
+ help="International Commercial Terms are a series of predefined commercial terms used in international transactions.")
picking_policy = fields.Selection([
('direct', 'Deliver each product when available'),
('one', 'Deliver all products at once')],
string='Shipping Policy', required=True, readonly=True, default='direct',
states={'draft': [('readonly', False)], 'sent': [('readonly', False)]})
- warehouse_id = fields.Many2one('stock.warehouse', string='Warehouse',
+ warehouse_id = fields.Many2one(
+ 'stock.warehouse', string='Warehouse',
required=True, readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
default=_default_warehouse_id)
picking_ids = fields.Many2many('stock.picking', compute='_compute_picking_ids', string='Picking associated to this sale')
@@ -93,6 +97,7 @@ class SaleOrder(models.Model):
super(SaleOrder, self)._get_customer_lead(product_tmpl_id)
return product_tmpl_id.sale_delay
+
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
diff --git a/addons/sale_stock/models/stock.py b/addons/sale_stock/models/stock.py
index eefa7a499ca..e3097132860 100644
--- a/addons/sale_stock/models/stock.py
+++ b/addons/sale_stock/models/stock.py
@@ -1,18 +1,20 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from openerp import api, fields, models
+from odoo import api, fields, models
class StockLocationRoute(models.Model):
_inherit = "stock.location.route"
- sale_selectable = fields.Boolean(string="Selectable on Sales Order Line")
+ sale_selectable = fields.Boolean("Selectable on Sales Order Line")
+
class StockMove(models.Model):
_inherit = "stock.move"
- to_refund_so = fields.Boolean(string="To Refund in SO", default=False,
+ to_refund_so = fields.Boolean(
+ "To Refund in SO", default=False,
help='Trigger a decrease of the delivered quantity in the associated Sale Order')
@api.multi
@@ -35,11 +37,13 @@ class StockMove(models.Model):
if move.picking_id and move.picking_id.group_id:
picking = move.picking_id
order = self.env['sale.order'].search([('procurement_group_id', '=', picking.group_id.id)])
- picking.message_post_with_view('mail.message_origin_link',
+ picking.message_post_with_view(
+ 'mail.message_origin_link',
values={'self': picking, 'origin': order},
subtype_id=self.env.ref('mail.mt_note').id)
return result
+
class StockPicking(models.Model):
_inherit = 'stock.picking'
@@ -68,11 +72,13 @@ class StockPicking(models.Model):
for picking in self.filtered(lambda pick: pick.picking_type_id.code == 'outgoing'):
backorder = picking.search([('backorder_id', '=', picking.id)])
order = self.env['sale.order'].search([('procurement_group_id', '=', backorder.group_id.id)])
- backorder.message_post_with_view('mail.message_origin_link',
+ backorder.message_post_with_view(
+ 'mail.message_origin_link',
values={'self': backorder, 'origin': order},
subtype_id=self.env.ref('mail.mt_note').id)
return res
+
class StockReturnPicking(models.TransientModel):
_inherit = "stock.return.picking"
@@ -91,4 +97,4 @@ class StockReturnPicking(models.TransientModel):
class StockReturnPickingLine(models.TransientModel):
_inherit = "stock.return.picking.line"
- to_refund_so = fields.Boolean(string="To Refund", help='Trigger a decrease of the delivered quantity in the associated Sale Order')
\ No newline at end of file
+ to_refund_so = fields.Boolean(string="To Refund", help='Trigger a decrease of the delivered quantity in the associated Sale Order')
diff --git a/addons/sale_stock/views/res_company_views.xml b/addons/sale_stock/views/res_company_views.xml
index 4866d30d6d6..96b29e66925 100644
--- a/addons/sale_stock/views/res_company_views.xml
+++ b/addons/sale_stock/views/res_company_views.xml
@@ -1,5 +1,5 @@
-
+
res.company.mrp.config
@@ -13,4 +13,4 @@
-
+
diff --git a/addons/sale_stock/views/sale_order_views.xml b/addons/sale_stock/views/sale_order_views.xml
index fe20f3ac993..0ad787dbafe 100644
--- a/addons/sale_stock/views/sale_order_views.xml
+++ b/addons/sale_stock/views/sale_order_views.xml
@@ -1,5 +1,5 @@
-
+
@@ -51,4 +51,4 @@
-
+
diff --git a/addons/sale_stock/views/stock_views.xml b/addons/sale_stock/views/stock_views.xml
index 9cd7e71576a..894fbd91b66 100644
--- a/addons/sale_stock/views/stock_views.xml
+++ b/addons/sale_stock/views/stock_views.xml
@@ -1,5 +1,5 @@
-
+
-
+