mirror of
https://gitlab.com/flectra-hq/flectra.git
synced 2025-02-25 18:55:21 -06:00
[PATCH] Upstream patch - 20062023
This commit is contained in:
@@ -750,12 +750,15 @@ class AccountMove(models.Model):
|
||||
self.date or fields.Date.context_today(self),
|
||||
)
|
||||
amount_currency = currency.round(taxes_map_entry['amount'])
|
||||
sign = -1 if self.is_inbound() else 1
|
||||
to_write_on_line = {
|
||||
'amount_currency': amount_currency,
|
||||
'currency_id': taxes_map_entry['grouping_dict']['currency_id'],
|
||||
'debit': balance > 0.0 and balance or 0.0,
|
||||
'credit': balance < 0.0 and -balance or 0.0,
|
||||
'tax_base_amount': tax_base_amount,
|
||||
'price_total': sign * amount_currency,
|
||||
'price_subtotal': sign * amount_currency,
|
||||
}
|
||||
|
||||
if taxes_map_entry['tax_line']:
|
||||
|
||||
@@ -31,10 +31,7 @@ class MailTemplate(models.Model):
|
||||
new_attachments = []
|
||||
|
||||
include_qr_report = 'l10n_ch.l10n_ch_qr_report' not in self.env.context.get('l10n_ch_mail_skip_report', [])
|
||||
if include_qr_report and \
|
||||
record.move_type == 'out_invoice' and \
|
||||
record.partner_bank_id._eligible_for_qr_code('ch_qr', record.partner_id, record.currency_id) and \
|
||||
record.display_qr_code:
|
||||
if include_qr_report and record.move_type == 'out_invoice' and record.partner_bank_id._eligible_for_qr_code('ch_qr', record.partner_id, record.currency_id):
|
||||
# We add an attachment containing the QR-bill
|
||||
qr_report_name = 'QR-bill-' + inv_print_name + '.pdf'
|
||||
qr_pdf = self.env.ref('l10n_ch.l10n_ch_qr_report')._render_qweb_pdf(record.ids)[0]
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
'depends': ['l10n_fr', 'account'],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'security/security.xml',
|
||||
'wizard/account_fr_fec_view.xml',
|
||||
],
|
||||
'auto_install': True,
|
||||
|
||||
8
addons/l10n_fr_fec/security/security.xml
Normal file
8
addons/l10n_fr_fec/security/security.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<flectra noupdate="1">
|
||||
<record id="account_fr_fec_rule" model="ir.rule">
|
||||
<field name="name">Account Fr Fec Rule</field>
|
||||
<field name="model_id" ref="model_account_fr_fec"/>
|
||||
<field name="domain_force">[('create_uid', '=', user.id)]</field>
|
||||
</record>
|
||||
</flectra>
|
||||
@@ -148,10 +148,15 @@ class AccountMove(models.Model):
|
||||
tax_dict['base_amount'] = base_amount - tax_dict['rounding_euros']
|
||||
|
||||
if not reverse_charge_refund:
|
||||
tax_dict['base_amount'] = abs(tax_dict['base_amount'])
|
||||
tax_dict['base_amount_currency'] = abs(tax_dict['base_amount_currency'])
|
||||
tax_dict['tax_amount'] = abs(tax_dict['tax_amount'])
|
||||
tax_dict['tax_amount_currency'] = abs(tax_dict['tax_amount_currency'])
|
||||
balance_multiplicator = -1 if self.is_inbound() else 1
|
||||
if tax_dict['base_amount'] != 0: # We shouldn't change 0 into -0
|
||||
tax_dict['base_amount'] *= balance_multiplicator
|
||||
if tax_dict['base_amount_currency'] != 0:
|
||||
tax_dict['base_amount_currency'] *= balance_multiplicator
|
||||
if tax_dict['tax_amount'] != 0:
|
||||
tax_dict['tax_amount'] *= balance_multiplicator
|
||||
if tax_dict['tax_amount_currency'] != 0:
|
||||
tax_dict['tax_amount_currency'] *= balance_multiplicator
|
||||
return tax_details
|
||||
|
||||
def _prepare_fatturapa_export_values(self):
|
||||
|
||||
@@ -47,6 +47,13 @@ class TestItEdi(AccountEdiTestCommon):
|
||||
'company_id': cls.company.id,
|
||||
})
|
||||
|
||||
cls.tax_10 = cls.env['account.tax'].create({
|
||||
'name': '10% tax',
|
||||
'amount': 10.0,
|
||||
'amount_type': 'percent',
|
||||
'company_id': cls.company.id,
|
||||
})
|
||||
|
||||
cls.tax_zero_percent_hundred_percent_repartition = cls.env['account.tax'].create({
|
||||
'name': 'all of nothing',
|
||||
'amount': 0,
|
||||
@@ -322,9 +329,19 @@ class TestItEdi(AccountEdiTestCommon):
|
||||
'name': 'negative_line',
|
||||
'price_unit': -100.0,
|
||||
}),
|
||||
(0, 0, {
|
||||
**cls.standard_line,
|
||||
'name': 'negative_line_different_tax',
|
||||
'price_unit': -50.0,
|
||||
'tax_ids': [(6, 0, [cls.tax_10.id])]
|
||||
}),
|
||||
],
|
||||
})
|
||||
|
||||
cls.negative_price_credit_note = cls.negative_price_invoice.with_company(cls.company)._reverse_moves([{
|
||||
'invoice_date': datetime.date(2022, 3, 24),
|
||||
}])
|
||||
|
||||
# post the invoices
|
||||
cls.price_included_invoice._post()
|
||||
cls.partial_discount_invoice._post()
|
||||
@@ -335,6 +352,7 @@ class TestItEdi(AccountEdiTestCommon):
|
||||
cls.pa_partner_invoice._post()
|
||||
cls.zero_tax_invoice._post()
|
||||
cls.negative_price_invoice._post()
|
||||
cls.negative_price_credit_note._post()
|
||||
|
||||
cls.edi_basis_xml = cls._get_test_file_content('IT00470550013_basis.xml')
|
||||
cls.edi_simplified_basis_xml = cls._get_test_file_content('IT00470550013_simpl.xml')
|
||||
@@ -709,20 +727,90 @@ class TestItEdi(AccountEdiTestCommon):
|
||||
<PrezzoTotale>-100.00</PrezzoTotale>
|
||||
<AliquotaIVA>22.00</AliquotaIVA>
|
||||
</DettaglioLinee>
|
||||
<DettaglioLinee>
|
||||
<NumeroLinea>3</NumeroLinea>
|
||||
<Descrizione>negative_line_different_tax</Descrizione>
|
||||
<Quantita>1.00</Quantita>
|
||||
<PrezzoUnitario>-50.000000</PrezzoUnitario>
|
||||
<PrezzoTotale>-50.00</PrezzoTotale>
|
||||
<AliquotaIVA>10.00</AliquotaIVA>
|
||||
</DettaglioLinee>
|
||||
<DatiRiepilogo>
|
||||
<AliquotaIVA>22.00</AliquotaIVA>
|
||||
<ImponibileImporto>700.40</ImponibileImporto>
|
||||
<Imposta>154.09</Imposta>
|
||||
<EsigibilitaIVA>I</EsigibilitaIVA>
|
||||
</DatiRiepilogo>
|
||||
<DatiRiepilogo>
|
||||
<AliquotaIVA>10.00</AliquotaIVA>
|
||||
<ImponibileImporto>-50.00</ImponibileImporto>
|
||||
<Imposta>-5.00</Imposta>
|
||||
<EsigibilitaIVA>I</EsigibilitaIVA>
|
||||
</DatiRiepilogo>
|
||||
</DatiBeniServizi>
|
||||
</xpath>
|
||||
<xpath expr="//DettaglioPagamento//ImportoPagamento" position="inside">
|
||||
854.49
|
||||
799.49
|
||||
</xpath>
|
||||
<xpath expr="//DatiGeneraliDocumento//ImportoTotaleDocumento" position="inside">
|
||||
854.49
|
||||
799.49
|
||||
</xpath>
|
||||
''')
|
||||
invoice_etree = self.with_applied_xpath(invoice_etree, "<xpath expr='.//Allegati' position='replace'/>")
|
||||
self.assertXmlTreeEqual(invoice_etree, expected_etree)
|
||||
|
||||
def test_negative_price_credit_note(self):
|
||||
invoice_etree = etree.fromstring(self.negative_price_credit_note._export_as_xml())
|
||||
expected_etree = self.with_applied_xpath(
|
||||
etree.fromstring(self.edi_basis_xml),
|
||||
'''
|
||||
<xpath expr="//DatiGeneraliDocumento/TipoDocumento" position="replace">
|
||||
<TipoDocumento>TD04</TipoDocumento>
|
||||
</xpath>
|
||||
<xpath expr="//DatiGeneraliDocumento//ImportoTotaleDocumento" position="inside">
|
||||
799.49
|
||||
</xpath>
|
||||
<xpath expr="//DatiBeniServizi" position="replace">
|
||||
<DatiBeniServizi>
|
||||
<DettaglioLinee>
|
||||
<NumeroLinea>1</NumeroLinea>
|
||||
<Descrizione>standard_line</Descrizione>
|
||||
<Quantita>1.00</Quantita>
|
||||
<PrezzoUnitario>800.400000</PrezzoUnitario>
|
||||
<PrezzoTotale>800.40</PrezzoTotale>
|
||||
<AliquotaIVA>22.00</AliquotaIVA>
|
||||
</DettaglioLinee>
|
||||
<DettaglioLinee>
|
||||
<NumeroLinea>2</NumeroLinea>
|
||||
<Descrizione>negative_line</Descrizione>
|
||||
<Quantita>1.00</Quantita>
|
||||
<PrezzoUnitario>-100.000000</PrezzoUnitario>
|
||||
<PrezzoTotale>-100.00</PrezzoTotale>
|
||||
<AliquotaIVA>22.00</AliquotaIVA>
|
||||
</DettaglioLinee>
|
||||
<DettaglioLinee>
|
||||
<NumeroLinea>3</NumeroLinea>
|
||||
<Descrizione>negative_line_different_tax</Descrizione>
|
||||
<Quantita>1.00</Quantita>
|
||||
<PrezzoUnitario>-50.000000</PrezzoUnitario>
|
||||
<PrezzoTotale>-50.00</PrezzoTotale>
|
||||
<AliquotaIVA>10.00</AliquotaIVA>
|
||||
</DettaglioLinee>
|
||||
<DatiRiepilogo>
|
||||
<AliquotaIVA>22.00</AliquotaIVA>
|
||||
<ImponibileImporto>700.40</ImponibileImporto>
|
||||
<Imposta>154.09</Imposta>
|
||||
<EsigibilitaIVA>I</EsigibilitaIVA>
|
||||
</DatiRiepilogo>
|
||||
<DatiRiepilogo>
|
||||
<AliquotaIVA>10.00</AliquotaIVA>
|
||||
<ImponibileImporto>-50.00</ImponibileImporto>
|
||||
<Imposta>-5.00</Imposta>
|
||||
<EsigibilitaIVA>I</EsigibilitaIVA>
|
||||
</DatiRiepilogo>
|
||||
</DatiBeniServizi>
|
||||
</xpath>
|
||||
<xpath expr="//DatiPagamento" position="replace"/>
|
||||
''')
|
||||
invoice_etree = self.with_applied_xpath(invoice_etree, "<xpath expr='.//Allegati' position='replace'/>")
|
||||
self.assertXmlTreeEqual(invoice_etree, expected_etree)
|
||||
|
||||
@@ -2,6 +2,7 @@ flectra.define('web.framework', function (require) {
|
||||
"use strict";
|
||||
|
||||
var core = require('web.core');
|
||||
const config = require("web.config");
|
||||
var ajax = require('web.ajax');
|
||||
var Widget = require('web.Widget');
|
||||
var disableCrashManager = require('web.CrashManager').disable;
|
||||
@@ -102,7 +103,11 @@ function unblockUI() {
|
||||
*/
|
||||
function redirect (url, wait) {
|
||||
// Dont display a dialog if some xmlhttprequest are in progress
|
||||
disableCrashManager();
|
||||
// we don't disable the crash manager on mobile phones, because when going back to flectra,
|
||||
// the page is not reloaded, and the crashManager stays disabled.
|
||||
if (!config.device.isIOS && !config.device.isAndroid) {
|
||||
disableCrashManager();
|
||||
}
|
||||
|
||||
var load = function() {
|
||||
var old = "" + window.location;
|
||||
|
||||
@@ -12,9 +12,11 @@ flectra.define('web.CrashManager', function (require) {
|
||||
const AbstractService = require('web.AbstractService');
|
||||
var ajax = require('web.ajax');
|
||||
const BrowserDetection = require('web.BrowserDetection');
|
||||
const config = require("web.config");
|
||||
var core = require('web.core');
|
||||
var Dialog = require('web.Dialog');
|
||||
var ErrorDialogRegistry = require('web.ErrorDialogRegistry');
|
||||
const session = require('web.session');
|
||||
var Widget = require('web.Widget');
|
||||
|
||||
var _t = core._t;
|
||||
@@ -122,6 +124,18 @@ var CrashManager = AbstractService.extend({
|
||||
window.onOriginError();
|
||||
delete window.onOriginError;
|
||||
} else {
|
||||
// In Safari 16.4+ (as of Jun 14th 2023), an error occurs
|
||||
// when going back and forward through the browser when the
|
||||
// cache is enabled. A feedback has been reported but in the
|
||||
// meantime, hide any script error in these versions.
|
||||
if (
|
||||
config.device.isIOS
|
||||
&& message === "Script error."
|
||||
&& session.is_frontend
|
||||
&& flectra.debug !== "assets"
|
||||
) {
|
||||
return;
|
||||
}
|
||||
self.show_error({
|
||||
type: _t("Flectra Client Error"),
|
||||
message: _t("Unknown CORS error"),
|
||||
|
||||
@@ -174,7 +174,7 @@ class Integer(models.AbstractModel):
|
||||
def from_html(self, model, field, element):
|
||||
lang = self.user_lang()
|
||||
value = element.text_content().strip()
|
||||
return int(value.replace(lang.thousands_sep, ''))
|
||||
return int(value.replace(lang.thousands_sep or '', ''))
|
||||
|
||||
|
||||
class Float(models.AbstractModel):
|
||||
@@ -186,7 +186,7 @@ class Float(models.AbstractModel):
|
||||
def from_html(self, model, field, element):
|
||||
lang = self.user_lang()
|
||||
value = element.text_content().strip()
|
||||
return float(value.replace(lang.thousands_sep, '')
|
||||
return float(value.replace(lang.thousands_sep or '', '')
|
||||
.replace(lang.decimal_point, '.'))
|
||||
|
||||
|
||||
@@ -493,7 +493,7 @@ class Monetary(models.AbstractModel):
|
||||
|
||||
value = element.find('span').text.strip()
|
||||
|
||||
return float(value.replace(lang.thousands_sep, '')
|
||||
return float(value.replace(lang.thousands_sep or '', '')
|
||||
.replace(lang.decimal_point, '.'))
|
||||
|
||||
|
||||
|
||||
@@ -1113,6 +1113,13 @@ registry.FooterSlideout = publicWidget.Widget.extend({
|
||||
this.__pixelEl.style.width = `1px`;
|
||||
this.__pixelEl.style.height = `1px`;
|
||||
this.__pixelEl.style.marginTop = `-1px`;
|
||||
// On safari, add a background attachment fixed to fix the glitches that
|
||||
// appear when scrolling the page with a footer slide out.
|
||||
if (this.el.classList.contains("o_safari_browser")) {
|
||||
this.__pixelEl.style.backgroundColor = "transparent";
|
||||
this.__pixelEl.style.backgroundAttachment = "fixed";
|
||||
this.__pixelEl.style.backgroundImage = "url(/website/static/src/img/website_logo.png)";
|
||||
}
|
||||
this.el.appendChild(this.__pixelEl);
|
||||
|
||||
return this._super(...arguments);
|
||||
|
||||
@@ -1,7 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from flectra.tests import standalone
|
||||
from flectra.tests import HttpCase, standalone, tagged
|
||||
|
||||
|
||||
@tagged('website_nightly', '-standard')
|
||||
class TestWebsiteNightlyRunbot(HttpCase):
|
||||
def test_01_website_nightly_runbot(self):
|
||||
""" This test is just here to avoid runbot to raise an error on the
|
||||
``website_nightly`` build. Indeed, if not a single test with this tag is
|
||||
found, the build will be considered as failed.
|
||||
In Flectra 16.4 a real test is using this tag.
|
||||
"""
|
||||
|
||||
|
||||
"""
|
||||
This test ensure `inherit_id` update is correctly replicated on cow views.
|
||||
|
||||
Reference in New Issue
Block a user