- Set your fiscal year end date to 28th February
- Run the P&L a year before a leap year, e.g. anytime between March 1st
and December 31st 2019.
- Select 'Last Financial Year'
The dates are set from 2019-03-01 to 2019-02-28.
There are actually 2 bugs. The one solved here is the following
inconsistency:
```
current_date = type(date)(2019, 4, 3)
date_utils.get_fiscal_year(current_date, day=28, month=2)
'date_from': datetime.date(2019, 3, 1), 'date_to': datetime.date(2020, 2, 28)
current_date = type(date)(2020, 2, 28)
date_utils.get_fiscal_year(current_date, day=28, month=2)
{'date_from': datetime.date(2019, 3, 1), 'date_to': datetime.date(2020, 2, 29)}
```
Both should return `'date_to': datetime.date(2020, 2, 29)`. This implies
that the period is recognized as `custom`, which is affected by the bug
solved in PR https://github.com/odoo/enterprise/pull/4006
opw-1949628
closesodoo/odoo#32366
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
It is now possible to put buttons in the list view group headers.
When the view is grouped by a many2one field, those buttons
appear next to the header title when the group is opened.
The buttons are specified in the views in a <groupby> tag in the
list arch, with the following structure:
<groupby name="groupedField"> <!-- must be a many2one -->
<button type="object" name="my_method" string="Button1"/>
</groupby>
It is also possible to add `field`, inside the `groupby` which can
be used for modifiers. These fields thus belong on the many2one
comodel, like:
<groupby name="partner_id">
<field name="name"/> <!-- name of partner_id -->
<button type="object" name="my_method" string="Button1"
attrs="{'invisible': [('name', '=', 'Georges')]}"/>
</groupby>
These extra fields are fetched in batch when grouping on the field.
Part of task 1915702
When a single po file is processed (i.e. direct po import, not read from a i18n
directory inside a module), there was no module information on code translations
The module information is important for web translations where the list of
modules is given in the call to the route '/website/translations' and
'/web/webclient/translations' and only the web translations of these specific
modules is retrieved and used.
To manually import the translations of a custom module (e.g. openerp_enterprise),
the base.language.import wizard is typically used and the give .po file is
directly imported.
For model and model_terms, the module information is easily deducted from the
the record external id (<module>.<reference>) but for code translation, we
relied on the global variable module_name.
The .po file do contain the module information but this information was ignored.
Real example:
#. module: openerp_enterprise
#. openerp-web
#: code:addons/openerp_enterprise/static/src/js/odoo_enterprise_start_trial.js:249
#, python-format
msgid "Please choose your domain name"
msgstr "Veuillez choisir votre nom de domaine"
Before this commit, the above translation was imported without the module and
was not retrieved in the '/website/translations' call on the /trial page
The global module_name is still used when set for backward compatibility.
Co-authored-by: Raphael Collet <rco@odoo.com>
Complete cd4080839f
<span class="fa fa-globe" title="Title stuff"/>
is not correctly extracted but
<span class="fa fa-globe" title=""/>
was also extracted while there is no content
Check the size of the content too
Similar content is present on odoo.com website and should not be translatable
on Transifex
closesodoo/odoo#32018
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
*: crm, project, maintenance, hr_recruitment
When a record is created from an email, cc can be lost. This commit
proposes a new mixin to keep cc on the record and allows to create
partner for each of them when sending a message from the chatter.
The mixin is added on the mail recors that can be created from mail.alias:
document
helpdesk.ticket
mrp.eco
quality.alert
hr.applicant
crm.lead
project.task
mail.channel
maintenance.equipment
Task: 1925001
Add support for a 256*256 image, to be used in the following commit.
Define sizes in named variables instead of being hard-coded in several places in
the code.
Allow parameters `preserve_aspect_ratio` and `upper_limit` to be passed from
the different helper methods.
Factorize the code inside `image_resize_images` to make it easier to read.
Add new function to compute whether the size of an image is above a given size.
task-34045
PR: #30656
Adding a new rule to verify that precision_rounding is positive.
Before this commit:
when a precision_round was 0 or smaller than 0 the float_utils
functions gave as results:
* float_is_zero(0.0, precision_rounding=0.0) -> False
* float_round(1.25, precision_rounding=0.0) -> 0.0
* float_compare(1.0, 1.0, precision_rounding=0.0) -> 1
These results where at least not correct at worst not logic.
Now, the function raises an error when the precision_rounding
is not positive
The 7d85ab1eac refactor of 'ir.http' introduced changes in `web/image` that
caused the route to no longer return early (to avoid data processing steps)
in the case of redirection and that caused `binary_content` to not set the
mimetype of the `ir.attachment` when it was an URL.
This commit fixes those issues, allowing `web/image` to redirect properly.
closesodoo/odoo#30777
Related to #30326
Before #30326, when calling html_sanitize, some content may be escaped
when it shouldn't. A simple example was images with cid links containing @.
(a first fix for another use case was made in 8aff53733b)
We suspect that this escaping (added in 71a92f46e4)
was made to avoid loosing email with format '<email@domaine>' in html_sanitize
to escape them if html_sanitize is called on plain text.
Anyway, only html should be passed to html_sanitize, and therefore email of format
<email@domain> should already be escaped.
PR #30326 fixes the unwanted behaviour in 12.0 and this commit removes
this logic in master.
closesodoo/odoo#30815
The content id of an attachement can contains a @, therefore
image contained in emails where sometimes escaped by html_sanitize
as if they were emails adresses.
Task: 1915251
closesodoo/odoo#30326
With 12.0's (#28297) empty translations were no longer added by default
with the idea that if needed the "Generate Missing Terms" wizard should
be used.
But that wizard itself used what was modified so also did not added
empty translation.
With this changeset, empty translations are added when using the
"Generate Missing Terms" wizard.
fixes#29184closes#30037
Instead of checking the size of text only node, let the xml_translate verify it.
The size verification using etree was introduced at 40efdccc3d but was
probably too simple.
Since 45352512a8, this becomes redundant with the nonspace method which can
be extended.
The re.sub is still relevant as some terms may contain only non-alphanumeric and
use push_translation (e.g. '>=' as a selection or xml terms extracted by babel
in static repository)
closesodoo/odoo#29432
Suppose calling get_fiscal_year(date, day=29, month=2) with date(year=2017, month=2, day=28)
The computation steps are:
date_from = date(year=2017, month=2, day=28) - 1 year = date(year=2016, month=2, day=28)
date_from = date_from + 1 day = date(year=2016, month=2, day=29)
It's incorrect because the value of date_from must be date(year=2016, month=3, day=1)
closesodoo/odoo#29416
*: tools, web, website, website_forum, mail, im_livechat
This commit refactors ir_http to make it more readable
and flexible.
Move the resize function of web/image to odoo.tools
Co-authored-by: XavierDo <xdo@odoo.com>
Co-authored-by: Antony Lesuisse <al@openerp.com>
closes: #28563
task: #1908896
The adaptation to Python 3 was done with two mistakes: the iteration on the lru
cache does not return keys, and functions are not sortable.
closesodoo/odoo#28870
_tag_delete was not properly converted when the _tag_ calling
convention was modified in 4d581e26c2,
so <delete> tags would all blow up if encountered.
closesodoo/odoo#29149
Odoo no longer supports python 2, thus some of these helpers can and
have been replaced by python 3 built-ins, therefore there is no need for
them to stay defined.
The removed helpers are:
* izip, imap and ifilter
* unichr, text_type
* implements_to_string, implements_iterator
* string_types, integer_types
* to_native
The python 2 shims have also been removed, and only the python 3 helpers
have been kept, because they can still be usable (i.e. accepting
both bytes and str for functions that can only accept one of the two)
[REM] pyjsparser: remove PY3 shims
They're no longer necessary as Odoo doesn't officially support python 2
anymore.
closesodoo/odoo#28519
This commit replaces calls to pycompat helpers that were intended for
python 2 <-> python 3 interoperability for python 3 builtins, as python
2 is no longer officially supported by Odoo.
This includes:
* calls to imap/izip/ifilter replaced by map/zip/filter
* uses of text_type replaced by str
* uses of unichr replaced by chr
* calls to implements_to_string, implements_iterator removed
* string_types and integer_types replaced by str, int respectively
* calls to to_native replaced by calls to to_text
This is done in preparation to the removal of these deprecated helpers
in the following commit.
When there is a language and its base language translation files in a
module, in 12.0 an empty translation in the language translation file
will not fallback on the base language.
eg.
fr.po : {'one': 'un', 'seventy': 'soixante-dix'}
fr_BE.po: {'one': '', 'seventy': 'septante'}
=> the translation in fr_BE will be {'one': '', 'seventy': 'septante'}
but before 7288b477 it would have been {'one': 'un', 'seventy': 'septante'}
With this commit, an empty translation is no longer created so does not
override base language.
Also the intention of d84b795b0a that was also lost is restored by
upserting only noupdate==false translation, and inserting the other
ones.
opw-1904638
closes#28297
When installing/updating a module, verify existence of foreign records
before updating them. Also handle forcecreate=False records.
Also fix misprefixed XML id in sale_quotation_builder.
closesodoo/odoo#27659