mirror of
https://gitlab.com/flectra-hq/flectra.git
synced 2026-11-02 20:30:20 -06:00
[PATCH] Upstream patch - 16112021
This commit is contained in:
1 parent
74d2cc8fbe
commit
344e4edde1
10 files changed
+77
-20
No files matched your search
@@ -300,7 +300,7 @@ class HolidaysAllocation(models.Model):
|
||||
def _compute_can_approve(self):
|
||||
for allocation in self:
|
||||
try:
|
||||
if allocation.state == 'confirm' and allocation.validation_type == 'both':
|
||||
if allocation.state == 'confirm' and allocation.holiday_status_id.allocation_type == "fixed_allocation" and allocation.validation_type == 'both':
|
||||
allocation._check_approval_update('validate1')
|
||||
else:
|
||||
allocation._check_approval_update('validate')
|
||||
|
||||
@@ -271,7 +271,9 @@
|
||||
<field name="show_details_visible" invisible="1"/>
|
||||
<field name="lot_ids" widget="many2many_tags"
|
||||
groups="stock.group_production_lot" optional="hide"
|
||||
attrs="{'invisible': ['|', '|', ('show_details_visible', '=', False), ('has_tracking', '!=', 'serial'), ('parent.state', '=', 'draft')], 'column_invisible': [('parent.show_lot_ids', '=', False)]}"
|
||||
attrs="{'invisible': ['|', '|', ('show_details_visible', '=', False), ('has_tracking', '!=', 'serial'), ('parent.state', '=', 'draft')],
|
||||
'readonly': ['|', '|', ('show_details_visible', '=', False), ('has_tracking', '!=', 'serial'), ('parent.state', '=', 'draft')],
|
||||
'column_invisible': [('parent.show_lot_ids', '=', False)]}"
|
||||
options="{'create': [('parent.use_create_components_lots', '!=', False)]}"
|
||||
context="{'default_company_id': company_id, 'default_product_id': product_id}"
|
||||
domain="[('product_id','=',product_id)]"
|
||||
|
||||
@@ -1089,6 +1089,8 @@ class Picking(models.Model):
|
||||
moves_to_backorder.mapped('package_level_id').write({'picking_id':backorder_picking.id})
|
||||
moves_to_backorder.mapped('move_line_ids').write({'picking_id': backorder_picking.id})
|
||||
backorders |= backorder_picking
|
||||
if backorders:
|
||||
backorders.action_assign()
|
||||
return backorders
|
||||
|
||||
def _log_activity_get_documents(self, orig_obj_changes, stream_field, stream, sorted_method=False, groupby_method=False):
|
||||
|
||||
@@ -122,7 +122,7 @@ class TestPickShip(TestStockCommon):
|
||||
picking_client._action_done() # no new in order to create backorder
|
||||
|
||||
backorder = self.env['stock.picking'].search([('backorder_id', '=', picking_client.id)])
|
||||
self.assertEqual(backorder.state, 'waiting', 'Backorder should be waiting for reservation')
|
||||
self.assertEqual(backorder.state, 'assigned', 'Backorder should be started')
|
||||
|
||||
def test_mto_moves_transfer(self):
|
||||
"""
|
||||
@@ -293,7 +293,7 @@ class TestPickShip(TestStockCommon):
|
||||
# create a backorder
|
||||
picking_pick._action_done()
|
||||
picking_pick_backorder = self.env['stock.picking'].search([('backorder_id', '=', picking_pick.id)])
|
||||
self.assertEqual(picking_pick_backorder.state, 'confirmed')
|
||||
self.assertEqual(picking_pick_backorder.state, 'assigned')
|
||||
self.assertEqual(picking_pick_backorder.move_lines.product_qty, 5.0)
|
||||
|
||||
self.assertEqual(picking_client.state, 'assigned')
|
||||
@@ -773,11 +773,8 @@ class TestSinglePicking(TestStockCommon):
|
||||
delivery_order.move_lines[0].move_line_ids[0].qty_done = 1
|
||||
delivery_order._action_done()
|
||||
self.assertNotEqual(delivery_order.date_done, False)
|
||||
self.assertEqual(self.env['stock.quant']._get_available_quantity(self.productA, pack_location), 1.0)
|
||||
|
||||
backorder = self.env['stock.picking'].search([('backorder_id', '=', delivery_order.id)])
|
||||
self.assertEqual(backorder.state, 'confirmed')
|
||||
backorder.action_assign()
|
||||
self.assertEqual(backorder.state, 'assigned')
|
||||
self.assertEqual(self.env['stock.quant']._get_available_quantity(self.productA, pack_location), 0.0)
|
||||
|
||||
|
||||
@@ -2047,6 +2047,9 @@ var SnippetsMenu = Widget.extend({
|
||||
return dragSnip;
|
||||
},
|
||||
start: function () {
|
||||
const prom = new Promise(resolve => dragAndDropResolve = () => resolve());
|
||||
self._mutex.exec(() => prom);
|
||||
|
||||
self.$el.find('.oe_snippet_thumbnail').addClass('o_we_already_dragging');
|
||||
|
||||
dropped = false;
|
||||
@@ -2112,9 +2115,6 @@ var SnippetsMenu = Widget.extend({
|
||||
self.draggableComponent.$scrollTarget.on('scroll.scrolling_element', function () {
|
||||
self.$el.trigger('scroll');
|
||||
});
|
||||
|
||||
const prom = new Promise(resolve => dragAndDropResolve = () => resolve());
|
||||
self._mutex.exec(() => prom);
|
||||
},
|
||||
stop: async function (ev, ui) {
|
||||
$toInsert.removeClass('oe_snippet_body');
|
||||
|
||||
@@ -682,6 +682,18 @@ registry.backgroundVideo = publicWidget.Widget.extend({
|
||||
|
||||
$(window).on('resize.' + this.iframeID, throttledUpdate);
|
||||
|
||||
const $modal = this.$target.closest('.modal');
|
||||
if ($modal.length) {
|
||||
$modal.on('show.bs.modal', () => {
|
||||
const videoContainerEl = this.$target[0].querySelector('.o_bg_video_container');
|
||||
videoContainerEl.classList.add('d-none');
|
||||
});
|
||||
$modal.on('shown.bs.modal', () => {
|
||||
this._adjustIframe();
|
||||
const videoContainerEl = this.$target[0].querySelector('.o_bg_video_container');
|
||||
videoContainerEl.classList.remove('d-none');
|
||||
});
|
||||
}
|
||||
return Promise.all(proms).then(() => this._appendBgVideo());
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -10,6 +10,7 @@ const PopupWidget = publicWidget.Widget.extend({
|
||||
events: {
|
||||
'click .js_close_popup': '_onCloseClick',
|
||||
'hide.bs.modal': '_onHideModal',
|
||||
'show.bs.modal': '_onShowModal',
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -92,6 +93,19 @@ const PopupWidget = publicWidget.Widget.extend({
|
||||
const nbDays = this.$el.find('.modal').data('consentsDuration');
|
||||
utils.set_cookie(this.$el.attr('id'), true, nbDays * 24 * 60 * 60);
|
||||
this._popupAlreadyShown = true;
|
||||
|
||||
this.$target.find('.media_iframe_video iframe').each((i, iframe) => {
|
||||
iframe.src = '';
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_onShowModal() {
|
||||
this.el.querySelectorAll('.media_iframe_video').forEach(media => {
|
||||
const iframe = media.querySelector('iframe');
|
||||
iframe.src = media.dataset.oeExpression || media.dataset.src; // TODO still oeExpression to remove someday
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -17,10 +17,21 @@ options.registry.SnippetPopup = options.Class.extend({
|
||||
});
|
||||
this.$target.on('shown.bs.modal.SnippetPopup', () => {
|
||||
this.trigger_up('snippet_option_visibility_update', {show: true});
|
||||
// TODO duplicated code from the popup public widget, this should
|
||||
// be moved to a *video* public widget and be reviewed in master
|
||||
this.$target[0].querySelectorAll('.media_iframe_video').forEach(media => {
|
||||
const iframe = media.querySelector('iframe');
|
||||
iframe.src = media.dataset.oeExpression || media.dataset.src; // TODO still oeExpression to remove someday
|
||||
});
|
||||
});
|
||||
this.$target.on('hidden.bs.modal.SnippetPopup', () => {
|
||||
this.trigger_up('snippet_option_visibility_update', {show: false});
|
||||
this._removeIframeSrc();
|
||||
});
|
||||
// The video might be playing before entering edit mode (possibly with
|
||||
// sound). Stop the video, as the user can't do it (no button on video
|
||||
// in edit mode).
|
||||
this._removeIframeSrc();
|
||||
return this._super(...arguments);
|
||||
},
|
||||
/**
|
||||
@@ -28,6 +39,9 @@ options.registry.SnippetPopup = options.Class.extend({
|
||||
*/
|
||||
destroy: function () {
|
||||
this._super(...arguments);
|
||||
// The video should not start before the modal opens, remove it from the
|
||||
// DOM. It will be added back on modal open to start the video.
|
||||
this._removeIframeSrc();
|
||||
this.$target.off('.SnippetPopup');
|
||||
},
|
||||
/**
|
||||
@@ -110,5 +124,16 @@ options.registry.SnippetPopup = options.Class.extend({
|
||||
}
|
||||
return this._super(...arguments);
|
||||
},
|
||||
/**
|
||||
* Removes the iframe `src` attribute (a copy of the src is already on the
|
||||
* parent `oe-expression` attribute).
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
_removeIframeSrc() {
|
||||
this.$target.find('.media_iframe_video iframe').each((i, iframe) => {
|
||||
iframe.src = '';
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -10,14 +10,17 @@ const ShareWidget = publicWidget.Widget.extend({
|
||||
* @override
|
||||
*/
|
||||
start: function () {
|
||||
var urlRegex = /(\?(?:|.*&)(?:u|url|body)=)(.*?)(&|#|$)/;
|
||||
var titleRegex = /(\?(?:|.*&)(?:title|text|subject)=)(.*?)(&|#|$)/;
|
||||
var url = encodeURIComponent(window.location.href);
|
||||
var title = encodeURIComponent($('title').text());
|
||||
this.$('a').each(function () {
|
||||
var $a = $(this);
|
||||
$a.attr('href', function (i, href) {
|
||||
return href.replace(urlRegex, function (match, a, b, c) {
|
||||
const urlRegex = /(\?(?:|.*&)(?:u|url|body)=)(.*?)(&|#|$)/;
|
||||
const titleRegex = /(\?(?:|.*&)(?:title|text|subject|description)=)(.*?)(&|#|$)/;
|
||||
const mediaRegex = /(\?(?:|.*&)(?:media)=)(.*?)(&|#|$)/;
|
||||
const url = encodeURIComponent(window.location.href);
|
||||
const title = encodeURIComponent($('title').text());
|
||||
const media = encodeURIComponent($('meta[property="og:image"]').attr('content'));
|
||||
|
||||
this.$('a').each((index, element) => {
|
||||
const $a = $(element);
|
||||
$a.attr('href', (i, href) => {
|
||||
return href.replace(urlRegex, (match, a, b, c) => {
|
||||
return a + url + c;
|
||||
}).replace(titleRegex, function (match, a, b, c) {
|
||||
if ($a.hasClass('s_share_whatsapp')) {
|
||||
@@ -29,6 +32,8 @@ const ShareWidget = publicWidget.Widget.extend({
|
||||
return a + title + url + c;
|
||||
}
|
||||
return a + title + c;
|
||||
}).replace(mediaRegex, (match, a, b, c) => {
|
||||
return a + media + c;
|
||||
});
|
||||
});
|
||||
if ($a.attr('target') && $a.attr('target').match(/_blank/i) && !$a.closest('.o_editable').length) {
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
<a href="https://twitter.com/intent/tweet?text={title}&url={url}" t-attf-class="s_share_twitter #{_link_classes}" target="_blank">
|
||||
<i t-attf-class="fa fa-twitter #{not _link_classes and 'rounded shadow-sm'}"/>
|
||||
</a>
|
||||
<a href="http://www.linkedin.com/sharing/share-offsite/?url={url}" t-attf-class="s_share_linkedin #{_link_classes}" target="_blank">
|
||||
<a href="https://www.linkedin.com/sharing/share-offsite/?url={url}" t-attf-class="s_share_linkedin #{_link_classes}" target="_blank">
|
||||
<i t-attf-class="fa fa-linkedin #{not _link_classes and 'rounded shadow-sm'}"/>
|
||||
</a>
|
||||
<a href="https://wa.me/?text={title}" t-attf-class="s_share_whatsapp #{_link_classes}" target="_blank">
|
||||
<i t-attf-class="fa fa-whatsapp #{not _link_classes and 'rounded shadow-sm'}"/>
|
||||
</a>
|
||||
<a href="http://pinterest.com/pin/create/button/?url={url}&description={title}" t-attf-class="s_share_pinterest #{_link_classes}" target="_blank">
|
||||
<a href="https://pinterest.com/pin/create/button/?url={url}&media={media}&description={title}" t-attf-class="s_share_pinterest #{_link_classes}" target="_blank">
|
||||
<i t-attf-class="fa fa-pinterest #{not _link_classes and 'rounded shadow-sm'}"/>
|
||||
</a>
|
||||
<a href="mailto:?body={url}&subject={title}" t-attf-class="s_share_email #{_link_classes}">
|
||||
|
||||
Reference in new issue
Block a user