[MERGE] forward port branch saas-14 up to 18228f9c4e
This commit is contained in:
@@ -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 = round(amount, self.currency_id.decimal_places) * -1
|
||||
result = round(amount, self.currency_id.decimal_places if self.currency_id else 2) * -1
|
||||
self.amount = result
|
||||
self.general_account_id = account
|
||||
self.product_uom_id = unit
|
||||
|
||||
@@ -143,7 +143,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(default=True)
|
||||
|
||||
@@ -445,6 +445,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)],
|
||||
}
|
||||
|
||||
@@ -865,13 +865,15 @@ class StockMove(models.Model):
|
||||
false_quants += [reserved_quant]
|
||||
elif float_compare(lot_quantities.get(reserved_quant.lot_id.id, 0), 0, precision_rounding=rounding) > 0:
|
||||
if float_compare(lot_quantities[reserved_quant.lot_id.id], reserved_quant.qty, precision_rounding=rounding) >= 0:
|
||||
lot_quantities[reserved_quant.lot_id.id] -= reserved_quant.qty
|
||||
quants_taken += [(reserved_quant, reserved_quant.qty)]
|
||||
qty_on_link -= reserved_quant.qty
|
||||
qty_taken = min(reserved_quant.qty, qty_on_link)
|
||||
lot_quantities[reserved_quant.lot_id.id] -= qty_taken
|
||||
quants_taken += [(reserved_quant, qty_taken)]
|
||||
qty_on_link -= qty_taken
|
||||
else:
|
||||
quants_taken += [(reserved_quant, lot_quantities[reserved_quant.lot_id.id])]
|
||||
lot_quantities[reserved_quant.lot_id.id] = 0
|
||||
qty_on_link -= lot_quantities[reserved_quant.lot_id.id]
|
||||
qty_taken = min(qty_on_link, lot_quantities[reserved_quant.lot_id.id])
|
||||
quants_taken += [(reserved_quant, qty_taken)]
|
||||
lot_quantities[reserved_quant.lot_id.id] -= qty_taken
|
||||
qty_on_link -= qty_taken
|
||||
lot_move_qty[move.id] = qty_on_link
|
||||
|
||||
remaining_move_qty[move.id] -= prout_move_qty[move]
|
||||
|
||||
@@ -241,7 +241,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'),
|
||||
@@ -731,7 +732,7 @@ class Picking(models.Model):
|
||||
flag = quant.package_id == ops.package_id
|
||||
else:
|
||||
flag = not quant.package_id.id
|
||||
flag = flag and (ops.owner_id.id == quant.owner_id.id)
|
||||
flag = flag and (ops.owner_id.id == quant.owner_id.id) and (ops.location_id.id == quant.location_id.id)
|
||||
if flag:
|
||||
if not lot_qty:
|
||||
max_qty_on_link = min(quant.qty, qty_to_assign)
|
||||
|
||||
@@ -615,6 +615,10 @@ data.Class = Widget.extend({
|
||||
var self = this;
|
||||
var zone_template = $("<div class='oe_drop_zone oe_insert'/>");
|
||||
|
||||
function isFullWidth($elem) {
|
||||
return $elem.parent().width() === $elem.outerWidth(true);
|
||||
}
|
||||
|
||||
if ($selector_children) {
|
||||
$selector_children.each(function () {
|
||||
var $zone = $(this);
|
||||
@@ -632,7 +636,10 @@ data.Class = 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();
|
||||
@@ -647,7 +654,10 @@ data.Class = 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'});
|
||||
@@ -668,14 +678,20 @@ data.Class = 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);
|
||||
}
|
||||
@@ -862,6 +878,7 @@ data.Editor = Class.extend({
|
||||
},
|
||||
_drag_and_drop_start: function () {
|
||||
var self = this;
|
||||
this.dropped = false;
|
||||
self.buildingBlock.editor_busy = true;
|
||||
self.size = {
|
||||
width: self.$target.width(),
|
||||
@@ -890,9 +907,18 @@ data.Editor = Class.extend({
|
||||
self._drag_and_drop_after_insert_dropzone();
|
||||
self._drag_and_drop_active_drop_zone($('.oe_drop_zone'));
|
||||
},
|
||||
_drag_and_drop_stop: function () {
|
||||
_drag_and_drop_stop: function (ev, ui) {
|
||||
var self = this;
|
||||
|
||||
// TODO lot of this is duplicated code of the d&d feature of snippets
|
||||
if (!this.dropped) {
|
||||
var $el = $.nearest({x: ui.position.left, y: ui.position.top}, '.oe_drop_zone').first();
|
||||
if ($el.length) {
|
||||
$el.after(this.$target);
|
||||
this.dropped = true;
|
||||
}
|
||||
}
|
||||
|
||||
$(".oe_drop_zone").droppable('destroy').remove();
|
||||
|
||||
var prev = this.$target.first()[0].previousSibling;
|
||||
|
||||
@@ -264,12 +264,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 {
|
||||
|
||||
Reference in New Issue
Block a user