diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py
index 106a453588a..c90ac295e02 100644
--- a/addons/account/models/account_bank_statement.py
+++ b/addons/account/models/account_bank_statement.py
@@ -419,12 +419,11 @@ class AccountBankStatementLine(models.Model):
@api.multi
def button_cancel_reconciliation(self):
- moves_to_unbind = self.env['account.move']
moves_to_cancel = self.env['account.move']
payment_to_unreconcile = self.env['account.payment']
payment_to_cancel = self.env['account.payment']
for st_line in self:
- moves_to_unbind |= st_line.journal_entry_ids
+ moves_to_unbind = st_line.journal_entry_ids
for move in st_line.journal_entry_ids:
for line in move.line_ids:
payment_to_unreconcile |= line.payment_id
@@ -432,13 +431,15 @@ class AccountBankStatementLine(models.Model):
#there can be several moves linked to a statement line but maximum one created by the line itself
moves_to_cancel |= st_line.journal_entry_ids
payment_to_cancel |= line.payment_id
- moves_to_unbind = moves_to_unbind - moves_to_cancel
- payment_to_unreconcile = payment_to_unreconcile - payment_to_cancel
- if moves_to_unbind:
- moves_to_unbind.write({'statement_line_id': False})
- for move in moves_to_unbind:
- move.line_ids.filtered(lambda x:x.statement_id == st_line.statement_id).write({'statement_id': False})
+ moves_to_unbind = moves_to_unbind - moves_to_cancel
+
+ if moves_to_unbind:
+ moves_to_unbind.write({'statement_line_id': False})
+ for move in moves_to_unbind:
+ move.line_ids.filtered(lambda x: x.statement_id == st_line.statement_id).write({'statement_id': False})
+
+ payment_to_unreconcile = payment_to_unreconcile - payment_to_cancel
if payment_to_unreconcile:
payment_to_unreconcile.unreconcile()
diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py
index e950a4cac68..17133cdd2fa 100644
--- a/addons/hr_payroll/hr_payroll.py
+++ b/addons/hr_payroll/hr_payroll.py
@@ -456,7 +456,9 @@ class hr_payslip(osv.osv):
def _sum_salary_rule_category(localdict, category, amount):
if category.parent_id:
localdict = _sum_salary_rule_category(localdict, category.parent_id, amount)
- localdict['categories'].dict[category.code] = category.code in localdict['categories'].dict and localdict['categories'].dict[category.code] + amount or amount
+ if category.code in localdict['categories'].dict:
+ amount += localdict['categories'].dict[category.code]
+ localdict['categories'].dict[category.code] = amount
return localdict
class BrowsableObject(object):
diff --git a/addons/l10n_sa/account.chart.template.xml b/addons/l10n_sa/account.chart.template.xml
index d90eaa1779f..201004a9f8c 100644
--- a/addons/l10n_sa/account.chart.template.xml
+++ b/addons/l10n_sa/account.chart.template.xml
@@ -13,7 +13,7 @@
1
1
6
-
+
diff --git a/addons/link_tracker/models/link_tracker.py b/addons/link_tracker/models/link_tracker.py
index 4de629fc517..dd8432f3306 100644
--- a/addons/link_tracker/models/link_tracker.py
+++ b/addons/link_tracker/models/link_tracker.py
@@ -8,7 +8,7 @@ from lxml import html
from urllib2 import urlopen
from urlparse import urljoin
from urlparse import urlparse
-from werkzeug import url_encode
+from werkzeug import url_encode, unescape
from openerp import models, fields, api, _
from openerp.tools import ustr
@@ -54,7 +54,7 @@ class link_tracker(models.Model):
href = match[0]
long_url = match[1]
- vals['url'] = long_url
+ vals['url'] = unescape(long_url)
if not blacklist or not [s for s in blacklist if s in long_url] and not long_url.startswith(short_schema):
link = self.create(vals)
diff --git a/addons/point_of_sale/static/src/img/scroll-down.png b/addons/point_of_sale/static/src/img/scroll-down.png
new file mode 100644
index 00000000000..5fd07589157
Binary files /dev/null and b/addons/point_of_sale/static/src/img/scroll-down.png differ
diff --git a/addons/point_of_sale/static/src/img/scroll-up.png b/addons/point_of_sale/static/src/img/scroll-up.png
new file mode 100644
index 00000000000..b34a90014a2
Binary files /dev/null and b/addons/point_of_sale/static/src/img/scroll-up.png differ
diff --git a/addons/product_visible_discount/models/sale_order.py b/addons/product_visible_discount/models/sale_order.py
index 0035a64419f..ca4c5831fa4 100644
--- a/addons/product_visible_discount/models/sale_order.py
+++ b/addons/product_visible_discount/models/sale_order.py
@@ -17,14 +17,19 @@ class SaleOrderLine(models.Model):
PricelistItem = self.env['product.pricelist.item']
field_name = 'lst_price'
currency_id = None
+ product_currency = None
rule_id = pricelist_dict[pricelist_id][1] if pricelist_dict.get(pricelist_id) else False
if rule_id:
pricelist_item = PricelistItem.browse(rule_id)
if pricelist_item.base == 'standard_price':
field_name = 'standard_price'
+ if pricelist_item.base == 'pricelist' and pricelist_item.base_pricelist_id:
+ field_name = 'price'
+ product = product.with_context(pricelist=pricelist_item.base_pricelist_id.id)
+ product_currency = pricelist_item.base_pricelist_id.currency_id
currency_id = pricelist_item.pricelist_id.currency_id
- product_currency = (product.company_id and product.company_id.currency_id) or self.env.user.company_id.currency_id
+ product_currency = product_currency or (product.company_id and product.company_id.currency_id) or self.env.user.company_id.currency_id
if not currency_id:
currency_id = product_currency
cur_factor = 1.0
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index 2e9ce1d4d8d..210e0ff3ede 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -641,7 +641,7 @@ class PurchaseOrderLine(models.Model):
diff_quantity = line.product_qty
for procurement in line.procurement_ids:
procurement_qty = procurement.product_uom._compute_qty_obj(procurement.product_uom, procurement.product_qty, line.product_uom)
- if float_compare(diff_quantity, 0.0, precision_rounding=line.product_uom.rounding) > 0:
+ if float_compare(procurement_qty, 0.0, precision_rounding=procurement.product_uom.rounding) > 0 and float_compare(diff_quantity, 0.0, precision_rounding=line.product_uom.rounding) > 0:
tmp = template.copy()
tmp.update({
'product_uom_qty': min(procurement_qty, diff_quantity),
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index bbbfd29b658..9300ad41f9f 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -1011,7 +1011,7 @@ class ProductTemplate(models.Model):
def action_view_sales(self):
self.ensure_one()
action = self.env.ref('sale.action_product_sale_list')
- product_ids = self.product_variant_ids.ids
+ product_ids = self.with_context(active_test=False).product_variant_ids.ids
return {
'name': action.name,
diff --git a/addons/sale_margin/__init__.py b/addons/sale_margin/__init__.py
index a5f67aebd79..d1b51ace91d 100644
--- a/addons/sale_margin/__init__.py
+++ b/addons/sale_margin/__init__.py
@@ -1,5 +1,20 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-import models
-import report
+from functools import partial
+import openerp
+from openerp import api, SUPERUSER_ID
+
+import models # noqa
+import report # noqa
+
+
+def uninstall_hook(cr, registry):
+ def recreate_view(dbname):
+ db_registry = openerp.modules.registry.RegistryManager.new(dbname)
+ with api.Environment.manage(), db_registry.cursor() as cr:
+ env = api.Environment(cr, SUPERUSER_ID, {})
+ if 'sale.report' in env:
+ env['sale.report'].init()
+
+ cr.after("commit", partial(recreate_view, cr.dbname))
diff --git a/addons/sale_margin/__openerp__.py b/addons/sale_margin/__openerp__.py
index 5d86da377ac..2e901ec0f74 100644
--- a/addons/sale_margin/__openerp__.py
+++ b/addons/sale_margin/__openerp__.py
@@ -15,4 +15,5 @@ Price and Cost Price.
'depends':['sale'],
'demo':['data/sale_margin_demo.xml'],
'data':['security/ir.model.access.csv','views/sale_margin_view.xml'],
+ 'uninstall_hook': "uninstall_hook",
}
diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py
index 93e5e15dd67..0665f7d0d2a 100644
--- a/addons/website_sale/controllers/main.py
+++ b/addons/website_sale/controllers/main.py
@@ -581,7 +581,6 @@ class WebsiteSale(http.Controller):
partner = Partner.sudo().create(billing_info)
order.write({'partner_id': partner.id})
order.onchange_partner_id()
- order.write({'partner_invoice_id': partner.id})
# create a new shipping partner
if checkout.get('shipping_id') == -1:
@@ -590,11 +589,10 @@ class WebsiteSale(http.Controller):
shipping_info['lang'] = partner_lang
shipping_info['parent_id'] = partner.id
checkout['shipping_id'] = Partner.sudo().create(shipping_info).id
- if checkout.get('shipping_id'):
- order.write({'partner_shipping_id': checkout['shipping_id']})
order_info = {
'message_partner_ids': [(4, partner.id), (3, request.website.partner_id.id)],
+ 'partner_shipping_id': checkout.get('shipping_id') or partner.id,
}
order.write(order_info)
@@ -630,9 +628,6 @@ class WebsiteSale(http.Controller):
self.checkout_form_save(values["checkout"])
- if not int(post.get('shipping_id', 0)):
- order.partner_shipping_id = order.partner_invoice_id
-
order.onchange_partner_shipping_id()
order.order_line._compute_tax_id()
diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py
index 89590dda2cd..309ed6e38f6 100644
--- a/openerp/addons/base/ir/ir_model.py
+++ b/openerp/addons/base/ir/ir_model.py
@@ -673,8 +673,6 @@ class IrModelRelation(models.Model):
self._cr.execute('DROP TABLE %s CASCADE' % table,)
_logger.info('Dropped table %s', table)
- self._cr.commit()
-
class IrModelAccess(models.Model):
_name = 'ir.model.access'
@@ -1206,7 +1204,6 @@ class IrModelData(models.Model):
unlink_if_refcount(item for item in to_unlink if item[0] == 'ir.model')
- self._cr.commit()
datas.unlink()
diff --git a/openerp/fields.py b/openerp/fields.py
index 613dc39b2a9..b07a125f02b 100644
--- a/openerp/fields.py
+++ b/openerp/fields.py
@@ -1170,13 +1170,14 @@ class Monetary(Field):
_column_currency_field = property(attrgetter('currency_field'))
_column_group_operator = property(attrgetter('group_operator'))
- def _setup_regular_base(self, model):
- super(Monetary, self)._setup_regular_base(model)
- if not self.currency_field:
- self.currency_field = 'currency_id'
-
def _setup_regular_full(self, model):
super(Monetary, self)._setup_regular_full(model)
+ if not self.currency_field:
+ # pick a default, trying in order: 'currency_id', 'x_currency_id'
+ if 'currency_id' in model._fields:
+ self.currency_field = 'currency_id'
+ elif 'x_currency_id' in model._fields:
+ self.currency_field = 'x_currency_id'
assert self.currency_field in model._fields, \
"Field %s with unknown currency_field %r" % (self, self.currency_field)