[MERGE] forward port branch saas-15 up to 9773be345e

This commit is contained in:
Christophe Simonis
2019-02-08 16:53:11 +01:00
6 changed files with 36 additions and 9 deletions
@@ -44,7 +44,7 @@ class AccountAnalyticLine(models.Model):
# Compute based on pricetype
amount_unit = self.product_id.price_compute('standard_price', uom=unit)[self.product_id.id]
amount = amount_unit * self.unit_amount or 0.0
result = self.currency_id.round(amount) * -1
result = (self.currency_id.round(amount) if self.currency_id else round(amount, 2)) * -1
self.amount = result
self.general_account_id = account
self.product_uom_id = unit
+1 -1
View File
@@ -14,7 +14,7 @@ class FleetVehicle(models.Model):
def _get_default_state(self):
state = self.env.ref('fleet.vehicle_state_active', raise_if_not_found=False)
return state and state.id or False
return state if state and state.id else False
name = fields.Char(compute="_compute_vehicle_name", store=True)
active = fields.Boolean('Active', default=True, track_visibility="onchange")
+10
View File
@@ -460,6 +460,16 @@ class PurchaseOrder(models.Model):
'currency_id': currency.id,
'delay': 0,
}
# In case the order partner is a contact address, a new supplierinfo is created on
# the parent company. In this case, we keep the product name and code.
seller = line.product_id._select_seller(
partner_id=line.partner_id,
quantity=line.product_qty,
date=line.order_id.date_order and line.order_id.date_order[:10],
uom_id=line.product_uom)
if seller:
supplierinfo['product_name'] = seller.product_name
supplierinfo['product_code'] = seller.product_code
vals = {
'seller_ids': [(0, 0, supplierinfo)],
}
+2 -1
View File
@@ -245,7 +245,8 @@ class Picking(models.Model):
picking_type_id = fields.Many2one(
'stock.picking.type', 'Operation Type',
required=True,
states={'done': [('readonly', True)], 'cancel': [('readonly', True)]})
readonly=True,
states={'draft': [('readonly', False)]})
picking_type_code = fields.Selection([
('incoming', 'Vendors'),
('outgoing', 'Customers'),
@@ -652,6 +652,10 @@ var SnippetsMenu = Widget.extend({
class: 'oe_drop_zone oe_insert',
});
function isFullWidth($elem) {
return $elem.parent().width() === $elem.outerWidth(true);
}
if ($selectorChildren) {
$selectorChildren.each(function () {
var $zone = $(this);
@@ -669,7 +673,10 @@ var SnippetsMenu = Widget.extend({
display: 'inline-block',
});
} else if (float === 'left' || float === 'right') {
$drop.addClass('oe_vertical').css('height', Math.max(Math.min($zone.outerHeight(), $zone.children().last().outerHeight()), 30));
$drop.css('float', float);
if (!isFullWidth($zone)) {
$drop.addClass('oe_vertical').css('height', Math.max(Math.min($zone.outerHeight(), $zone.children().last().outerHeight()), 30));
}
}
$drop = $drop.clone();
@@ -684,7 +691,10 @@ var SnippetsMenu = Widget.extend({
display: 'inline-block'
});
} else if (float === 'left' || float === 'right') {
$drop.addClass('oe_vertical').css('height', Math.max(Math.min($zone.outerHeight(), $zone.children().first().outerHeight()), 30));
$drop.css('float', float);
if (!isFullWidth($zone)) {
$drop.addClass('oe_vertical').css('height', Math.max(Math.min($zone.outerHeight(), $zone.children().first().outerHeight()), 30));
}
}
if (test) {
$drop.css({'float': 'none', 'display': 'inline-block'});
@@ -705,14 +715,20 @@ var SnippetsMenu = Widget.extend({
if ($zone.prev('.oe_drop_zone:visible').length === 0) {
$drop = zone_template.clone();
if (float === 'left' || float === 'right') {
$drop.addClass('oe_vertical').css('height', Math.max(Math.min($zone.outerHeight(), $zone.prev().outerHeight() || Infinity), 30));
$drop.css('float', float);
if (!isFullWidth($zone)) {
$drop.addClass('oe_vertical').css('height', Math.max(Math.min($zone.outerHeight(), $zone.prev().outerHeight() || Infinity), 30));
}
}
$zone.before($drop);
}
if ($zone.next('.oe_drop_zone:visible').length === 0) {
$drop = zone_template.clone();
if (float === 'left' || float === 'right') {
$drop.addClass('oe_vertical').css('height', Math.max(Math.min($zone.outerHeight(), $zone.next().outerHeight() || Infinity), 30));
$drop.css('float', float);
if (!isFullWidth($zone)) {
$drop.addClass('oe_vertical').css('height', Math.max(Math.min($zone.outerHeight(), $zone.next().outerHeight() || Infinity), 30));
}
}
$zone.after($drop);
}
@@ -279,12 +279,12 @@ html[lang] > body.editor_enable [data-oe-translation-state] {
}
&.oe_vertical {
border: 2px dashed @odoo-brand-primary;
border: @odoo-dropzone-border;
border-left: none;
border-right: none;
width: @odoo-dropzone-size;
float: left;
height: 100%;
margin: 0 -@odoo-dropzone-size/2;
&:after {