diff --git a/addons/account/models/account.py b/addons/account/models/account.py
index 15f078c0f6b..d9f9ab1f450 100644
--- a/addons/account/models/account.py
+++ b/addons/account/models/account.py
@@ -467,7 +467,10 @@ class AccountJournal(models.Model):
@api.model
def name_search(self, name='', args=None, operator='ilike', limit=100):
args = args or []
- recs = self.search(['|', ('code', operator, name), ('name', operator, name)] + args, limit=limit)
+ connector = '|'
+ if operator in expression.NEGATIVE_TERM_OPERATORS:
+ connector = '&'
+ recs = self.search([connector, ('code', operator, name), ('name', operator, name)] + args, limit=limit)
return recs.name_get()
@api.multi
diff --git a/addons/account/tests/account_test_classes.py b/addons/account/tests/account_test_classes.py
index cf37e2493ef..8477f4109d9 100644
--- a/addons/account/tests/account_test_classes.py
+++ b/addons/account/tests/account_test_classes.py
@@ -28,3 +28,30 @@ class AccountingTestCase(HttpCase):
if theorical_lines:
raise ValidationError('Remaining theorical line (not found). %s)' % ([(aml[0], aml[1], aml[2]) for aml in theorical_lines]))
return True
+
+ def ensure_account_property(self, property_name):
+ '''Ensure the ir.property targetting an account.account passed as parameter exists.
+ In case it's not: create it with a random account. This is useful when testing with
+ partially defined localization (missing stock properties for example)
+
+ :param property_name: The name of the property.
+ '''
+ company_id = self.env.user.company_id
+ field_id = self.env['ir.model.fields'].search(
+ [('model', '=', 'product.template'), ('name', '=', property_name)], limit=1)
+ property_id = self.env['ir.property'].search([
+ ('company_id', '=', company_id.id),
+ ('name', '=', property_name),
+ ('res_id', '=', None),
+ ('fields_id', '=', field_id.id)], limit=1)
+ account_id = self.env['account.account'].search([('company_id', '=', company_id.id)], limit=1)
+ value_reference = 'account.account,%d' % account_id.id
+ if property_id and not property_id.value_reference:
+ property_id.value_reference = value_reference
+ else:
+ self.env['ir.property'].create({
+ 'name': property_name,
+ 'company_id': company_id.id,
+ 'fields_id': field_id.id,
+ 'value_reference': value_reference,
+ })
diff --git a/addons/base_geolocalize/models/res_partner.py b/addons/base_geolocalize/models/res_partner.py
index 778a844ad83..44fa8d9692f 100644
--- a/addons/base_geolocalize/models/res_partner.py
+++ b/addons/base_geolocalize/models/res_partner.py
@@ -8,6 +8,8 @@ from odoo.exceptions import UserError
def geo_find(addr):
+ if not addr:
+ return None
url = 'https://maps.googleapis.com/maps/api/geocode/json?sensor=false&address='
url += urllib2.quote(addr.encode('utf8'))
diff --git a/addons/delivery/models/delivery_carrier.py b/addons/delivery/models/delivery_carrier.py
index 543c0feb0b7..dc91bf4e5e6 100644
--- a/addons/delivery/models/delivery_carrier.py
+++ b/addons/delivery/models/delivery_carrier.py
@@ -226,26 +226,26 @@ class DeliveryCarrier(models.Model):
if record.delivery_type == 'fixed':
PriceRule.search([('carrier_id', '=', record.id)]).unlink()
- line_data = {
- 'carrier_id': record.id,
- 'variable': 'price',
- 'operator': '>=',
- }
- # Create the delivery price rules
- if record.free_if_more_than:
- line_data.update({
- 'max_value': record.amount,
- 'standard_price': 0.0,
- 'list_base_price': 0.0,
- })
- PriceRule.create(line_data)
- if record.fixed_price is not False:
- line_data.update({
- 'max_value': 0.0,
- 'standard_price': record.fixed_price,
- 'list_base_price': record.fixed_price,
- })
- PriceRule.create(line_data)
+ line_data = {
+ 'carrier_id': record.id,
+ 'variable': 'price',
+ 'operator': '>=',
+ }
+ # Create the delivery price rules
+ if record.free_if_more_than:
+ line_data.update({
+ 'max_value': record.amount,
+ 'standard_price': 0.0,
+ 'list_base_price': 0.0,
+ })
+ PriceRule.create(line_data)
+ if record.fixed_price is not False:
+ line_data.update({
+ 'max_value': 0.0,
+ 'standard_price': record.fixed_price,
+ 'list_base_price': record.fixed_price,
+ })
+ PriceRule.create(line_data)
return True
@api.model
diff --git a/addons/sale/tests/test_sale_order.py b/addons/sale/tests/test_sale_order.py
index f319b00b093..85c2ae25754 100644
--- a/addons/sale/tests/test_sale_order.py
+++ b/addons/sale/tests/test_sale_order.py
@@ -104,6 +104,9 @@ class TestSaleOrder(TestSale):
def test_cost_invoicing(self):
""" Test confirming a vendor invoice to reinvoice cost on the so """
+ # force the pricelist to have the same currency as the company
+ self.env.ref('product.list0').currency_id = self.env.ref('base.main_company').currency_id
+
serv_cost = self.env.ref('product.service_cost_01')
prod_gap = self.env.ref('product.product_product_1')
so = self.env['sale.order'].create({
diff --git a/addons/sale_expense/tests/test_sale_expense.py b/addons/sale_expense/tests/test_sale_expense.py
index 2dd9dba7726..9b3fa6cd79a 100644
--- a/addons/sale_expense/tests/test_sale_expense.py
+++ b/addons/sale_expense/tests/test_sale_expense.py
@@ -7,6 +7,9 @@ from odoo.addons.sale.tests.test_sale_common import TestSale
class TestSaleExpense(TestSale):
def test_sale_expense(self):
""" Test the behaviour of sales orders when managing expenses """
+ # force the pricelist to have the same currency as the company
+ self.env.ref('product.list0').currency_id = self.env.ref('base.main_company').currency_id
+
# create a so with a product invoiced on delivery
prod = self.env.ref('product.product_product_1')
so = self.env['sale.order'].create({
diff --git a/addons/stock/i18n/stock.pot b/addons/stock/i18n/stock.pot
index 37ccefde9ac..d74c2079c82 100644
--- a/addons/stock/i18n/stock.pot
+++ b/addons/stock/i18n/stock.pot
@@ -6499,6 +6499,12 @@ msgid "You cannot set a negative product quantity in an inventory line:\n"
" %s - qty: %s"
msgstr ""
+#. module: stock
+#: code:addons/stock/models/stock_production_lot.py:37
+#, python-format
+msgid "You are not allowed to create a lot for this picking type"
+msgstr ""
+
#. module: stock
#: code:addons/stock/models/stock_move.py:924
#, python-format
diff --git a/addons/stock/models/stock_production_lot.py b/addons/stock/models/stock_production_lot.py
index 60f370fff51..a568cd80fe3 100644
--- a/addons/stock/models/stock_production_lot.py
+++ b/addons/stock/models/stock_production_lot.py
@@ -2,6 +2,7 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
+from odoo.exceptions import UserError
class ProductionLot(models.Model):
@@ -27,6 +28,15 @@ class ProductionLot(models.Model):
('name_ref_uniq', 'unique (name, product_id)', 'The combination of serial number and product must be unique !'),
]
+ @api.model
+ def create(self, vals):
+ pack_id = self.env.context.get('active_pack_operation', False)
+ if pack_id:
+ pack = self.env['stock.pack.operation'].browse(pack_id)
+ if pack.picking_id and not pack.picking_id.picking_type_id.use_create_lots:
+ raise UserError(_("You are not allowed to create a lot for this picking type"))
+ return super(ProductionLot, self).create(vals)
+
@api.one
@api.depends('quant_ids.qty')
def _product_qty(self):
diff --git a/addons/stock/views/stock_pack_operation_views.xml b/addons/stock/views/stock_pack_operation_views.xml
index 5b6919dab83..cd8469d4672 100644
--- a/addons/stock/views/stock_pack_operation_views.xml
+++ b/addons/stock/views/stock_pack_operation_views.xml
@@ -85,7 +85,7 @@
By sharing you answer, you will get additional karma points if your answer is selected as the right one. See what you can do with karma - here.
+ here.Share this content to increase your chances to be featured on the front page and attract more visitors.
diff --git a/addons/website_forum/views/website_forum.xml b/addons/website_forum/views/website_forum.xml index 74df06b10cb..3608b9b47c7 100644 --- a/addons/website_forum/views/website_forum.xml +++ b/addons/website_forum/views/website_forum.xml @@ -793,9 +793,10 @@