[PATCH] Upstream patch - 19112022

This commit is contained in:
Parthiv Patel
2022-11-19 08:34:34 +00:00
parent 82ab4ab69e
commit 53232fc6f8
6 changed files with 27 additions and 6 deletions
+1
View File
@@ -251,6 +251,7 @@ class AccountMove(models.Model):
"This is needed when cancelling the source: it will post the inverse journal entry to cancel that part too.")
tax_cash_basis_move_id = fields.Many2one(
comodel_name='account.move',
index=True,
string="Origin Tax Cash Basis Entry",
help="The journal entry from which this tax cash basis journal entry has been created.")
@@ -394,6 +394,7 @@ class AccountMove(models.Model):
'''
to_cancel_documents = self.env['account.edi.document']
for move in self:
move._check_fiscalyear_lock_date()
is_move_marked = False
for doc in move.edi_document_ids:
if doc.edi_format_id._needs_web_services() \
@@ -25,6 +25,10 @@ class IrModule(models.Model):
imported = fields.Boolean(string="Imported Module")
def _get_modules_to_load_domain(self):
# imported modules are not expected to be loaded as regular modules
return super()._get_modules_to_load_domain() + [('imported', '=', False)]
@api.depends('name')
def _get_latest_version(self):
imported_modules = self.filtered(lambda m: m.imported and m.latest_version)
+7 -3
View File
@@ -589,6 +589,9 @@ Or send your receipts at <a href="mailto:%(email)s?subject=Lunch%%20with%%20cust
('user_id.email', 'ilike', email_address)
], limit=1)
if not employee:
return super().message_new(msg_dict, custom_values=custom_values)
expense_description = msg_dict.get('subject', '')
if employee.user_id:
@@ -651,15 +654,16 @@ Or send your receipts at <a href="mailto:%(email)s?subject=Lunch%%20with%%20cust
symbols_pattern = '|'.join(symbols)
price_pattern = "((%s)?\s?%s\s?(%s)?)" % (symbols_pattern, float_pattern, symbols_pattern)
matches = re.findall(price_pattern, expense_description)
currency = currencies and currencies[0]
if matches:
match = max(matches, key=lambda match: len([group for group in match if group])) # get the longuest match. e.g. "2 chairs 120$" -> the price is 120$, not 2
full_str = match[0]
currency_str = match[1] or match[3]
price = match[2].replace(',', '.')
if currency_str:
currency = currencies.filtered(lambda c: currency_str in [c.symbol, c.name])[0]
currency = currency or currencies[0]
if currency_str and currencies:
currencies = currencies.filtered(lambda c: currency_str in [c.symbol, c.name])
currency = (currencies and currencies[0]) or currency
expense_description = expense_description.replace(full_str, ' ') # remove price from description
expense_description = re.sub(' +', ' ', expense_description.strip())
+8 -2
View File
@@ -1,9 +1,10 @@
# -*- coding: utf-8 -*-
import werkzeug
from werkzeug.exceptions import InternalServerError
from flectra import http
from flectra.http import request
from flectra.addons.web.controllers.main import _serialize_exception
from flectra.tools import html_escape
import json
@@ -34,4 +35,9 @@ class StockReportController(http.Controller):
'message': 'Flectra Server Error',
'data': se
}
return request.make_response(html_escape(json.dumps(error)))
res = werkzeug.wrappers.Response(
json.dumps(error),
status=500,
headers=[("Content-Type", "application/json")]
)
raise InternalServerError(response=res) from e
+6 -1
View File
@@ -2153,7 +2153,12 @@ class ReportController(http.Controller):
'message': "Flectra Server Error",
'data': se
}
return request.make_response(html_escape(json.dumps(error)))
res = werkzeug.wrappers.Response(
json.dumps(error),
status=500,
headers=[("Content-Type", "application/json")]
)
raise werkzeug.exceptions.InternalServerError(response=res) from e
@http.route(['/report/check_wkhtmltopdf'], type='json', auth="user")
def check_wkhtmltopdf(self):