[MERGE] forward port branch saas-15 up to 6c6e652673

This commit is contained in:
Christophe Simonis
2019-06-07 11:38:48 +02:00
16 changed files with 152 additions and 17 deletions
+3 -2
View File
@@ -233,6 +233,7 @@ class AccountMove(models.Model):
@api.multi
def _reverse_move(self, date=None, journal_id=None):
self.ensure_one()
date = date or fields.Date.today()
with self.env.norecompute():
reversed_move = self.copy(default={
'date': date,
@@ -473,8 +474,8 @@ class AccountMoveLine(models.Model):
is_unaffected_earnings_line = fields.Boolean(string="Is Unaffected Earnings Line", compute="_compute_is_unaffected_earnings_line", help="Tells whether or not this line belongs to an unaffected earnings account")
_sql_constraints = [
('credit_debit1', 'CHECK (credit*debit=0)', 'Wrong credit or debit value in accounting entry !'),
('credit_debit2', 'CHECK (credit+debit>=0)', 'Wrong credit or debit value in accounting entry !'),
('credit_debit1', 'CHECK (credit*debit=0)', 'Wrong credit or debit value in accounting entry! Credit or debit should be zero.'),
('credit_debit2', 'CHECK (credit+debit>=0)', 'Wrong credit or debit value in accounting entry! Credit and debit should be positive.'),
]
@api.model
+2 -7
View File
@@ -486,13 +486,9 @@ class AccountAssetDepreciationLine(models.Model):
def create_move(self, post_move=True):
created_moves = self.env['account.move']
prec = self.env['decimal.precision'].precision_get('Account')
# `line.move_id` was invalidated from the cache at each iteration
# To prevent to refetch `move_id` of all lines at each iteration just to check a UserError,
# we use an intermediar dict which stores the information the UserError check requires.
line_moves = {line: line.move_id for line in self}
if self.mapped('move_id'):
raise UserError(_('This depreciation is already linked to a journal entry! Please post or delete it.'))
for line in self:
if line_moves[line]:
raise UserError(_('This depreciation is already linked to a journal entry! Please post or delete it.'))
category_id = line.asset_id.category_id
depreciation_date = self.env.context.get('depreciation_date') or line.depreciation_date or fields.Date.context_today(self)
company_currency = line.asset_id.company_id.currency_id
@@ -529,7 +525,6 @@ class AccountAssetDepreciationLine(models.Model):
}
move = self.env['account.move'].create(move_vals)
line.write({'move_id': move.id, 'move_check': True})
line_moves[line] = move
created_moves |= move
if post_move and created_moves:
@@ -10,6 +10,7 @@ Adds the possibility to specify the origin country of goods and the partner VAT
'depends': ['l10n_be_intrastat'],
'data': [
'views/account_invoice_line_view.xml',
'views/report_invoice.xml',
],
'auto_install': True,
}
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_invoice_document_intrastat_2019" inherit_id="account.report_invoice_document">
<xpath expr="//th[@class='hidden']" position="after">
<th class="text-right">Origin Country</th>
</xpath>
<xpath expr="//td[@class='hidden']" position="after">
<td class="text-right">
<span t-field="l.intrastat_product_origin_country_id"/>
</td>
</xpath>
</template>
<template id="report_intrastatinvoice_document_2019" inherit_id="report_intrastat.report_intrastatinvoice_document">
<xpath expr="//th[4]" position="after">
<th class="text-right">Origin Country</th>
</xpath>
<xpath expr="//td[4]" position="after">
<td class="text-right">
<span t-field="l.intrastat_product_origin_country_id"/>
</td>
</xpath>
</template>
<template id="report_invoice_layouted_intrastat_2019" inherit_id="sale.report_invoice_layouted">
<xpath expr="//t[@groups='sale.group_sale_layout']//th[1]" position="after">
<th class="text-right">Origin Country</th>
</xpath>
<xpath expr="//t[@groups='sale.group_sale_layout']//t[@t-as='l']//td[1]" position="after">
<td class="text-right">
<span t-field="l.intrastat_product_origin_country_id"/>
</td>
</xpath>
</template>
</odoo>
+1 -1
View File
@@ -170,7 +170,7 @@ class AcquirerAdyen(models.Model):
'sessionValidity': tmp_date.isoformat('T')[:19] + "Z",
'resURL': urls.url_join(base_url, AdyenController._return_url),
'merchantReturnData': json.dumps({'return_url': '%s' % values.pop('return_url')}) if values.get('return_url', '') else False,
'shopperEmail': values.get('partner_email', ''),
'shopperEmail': values.get('partner_email') or values.get('billing_partner_email') or '',
})
values['merchantSig'] = self._adyen_generate_merchant_sig_sha256('in', values)
+11
View File
@@ -0,0 +1,11 @@
Mexico, 2018-12-05
I hereby agree to the terms of the Odoo Individual Contributor License
Agreement v1.0.
I declare that I am authorized and able to make this agreement and sign this
declaration.
Signed,
Luis Arturo Íñiguez Hernández luis.iniguezh@gmail.com https://github.com/luisiniguezh
+11
View File
@@ -0,0 +1,11 @@
Italy, 2019-06-04
I hereby agree to the terms of the Odoo Individual Contributor License
Agreement v1.0.
I declare that I am authorized and able to make this agreement and sign this
declaration.
Signed,
Michele Zaccheddu michelezak93@gmail.com https://github.com/MicheleZak
+8
View File
@@ -732,3 +732,11 @@ class IrActionsActClient(models.Model):
for record in self:
params = record.params
record.params_store = repr(params) if isinstance(params, dict) else params
def _get_default_form_view(self):
doc = super(IrActionsActClient, self)._get_default_form_view()
params = doc.find(".//field[@name='params']")
params.getparent().remove(params)
params_store = doc.find(".//field[@name='params_store']")
params_store.getparent().remove(params_store)
return doc
+6 -5
View File
@@ -697,7 +697,7 @@ class IrModelFields(models.Model):
item._prepare_update()
if column_rename:
raise UserError(_('Can only rename one field at a time!'))
column_rename = (obj._table, item.name, vals['name'], item.index)
column_rename = (obj._table, item.name, vals['name'], item.index, item.store)
# We don't check the 'state', because it might come from the context
# (thus be set for multiple fields) and will be ignored anyway.
@@ -715,10 +715,11 @@ class IrModelFields(models.Model):
if column_rename:
# rename column in database, and its corresponding index if present
table, oldname, newname, index = column_rename
self._cr.execute('ALTER TABLE "%s" RENAME COLUMN "%s" TO "%s"' % (table, oldname, newname))
if index:
self._cr.execute('ALTER INDEX "%s_%s_index" RENAME TO "%s_%s_index"' % (table, oldname, table, newname))
table, oldname, newname, index, stored = column_rename
if stored:
self._cr.execute('ALTER TABLE "%s" RENAME COLUMN "%s" TO "%s"' % (table, oldname, newname))
if index:
self._cr.execute('ALTER INDEX "%s_%s_index" RENAME TO "%s_%s_index"' % (table, oldname, table, newname))
if column_rename or patched_models:
# setup models, this will reload all manual fields in registry
+13
View File
@@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, SUPERUSER_ID
# TO REMOVE in master
def uninstall_test_pylint(cr):
env = api.Environment(cr, SUPERUSER_ID, {})
env['ir.module.module'].search([
('name', '=', 'test_pylint'),
('state', '=', 'installed')
]).write({'state': 'uninstalled'})
+12
View File
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
{
'name': 'test-lint',
'version': '0.1',
'category': 'Tests',
'description': """A module to test Odoo code with various linters.""",
'maintainer': 'Odoo SA',
'depends': ['base'],
'installable': True,
'auto_install': False,
'pre_init_hook': 'uninstall_test_pylint'
}
+2
View File
@@ -0,0 +1,2 @@
from . import test_pylint
from . import test_ecmascript
@@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
import os
import re
import subprocess
from unittest import skipIf
from odoo.tests.common import TransactionCase
from odoo import tools
from odoo.modules import get_modules, get_module_path
MAX_ES_VERSION = 'es5'
_logger = logging.getLogger(__name__)
try:
es_check = tools.misc.find_in_path('es-check')
except IOError:
es_check = None
@skipIf(es_check is None, "es-check tool not found on this system")
class TestECMAScriptVersion(TransactionCase):
longMessage = True
def test_ecmascript_version(self):
""" Test that there is no unsupported ecmascript in javascript files """
black_re = re.compile(r'summernote.+(intro\.js|outro.js)$')
mod_paths = [get_module_path(m) for m in get_modules()]
files_to_check = []
for p in mod_paths:
for dp, _, file_names in os.walk(p):
if 'static/test' in dp:
continue
for fn in file_names:
fullpath_name = os.path.join(dp, fn)
if fullpath_name.endswith('.js') and not black_re.search(fullpath_name):
files_to_check.append(fullpath_name)
_logger.info('Testing %s js files', len(files_to_check))
cmd = [es_check, MAX_ES_VERSION] + files_to_check
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = process.communicate()
self.assertEqual(process.returncode, 0, msg=out)
+1 -1
View File
@@ -3,7 +3,7 @@
'name': 'test-eval',
'version': '0.1',
'category': 'Tests',
'description': """A module to test Odoo with pylint.""",
'description': """Deprecated empty module in favor of test-lint.""",
'maintainer': 'Odoo SA',
'depends': ['base'],
'installable': True,
@@ -1 +0,0 @@
from . import test_pylint