summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-06-12 18:18:05 +0200
committerChristophe Simonis <chs@odoo.com>2017-06-12 18:18:05 +0200
commit6ceecffcad6bd0c8c2d73f44e8d6fdb4e520990b (patch)
tree0882ca6662dcfd1ca5abd51fbf68b365891d3faa /addons
parent1d7260cbcbf3af07c041f1b065f9a4139a724ca7 (diff)
parentd9d455bea3bd67059ebae043e723a219b4c350c9 (diff)
[MERGE] forward port branch 9.0 up to d9d455bea3b
Diffstat (limited to 'addons')
-rw-r--r--addons/auth_oauth/res_config.py4
-rw-r--r--addons/base_geolocalize/models/res_partner.py2
-rw-r--r--addons/point_of_sale/models/pos_order.py4
-rw-r--r--addons/purchase/purchase.py5
-rw-r--r--addons/sale_margin/report/sale_report.py2
-rw-r--r--addons/web/static/src/js/views/form_view.js3
-rw-r--r--addons/web_kanban/static/src/js/kanban_view.js7
7 files changed, 17 insertions, 10 deletions
diff --git a/addons/auth_oauth/res_config.py b/addons/auth_oauth/res_config.py
index c7f14ba6199..dc0ca6562ca 100644
--- a/addons/auth_oauth/res_config.py
+++ b/addons/auth_oauth/res_config.py
@@ -31,8 +31,8 @@ class base_config_settings(osv.TransientModel):
google_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'auth_oauth', 'provider_google')[1]
rg = self.pool.get('auth.oauth.provider').read(cr, uid, [google_id], ['enabled','client_id'], context=context)
return {
- 'auth_oauth_google_enabled': rg[0]['enabled'],
- 'auth_oauth_google_client_id': rg[0]['client_id'],
+ 'auth_oauth_google_enabled': rg[0]['enabled'] if rg else False,
+ 'auth_oauth_google_client_id': rg[0]['client_id'] if rg else False,
'server_uri_google': self.get_uri(cr, uid, context)
}
diff --git a/addons/base_geolocalize/models/res_partner.py b/addons/base_geolocalize/models/res_partner.py
index fd607426bf1..e660e42a764 100644
--- a/addons/base_geolocalize/models/res_partner.py
+++ b/addons/base_geolocalize/models/res_partner.py
@@ -8,6 +8,8 @@ from openerp.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/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py
index ae9b6357b98..03e1a082a3f 100644
--- a/addons/point_of_sale/models/pos_order.py
+++ b/addons/point_of_sale/models/pos_order.py
@@ -572,10 +572,10 @@ class PosOrder(models.Model):
'location_id': location_id,
'location_dest_id': destination_id,
}
- pos_qty = any([x.qty > 0 for x in order.lines])
+ pos_qty = any([x.qty > 0 for x in order.lines if x.product_id.type in ['product', 'consu']])
if pos_qty:
order_picking = Picking.create(picking_vals.copy())
- neg_qty = any([x.qty < 0 for x in order.lines])
+ neg_qty = any([x.qty < 0 for x in order.lines if x.product_id.type in ['product', 'consu']])
if neg_qty:
return_vals = picking_vals.copy()
return_vals.update({
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index 5eacd18f0e3..2f78f16478b 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -508,7 +508,10 @@ class PurchaseOrderLine(models.Model):
qty = 0.0
for inv_line in line.invoice_lines:
if inv_line.invoice_id.state not in ['cancel']:
- qty += inv_line.uom_id._compute_qty_obj(inv_line.uom_id, inv_line.quantity, line.product_uom)
+ if inv_line.invoice_id.type == 'in_invoice':
+ qty += inv_line.uom_id._compute_qty_obj(inv_line.uom_id, inv_line.quantity, line.product_uom)
+ elif inv_line.invoice_id.type == 'in_refund':
+ qty -= inv_line.uom_id._compute_qty_obj(inv_line.uom_id, inv_line.quantity, line.product_uom)
line.qty_invoiced = qty
@api.depends('order_id.state', 'move_ids.state')
diff --git a/addons/sale_margin/report/sale_report.py b/addons/sale_margin/report/sale_report.py
index 5bfcaaacf34..f69a0e2c023 100644
--- a/addons/sale_margin/report/sale_report.py
+++ b/addons/sale_margin/report/sale_report.py
@@ -10,4 +10,4 @@ class SaleReport(models.Model):
margin = fields.Float('Margin')
def _select(self):
- return super(SaleReport, self)._select() + ", SUM(l.margin) AS margin"
+ return super(SaleReport, self)._select() + ", SUM(l.margin / COALESCE(cr.rate, 1.0)) AS margin"
diff --git a/addons/web/static/src/js/views/form_view.js b/addons/web/static/src/js/views/form_view.js
index 7daed3d945d..4ed0a0931be 100644
--- a/addons/web/static/src/js/views/form_view.js
+++ b/addons/web/static/src/js/views/form_view.js
@@ -166,9 +166,10 @@ var FormView = View.extend(common.FieldManagerMixin, {
if (this.fields_view.toolbar) {
this.sidebar.add_toolbar(this.fields_view.toolbar);
}
+ var canDuplicate = this.is_action_enabled('create') && this.is_action_enabled('duplicate');
this.sidebar.add_items('other', _.compact([
this.is_action_enabled('delete') && { label: _t('Delete'), callback: this.on_button_delete },
- this.is_action_enabled('create') && { label: _t('Duplicate'), callback: this.on_button_duplicate }
+ canDuplicate && { label: _t('Duplicate'), callback: this.on_button_duplicate }
]));
this.sidebar.appendTo($node);
diff --git a/addons/web_kanban/static/src/js/kanban_view.js b/addons/web_kanban/static/src/js/kanban_view.js
index 29e3370161a..d8ff213c18b 100644
--- a/addons/web_kanban/static/src/js/kanban_view.js
+++ b/addons/web_kanban/static/src/js/kanban_view.js
@@ -712,14 +712,15 @@ var KanbanView = View.extend({
add_new_column: function (event) {
var self = this;
var model = new Model(this.relation, this.search_context);
- model.call('create', [{name: event.data.value}], {
+ var name = event.data.value;
+ model.call('name_create', [name], {
context: this.search_context,
- }).then(function (id) {
+ }).then(function (result) {
var dataset = new data.DataSetSearch(self, self.model, self.dataset.get_context(), []);
var group_data = {
records: [],
title: event.data.value,
- id: id,
+ id: result[0],
attributes: {folded: false},
dataset: dataset,
values: {},