mirror of
https://gitlab.com/flectra-hq/flectra.git
synced 2026-08-19 01:34:43 -05:00
[PATCH] Upstream patch - 18112021
This commit is contained in:
@@ -170,6 +170,18 @@ class AccountPayment(models.Model):
|
||||
|
||||
return liquidity_lines, counterpart_lines, writeoff_lines
|
||||
|
||||
def _prepare_payment_display_name(self):
|
||||
'''
|
||||
Hook method for inherit
|
||||
When you want to set a new name for payment, you can extend this method
|
||||
'''
|
||||
return {
|
||||
'outbound-customer': _("Customer Reimbursement"),
|
||||
'inbound-customer': _("Customer Payment"),
|
||||
'outbound-supplier': _("Vendor Payment"),
|
||||
'inbound-supplier': _("Vendor Reimbursement"),
|
||||
}
|
||||
|
||||
def _prepare_move_line_default_vals(self, write_off_line_vals=None):
|
||||
''' Prepare the dictionary to create the default account.move.lines for the current payment.
|
||||
:param write_off_line_vals: Optional dictionary to create a write-off account.move.line easily containing:
|
||||
@@ -225,12 +237,7 @@ class AccountPayment(models.Model):
|
||||
|
||||
# Compute a default label to set on the journal items.
|
||||
|
||||
payment_display_name = {
|
||||
'outbound-customer': _("Customer Reimbursement"),
|
||||
'inbound-customer': _("Customer Payment"),
|
||||
'outbound-supplier': _("Vendor Payment"),
|
||||
'inbound-supplier': _("Vendor Reimbursement"),
|
||||
}
|
||||
payment_display_name = self._prepare_payment_display_name()
|
||||
|
||||
default_line_name = self.env['account.move.line']._get_default_line_name(
|
||||
_("Internal Transfer") if self.is_internal_transfer else payment_display_name['%s-%s' % (self.payment_type, self.partner_type)],
|
||||
|
||||
@@ -17,15 +17,20 @@ class RecurrenceRule(models.Model):
|
||||
microsoft_id = fields.Char('Microsoft Calendar Recurrence Id')
|
||||
|
||||
def _compute_rrule(self):
|
||||
# Note: 'need_sync_m' is set to False to avoid syncing the updated recurrence with
|
||||
# Outlook, as this update may already come from Outlook. If not, this modification will
|
||||
# be already synced through the calendar.event.write()
|
||||
for recurrence in self:
|
||||
if recurrence.rrule != recurrence._rrule_serialize():
|
||||
recurrence.write({'rrule': recurrence._rrule_serialize()})
|
||||
recurrence.write({'rrule': recurrence._rrule_serialize(), 'need_sync_m': False})
|
||||
|
||||
def _inverse_rrule(self):
|
||||
# Note: 'need_sync_m' is set to False to avoid syncing the updated recurrence with
|
||||
# Outlook, as this update mainly comes from Outlook (the 'rrule' field is not directly
|
||||
# modified in Flectra but computed from other fields).
|
||||
for recurrence in self.filtered('rrule'):
|
||||
values = self._rrule_parse(recurrence.rrule, recurrence.dtstart)
|
||||
# We avoid to trigger patch in the inverse
|
||||
recurrence.write(values)
|
||||
recurrence.write(dict(values, need_sync_m=False))
|
||||
|
||||
def _apply_recurrence(self, specific_values_creation=None, no_send_edit=False):
|
||||
events = self.filtered('need_sync_m').calendar_event_ids
|
||||
|
||||
@@ -9,7 +9,7 @@ class report_product_pricelist(models.AbstractModel):
|
||||
_description = 'Pricelist Report'
|
||||
|
||||
def _get_report_values(self, docids, data):
|
||||
product_ids = [int(i) for i in data['active_ids'].split(',')]
|
||||
product_ids = [int(i) for i in data['active_ids'].split(',')] if data['active_ids'] else False
|
||||
pricelist_id = data['pricelist_id'] and int(data['pricelist_id']) or None
|
||||
quantities = [int(i) for i in data['quantities'].split(',')] or [1]
|
||||
return self._get_report_data(data['active_model'], product_ids, pricelist_id, quantities, 'pdf')
|
||||
|
||||
@@ -242,7 +242,7 @@ var GeneratePriceList = AbstractAction.extend(StandaloneFieldManagerMixin, {
|
||||
_onClickPrint: function () {
|
||||
const reportName = _.str.sprintf('product.report_pricelist?active_model=%s&active_ids=%s&pricelist_id=%s&quantities=%s',
|
||||
this.context.active_model,
|
||||
this.context.active_ids,
|
||||
this.context.active_ids || '',
|
||||
this.context.pricelist_id || '',
|
||||
this.context.quantities.toString() || '1',
|
||||
);
|
||||
|
||||
@@ -148,7 +148,7 @@ class SaleReport(models.Model):
|
||||
if not fields:
|
||||
fields = {}
|
||||
with_ = ("WITH %s" % with_clause) if with_clause else ""
|
||||
return '%s (SELECT %s FROM %s GROUP BY %s)' % \
|
||||
return '%s (SELECT %s FROM %s WHERE l.display_type IS NULL GROUP BY %s)' % \
|
||||
(with_, self._select_sale(fields), self._from_sale(from_clause), self._group_by_sale(groupby))
|
||||
|
||||
def init(self):
|
||||
|
||||
@@ -230,6 +230,11 @@ async function applyModifications(img) {
|
||||
result.width = resizeWidth || croppedImg.width;
|
||||
result.height = croppedImg.height * result.width / croppedImg.width;
|
||||
const ctx = result.getContext('2d');
|
||||
ctx.imageSmoothingQuality = "high";
|
||||
ctx.mozImageSmoothingEnabled = true;
|
||||
ctx.webkitImageSmoothingEnabled = true;
|
||||
ctx.msImageSmoothingEnabled = true;
|
||||
ctx.imageSmoothingEnabled = true;
|
||||
ctx.drawImage(croppedImg, 0, 0, croppedImg.width, croppedImg.height, 0, 0, result.width, result.height);
|
||||
|
||||
// GL filter
|
||||
|
||||
@@ -7,6 +7,7 @@ const Dialog = require('web.Dialog');
|
||||
const {scrollTo} = require('web.dom');
|
||||
const rpc = require('web.rpc');
|
||||
const time = require('web.time');
|
||||
const utils = require('web.utils');
|
||||
var Widget = require('web.Widget');
|
||||
var ColorPaletteWidget = require('web_editor.ColorPalette').ColorPaletteWidget;
|
||||
const weUtils = require('web_editor.utils');
|
||||
@@ -3434,6 +3435,8 @@ const ImageHandlerOption = SnippetOptionWidget.extend({
|
||||
* Controls image width and quality.
|
||||
*/
|
||||
registry.ImageOptimize = ImageHandlerOption.extend({
|
||||
MAX_SUGGESTED_WIDTH: 1920,
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
@@ -3458,20 +3461,36 @@ registry.ImageOptimize = ImageHandlerOption.extend({
|
||||
* @override
|
||||
*/
|
||||
_computeMaxDisplayWidth() {
|
||||
// TODO: read widths from computed style in case container widths are not default
|
||||
const displayWidth = this._getImg().clientWidth;
|
||||
// If the image is in a column, it might get bigger on smaller screens.
|
||||
// We use col-lg for this in snippets, so they get bigger on the md breakpoint
|
||||
if (this.$target.closest('[class*="col-lg"]').length) {
|
||||
// container and o_container_small have maximum inner width of 690px on the md breakpoint
|
||||
if (this.$target.closest('.container, .o_container_small').length) {
|
||||
return Math.min(1920, Math.max(displayWidth, 690));
|
||||
}
|
||||
// A container-fluid's max inner width is 962px on the md breakpoint
|
||||
return Math.min(1920, Math.max(displayWidth, 962));
|
||||
const img = this._getImg();
|
||||
const computedStyles = window.getComputedStyle(img);
|
||||
const displayWidth = parseFloat(computedStyles.getPropertyValue('width'));
|
||||
const gutterWidth = parseFloat(computedStyles.getPropertyValue('--o-grid-gutter-width')) || 30;
|
||||
|
||||
// For the logos we don't want to suggest a width too small.
|
||||
if (this.$target[0].closest('nav')) {
|
||||
return Math.round(Math.min(displayWidth * 3, this.MAX_SUGGESTED_WIDTH));
|
||||
// If the image is in a container(-small), it might get bigger on
|
||||
// smaller screens. So we suggest the width of the current image unless
|
||||
// it is smaller than the size of the container on the md breapoint
|
||||
// (which is where our bootstrap columns fallback to full container
|
||||
// width since we only use col-lg-* in Flectra).
|
||||
} else if (img.closest('.container, .o_container_small')) {
|
||||
const mdContainerMaxWidth = parseFloat(computedStyles.getPropertyValue('--o-md-container-max-width')) || 720;
|
||||
const mdContainerInnerWidth = mdContainerMaxWidth - gutterWidth;
|
||||
return Math.round(utils.confine(displayWidth, mdContainerInnerWidth, this.MAX_SUGGESTED_WIDTH));
|
||||
// If the image is displayed in a container-fluid, it might also get
|
||||
// bigger on smaller screens. The same way, we suggest the width of the
|
||||
// current image unless it is smaller than the max size of the container
|
||||
// on the md breakpoint (which is the LG breakpoint since the container
|
||||
// fluid is full-width).
|
||||
} else if (img.closest('.container-fluid')) {
|
||||
const lgBp = parseFloat(computedStyles.getPropertyValue('--breakpoint-lg')) || 992;
|
||||
const mdContainerFluidMaxInnerWidth = lgBp - gutterWidth;
|
||||
return Math.round(utils.confine(displayWidth, mdContainerFluidMaxInnerWidth, this.MAX_SUGGESTED_WIDTH));
|
||||
}
|
||||
// If it's not in a col-lg, it's probably not going to change size depending on breakpoints
|
||||
return displayWidth;
|
||||
// If it's not in a container, it's probably not going to change size
|
||||
// depending on breakpoints. We still keep a margin safety.
|
||||
return Math.round(Math.min(displayWidth * 1.5, this.MAX_SUGGESTED_WIDTH));
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
|
||||
@@ -62,6 +62,9 @@
|
||||
@include print-variable('o-cc#{$index}-btn-secondary-border', $-btn-secondary or theme-color('secondary'));
|
||||
}
|
||||
}
|
||||
|
||||
@include print-variable('o-grid-gutter-width', $grid-gutter-width);
|
||||
@include print-variable('o-md-container-max-width', map-get($container-max-widths, md));
|
||||
}
|
||||
|
||||
html, body {
|
||||
|
||||
Reference in New Issue
Block a user