[PATCH] Upstream patch - 28092021

This commit is contained in:
Parthiv Patel
2021-09-28 09:36:03 +00:00
parent 4fd0f3f660
commit be4d40e5dc
9 changed files with 43 additions and 26 deletions
+1 -1
View File
@@ -91,7 +91,7 @@
<field name="name">account.move.line.kanban</field>
<field name="model">account.move.line</field>
<field name="arch" type="xml">
<kanban class="o_kanban_mobile">
<kanban class="o_kanban_mobile" create="false">
<field name="date_maturity"/>
<field name="move_id"/>
<field name="name"/>
+3 -3
View File
@@ -58,7 +58,7 @@ class AccountMove(models.Model):
res = super()._get_tax_grouping_key_from_tax_line(tax_line)
if tax_line.move_id.journal_id.company_id.country_id.code == 'IN':
res['product_id'] = tax_line.product_id.id
res['product_uom_id'] = tax_line.product_uom_id
res['product_uom_id'] = tax_line.product_uom_id.id
return res
@api.model
@@ -67,7 +67,7 @@ class AccountMove(models.Model):
res = super()._get_tax_grouping_key_from_base_line(base_line, tax_vals)
if base_line.move_id.journal_id.company_id.country_id.code == 'IN':
res['product_id'] = base_line.product_id.id
res['product_uom_id'] = base_line.product_uom_id
res['product_uom_id'] = base_line.product_uom_id.id
return res
@api.model
@@ -77,7 +77,7 @@ class AccountMove(models.Model):
tax_key += [
line.product_id.id,
line.product_uom_id,
line.product_uom_id.id,
]
return tax_key
+3 -3
View File
@@ -68,12 +68,12 @@ class LinkTracker(models.Model):
@api.depends('code')
def _compute_short_url(self):
for tracker in self:
base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
tracker.short_url = urls.url_join(base_url, '/r/%(code)s' % {'code': tracker.code})
tracker.short_url = urls.url_join(tracker.short_url_host, '%(code)s' % {'code': tracker.code})
def _compute_short_url_host(self):
for tracker in self:
tracker.short_url_host = self.env['ir.config_parameter'].sudo().get_param('web.base.url') + '/r/'
base_url = tracker.get_base_url()
tracker.short_url_host = urls.url_join(base_url, '/r/')
def _compute_code(self):
for tracker in self:
@@ -3,6 +3,7 @@
from datetime import datetime as dt
from datetime import timedelta as td
from freezegun import freeze_time
from flectra import SUPERUSER_ID
from flectra.tests import Form
@@ -10,6 +11,7 @@ from flectra.tests.common import SavepointCase
from flectra.exceptions import UserError
@freeze_time("2021-01-14 09:12:15")
class TestReorderingRule(SavepointCase):
@classmethod
def setUpClass(cls):
@@ -171,12 +171,13 @@ class TestSaleStockMargin(TestStockValuationCommon):
company_currency = self.env.company.currency_id
other_currency = self.env.ref('base.EUR') if company_currency == self.env.ref('base.USD') else self.env.ref('base.USD')
ResCurrencyRate.create({'currency_id': company_currency.id, 'rate': 1})
other_currency_rate = ResCurrencyRate.search([('name', '=', fields.Date.today()), ('currency_id', '=', other_currency.id)])
date = fields.Date.today()
ResCurrencyRate.create({'currency_id': company_currency.id, 'rate': 1, 'name': date})
other_currency_rate = ResCurrencyRate.search([('name', '=', date), ('currency_id', '=', other_currency.id)])
if other_currency_rate:
other_currency_rate.rate = 2
else:
ResCurrencyRate.create({'currency_id': other_currency.id, 'rate': 2})
ResCurrencyRate.create({'currency_id': other_currency.id, 'rate': 2, 'name': date})
so = self._create_sale_order()
so.pricelist_id = self.env['product.pricelist'].create({
+3 -3
View File
@@ -255,7 +255,7 @@ publicWidget.registry.StandardAffixedHeader = BaseAnimatedHeader.extend({
});
publicWidget.registry.FixedHeader = BaseAnimatedHeader.extend({
selector: 'header.o_header_fixed',
selector: 'header.o_header_fixed:not(.o_header_sidebar)',
//--------------------------------------------------------------------------
// Handlers
@@ -367,7 +367,7 @@ const BaseDisappearingHeader = publicWidget.registry.FixedHeader.extend({
});
publicWidget.registry.DisappearingHeader = BaseDisappearingHeader.extend({
selector: 'header.o_header_disappears',
selector: 'header.o_header_disappears:not(.o_header_sidebar)',
//--------------------------------------------------------------------------
// Private
@@ -390,7 +390,7 @@ publicWidget.registry.DisappearingHeader = BaseDisappearingHeader.extend({
});
publicWidget.registry.FadeOutHeader = BaseDisappearingHeader.extend({
selector: 'header.o_header_fade_out',
selector: 'header.o_header_fade_out:not(.o_header_sidebar)',
//--------------------------------------------------------------------------
// Private
@@ -15,7 +15,7 @@ publicWidget.registry.crmPartnerAssign = publicWidget.Widget.extend({
'click .new_opp_confirm': '_onNewOppConfirm',
'click .edit_opp_confirm': '_onEditOppConfirm',
'change .edit_opp_form .next_activity': '_onChangeNextActivity',
'click div.input-group span.fa-calendar': '_onCalendarIconClick',
'click div.input-group.date[data-target-input="nearest"]': '_onCalendarInputGroupClick',
},
//--------------------------------------------------------------------------
@@ -227,9 +227,7 @@ publicWidget.registry.crmPartnerAssign = publicWidget.Widget.extend({
_onEditOppConfirm: function (ev) {
ev.preventDefault();
ev.stopPropagation();
if ($(".edit_opp_form")[0].checkValidity()) {
this._buttonExec($(ev.currentTarget), this._editOpportunity);
}
this._buttonExec($(ev.currentTarget), this._editOpportunity);
},
/**
* @private
@@ -250,8 +248,9 @@ publicWidget.registry.crmPartnerAssign = publicWidget.Widget.extend({
* @private
* @param {Event} ev
*/
_onCalendarIconClick: function (ev) {
$(ev.currentTarget).closest('div.date').datetimepicker({
_onCalendarInputGroupClick: function (ev) {
const $calendarInputGroup = $(ev.currentTarget);
const calendarOptions = {
format : time.getLangDateFormat(),
icons: {
time: 'fa fa-clock-o',
@@ -259,13 +258,20 @@ publicWidget.registry.crmPartnerAssign = publicWidget.Widget.extend({
up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down',
},
});
};
// in some screen sizes, the automatic position opens the picker below input,
// but because #next_activity_div is the last element, we always open the
// picker on top the input to prevent extra scroll
if ($calendarInputGroup.is('#next_activity_div')) {
calendarOptions.widgetPositioning = {vertical: 'top'};
}
$calendarInputGroup.datetimepicker(calendarOptions);
},
_parse_date: function (value) {
console.log(value);
var date = moment(value, "YYYY-MM-DD", true);
if (date.isValid()) {
var date = moment(value, time.getLangDateFormat(), true);
if (date.isValid() && date.year() >= 1900) {
return time.date_to_str(date.toDate());
}
else {
@@ -654,7 +654,7 @@
</div>
<div class="form-group">
<div class="row">
<div class="col-md-6">
<div class="col-md-5">
<label>Priority:</label>
<div class="input-group">
<label class="radio-inline">
@@ -678,11 +678,11 @@
</label>
</div>
</div>
<div class="col-md-6">
<div class="col-md-7">
<label>Expected Closing:</label>
<div class="input-group date" id="exp_closing_div" data-target-input="nearest">
<t t-set='date_formatted'><t t-options='{"widget": "date"}' t-esc="opportunity.date_deadline"/></t>
<input type="date" min="1900-01-01" name="date_deadline" t-att-value="date_formatted" class="datetimepicker-input form-control date_deadline" data-date-format="YYYY-MM-DD" t-att-name="prefix" placeholder="YYYY-MM-DD"/>
<input type="text" name="date_deadline" data-target="#exp_closing_div" t-att-value="date_formatted" class="datetimepicker-input form-control date_deadline" t-att-name="prefix"/>
<div class="input-group-append" data-target="#exp_closing_div" data-toggle="datetimepicker">
<span class="input-group-text">
<span class="fa fa-calendar" role="img" aria-label="Calendar"></span>
@@ -708,7 +708,7 @@
<label class="col-form-label" for="activity_date_deadline">Next Activity Date</label>
<div class="input-group date" id="next_activity_div" data-target-input="nearest">
<t t-set='date_formatted'><t t-options='{"widget": "date"}' t-esc="user_activity.date_deadline"/></t>
<input type="date" min="1900-01-01" name="activity_date_deadline" t-att-value="date_formatted" class="form-control activity_date_deadline datetimepicker-input" data-date-format="YYYY-MM-DD" t-att-name="prefix" placeholder="YYYY-MM-DD"/>
<input type="text" name="activity_date_deadline" data-target="#next_activity_div" t-att-value="date_formatted" class="form-control activity_date_deadline datetimepicker-input" t-att-name="prefix"/>
<div class="input-group-append" data-target="#next_activity_div" data-toggle="datetimepicker">
<span class="input-group-text">
<span class="fa fa-calendar" role="img" aria-label="Calendar" title="Calendar"></span>
@@ -3,6 +3,9 @@
from flectra import models, _
from werkzeug import urls
class LinkTracker(models.Model):
_inherit = ['link.tracker']
@@ -13,3 +16,8 @@ class LinkTracker(models.Model):
'url': '%s+' % (self.short_url),
'target': 'new',
}
def _compute_short_url_host(self):
for tracker in self:
base_url = self.env['website'].get_current_website().get_base_url()
tracker.short_url_host = urls.url_join(base_url, '/r/')