[PATCH] Upstream patch - 29012023

This commit is contained in:
Parthiv Patel
2023-01-29 08:36:46 +00:00
parent 233e4fd920
commit 5c65a9bdff
10 changed files with 210 additions and 89 deletions

View File

@@ -42,12 +42,19 @@ def update_taxes_from_templates(cr, chart_template_xmlid):
module, name = xml_id.split(".", 1)
env['ir.model.data'].search([('module', '=', module), ('name', '=', name)]).unlink()
def _avoid_name_conflict():
conflict_tax = env['account.tax'].search([('name', '=', template.name), ('company_id', '=', company.id),
('type_tax_use', '=', template.type_tax_use), ('tax_scope', '=', template.tax_scope)])
if conflict_tax:
conflict_tax.name = "[old] " + conflict_tax.name
template_vals = template._get_tax_vals_complete(company)
chart_template = env["account.chart.template"].with_context(default_company_id=company.id)
if old_tax:
xml_id = old_tax.get_xml_id().get(old_tax.id)
if xml_id:
_remove_xml_id(xml_id)
_avoid_name_conflict()
chart_template.create_record_with_xmlid(company, template, "account.tax", template_vals)
def _update_tax_from_template(template, tax):

View File

@@ -184,3 +184,14 @@ class TestChartTemplate(SavepointCase):
# if only the fiscal position mapping has been removed, it won't be recreated
self.assertEqual(len(fiscal_position.tax_ids), 0)
def test_update_taxes_conflict_name(self):
chart_template_xml_id = self.chart_template.get_external_id()[self.chart_template.id]
template_vals = self.tax_1_template._get_tax_vals_complete(self.company_1)
template_vals['amount'] = 20
self.chart_template.create_record_with_xmlid(self.company_1, self.tax_1_template, "account.tax", template_vals)
update_taxes_from_templates(self.env.cr, chart_template_xml_id)
tax_1_old = self.env['account.tax'].search([('company_id', '=', self.company_1.id), ('name', '=', "[old] " + self.tax_1_template.name)])
tax_1_new = self.env['account.tax'].search([('company_id', '=', self.company_1.id), ('name', '=', self.tax_1_template.name)])
self.assertEqual(len(tax_1_old), 1, "Old tax still exists but with a different name.")
self.assertEqual(len(tax_1_new), 1, "New tax have been created with the original name.")

View File

@@ -26,7 +26,7 @@ EU_TAX_MAP = {
('AT', 10.0, 'IE'): 13.5,
('AT', 10.0, 'IT'): 4.0,
('AT', 10.0, 'LT'): 5.0,
('AT', 10.0, 'LU'): 8.0,
('AT', 10.0, 'LU'): 7.0,
('AT', 10.0, 'LV'): 12.0,
('AT', 10.0, 'MT'): 5.0,
('AT', 10.0, 'NL'): 9.0,
@@ -52,7 +52,7 @@ EU_TAX_MAP = {
('AT', 13.0, 'IE'): 23.0,
('AT', 13.0, 'IT'): 22.0,
('AT', 13.0, 'LT'): 21.0,
('AT', 13.0, 'LU'): 17.0,
('AT', 13.0, 'LU'): 16.0,
('AT', 13.0, 'LV'): 21.0,
('AT', 13.0, 'MT'): 18.0,
('AT', 13.0, 'NL'): 21.0,
@@ -78,7 +78,7 @@ EU_TAX_MAP = {
('AT', 20.0, 'IE'): 23.0,
('AT', 20.0, 'IT'): 22.0,
('AT', 20.0, 'LT'): 21.0,
('AT', 20.0, 'LU'): 17.0,
('AT', 20.0, 'LU'): 16.0,
('AT', 20.0, 'LV'): 21.0,
('AT', 20.0, 'MT'): 18.0,
('AT', 20.0, 'NL'): 21.0,
@@ -104,7 +104,7 @@ EU_TAX_MAP = {
('BE', 12.0, 'IE'): 23.0,
('BE', 12.0, 'IT'): 22.0,
('BE', 12.0, 'LT'): 21.0,
('BE', 12.0, 'LU'): 17.0,
('BE', 12.0, 'LU'): 16.0,
('BE', 12.0, 'LV'): 21.0,
('BE', 12.0, 'MT'): 18.0,
('BE', 12.0, 'NL'): 21.0,
@@ -130,7 +130,7 @@ EU_TAX_MAP = {
('BE', 21.0, 'IE'): 23.0,
('BE', 21.0, 'IT'): 22.0,
('BE', 21.0, 'LT'): 21.0,
('BE', 21.0, 'LU'): 17.0,
('BE', 21.0, 'LU'): 16.0,
('BE', 21.0, 'LV'): 21.0,
('BE', 21.0, 'MT'): 18.0,
('BE', 21.0, 'NL'): 21.0,
@@ -156,7 +156,7 @@ EU_TAX_MAP = {
('BE', 6.0, 'IE'): 13.5,
('BE', 6.0, 'IT'): 4.0,
('BE', 6.0, 'LT'): 5.0,
('BE', 6.0, 'LU'): 8.0,
('BE', 6.0, 'LU'): 7.0,
('BE', 6.0, 'LV'): 12.0,
('BE', 6.0, 'MT'): 5.0,
('BE', 6.0, 'NL'): 9.0,
@@ -182,7 +182,7 @@ EU_TAX_MAP = {
('BG', 20.0, 'IE'): 23.0,
('BG', 20.0, 'IT'): 22.0,
('BG', 20.0, 'LT'): 21.0,
('BG', 20.0, 'LU'): 17.0,
('BG', 20.0, 'LU'): 16.0,
('BG', 20.0, 'LV'): 21.0,
('BG', 20.0, 'MT'): 18.0,
('BG', 20.0, 'NL'): 21.0,
@@ -208,7 +208,7 @@ EU_TAX_MAP = {
('BG', 9.0, 'IE'): 13.5,
('BG', 9.0, 'IT'): 4.0,
('BG', 9.0, 'LT'): 5.0,
('BG', 9.0, 'LU'): 8.0,
('BG', 9.0, 'LU'): 7.0,
('BG', 9.0, 'LV'): 12.0,
('BG', 9.0, 'MT'): 5.0,
('BG', 9.0, 'NL'): 9.0,
@@ -234,7 +234,7 @@ EU_TAX_MAP = {
('CY', 19.0, 'IE'): 23.0,
('CY', 19.0, 'IT'): 22.0,
('CY', 19.0, 'LT'): 21.0,
('CY', 19.0, 'LU'): 17.0,
('CY', 19.0, 'LU'): 16.0,
('CY', 19.0, 'LV'): 21.0,
('CY', 19.0, 'MT'): 18.0,
('CY', 19.0, 'NL'): 21.0,
@@ -260,7 +260,7 @@ EU_TAX_MAP = {
('CY', 5.0, 'IE'): 13.5,
('CY', 5.0, 'IT'): 4.0,
('CY', 5.0, 'LT'): 5.0,
('CY', 5.0, 'LU'): 8.0,
('CY', 5.0, 'LU'): 7.0,
('CY', 5.0, 'LV'): 12.0,
('CY', 5.0, 'MT'): 5.0,
('CY', 5.0, 'NL'): 9.0,
@@ -286,7 +286,7 @@ EU_TAX_MAP = {
('CY', 9.0, 'IE'): 13.5,
('CY', 9.0, 'IT'): 10.0,
('CY', 9.0, 'LT'): 5.0,
('CY', 9.0, 'LU'): 8.0,
('CY', 9.0, 'LU'): 7.0,
('CY', 9.0, 'LV'): 12.0,
('CY', 9.0, 'MT'): 5.0,
('CY', 9.0, 'NL'): 9.0,
@@ -312,7 +312,7 @@ EU_TAX_MAP = {
('CZ', 10.0, 'IE'): 13.5,
('CZ', 10.0, 'IT'): 4.0,
('CZ', 10.0, 'LT'): 5.0,
('CZ', 10.0, 'LU'): 8.0,
('CZ', 10.0, 'LU'): 7.0,
('CZ', 10.0, 'LV'): 12.0,
('CZ', 10.0, 'MT'): 5.0,
('CZ', 10.0, 'NL'): 9.0,
@@ -338,7 +338,7 @@ EU_TAX_MAP = {
('CZ', 15.0, 'IE'): 13.5,
('CZ', 15.0, 'IT'): 10.0,
('CZ', 15.0, 'LT'): 5.0,
('CZ', 15.0, 'LU'): 8.0,
('CZ', 15.0, 'LU'): 7.0,
('CZ', 15.0, 'LV'): 12.0,
('CZ', 15.0, 'MT'): 5.0,
('CZ', 15.0, 'NL'): 9.0,
@@ -364,7 +364,7 @@ EU_TAX_MAP = {
('CZ', 21.0, 'IE'): 23.0,
('CZ', 21.0, 'IT'): 22.0,
('CZ', 21.0, 'LT'): 21.0,
('CZ', 21.0, 'LU'): 17.0,
('CZ', 21.0, 'LU'): 16.0,
('CZ', 21.0, 'LV'): 21.0,
('CZ', 21.0, 'MT'): 18.0,
('CZ', 21.0, 'NL'): 21.0,
@@ -390,7 +390,7 @@ EU_TAX_MAP = {
('DE', 19.0, 'IE'): 23.0,
('DE', 19.0, 'IT'): 22.0,
('DE', 19.0, 'LT'): 21.0,
('DE', 19.0, 'LU'): 17.0,
('DE', 19.0, 'LU'): 16.0,
('DE', 19.0, 'LV'): 21.0,
('DE', 19.0, 'MT'): 18.0,
('DE', 19.0, 'NL'): 21.0,
@@ -416,7 +416,7 @@ EU_TAX_MAP = {
('DE', 7.0, 'IE'): 13.5,
('DE', 7.0, 'IT'): 4.0,
('DE', 7.0, 'LT'): 5.0,
('DE', 7.0, 'LU'): 8.0,
('DE', 7.0, 'LU'): 7.0,
('DE', 7.0, 'LV'): 12.0,
('DE', 7.0, 'MT'): 5.0,
('DE', 7.0, 'NL'): 9.0,
@@ -442,7 +442,7 @@ EU_TAX_MAP = {
('DK', 25.0, 'IE'): 23.0,
('DK', 25.0, 'IT'): 22.0,
('DK', 25.0, 'LT'): 21.0,
('DK', 25.0, 'LU'): 17.0,
('DK', 25.0, 'LU'): 16.0,
('DK', 25.0, 'LV'): 21.0,
('DK', 25.0, 'MT'): 18.0,
('DK', 25.0, 'NL'): 21.0,
@@ -468,7 +468,7 @@ EU_TAX_MAP = {
('EE', 20.0, 'IE'): 23.0,
('EE', 20.0, 'IT'): 22.0,
('EE', 20.0, 'LT'): 21.0,
('EE', 20.0, 'LU'): 17.0,
('EE', 20.0, 'LU'): 16.0,
('EE', 20.0, 'LV'): 21.0,
('EE', 20.0, 'MT'): 18.0,
('EE', 20.0, 'NL'): 21.0,
@@ -494,7 +494,7 @@ EU_TAX_MAP = {
('EE', 9.0, 'IE'): 13.5,
('EE', 9.0, 'IT'): 4.0,
('EE', 9.0, 'LT'): 5.0,
('EE', 9.0, 'LU'): 8.0,
('EE', 9.0, 'LU'): 7.0,
('EE', 9.0, 'LV'): 12.0,
('EE', 9.0, 'MT'): 5.0,
('EE', 9.0, 'NL'): 9.0,
@@ -520,7 +520,7 @@ EU_TAX_MAP = {
('ES', 10.0, 'IE'): 13.5,
('ES', 10.0, 'IT'): 10.0,
('ES', 10.0, 'LT'): 5.0,
('ES', 10.0, 'LU'): 8.0,
('ES', 10.0, 'LU'): 7.0,
('ES', 10.0, 'LV'): 12.0,
('ES', 10.0, 'MT'): 5.0,
('ES', 10.0, 'NL'): 9.0,
@@ -546,7 +546,7 @@ EU_TAX_MAP = {
('ES', 21.0, 'IE'): 23.0,
('ES', 21.0, 'IT'): 22.0,
('ES', 21.0, 'LT'): 21.0,
('ES', 21.0, 'LU'): 17.0,
('ES', 21.0, 'LU'): 16.0,
('ES', 21.0, 'LV'): 21.0,
('ES', 21.0, 'MT'): 18.0,
('ES', 21.0, 'NL'): 21.0,
@@ -572,7 +572,7 @@ EU_TAX_MAP = {
('ES', 4.0, 'IE'): 4.8,
('ES', 4.0, 'IT'): 4.0,
('ES', 4.0, 'LT'): 5.0,
('ES', 4.0, 'LU'): 8.0,
('ES', 4.0, 'LU'): 7.0,
('ES', 4.0, 'LV'): 12.0,
('ES', 4.0, 'MT'): 5.0,
('ES', 4.0, 'NL'): 9.0,
@@ -598,7 +598,7 @@ EU_TAX_MAP = {
('FI', 10.0, 'IE'): 13.5,
('FI', 10.0, 'IT'): 4.0,
('FI', 10.0, 'LT'): 5.0,
('FI', 10.0, 'LU'): 8.0,
('FI', 10.0, 'LU'): 7.0,
('FI', 10.0, 'LV'): 12.0,
('FI', 10.0, 'MT'): 5.0,
('FI', 10.0, 'NL'): 9.0,
@@ -624,7 +624,7 @@ EU_TAX_MAP = {
('FI', 14.0, 'IE'): 13.5,
('FI', 14.0, 'IT'): 10.0,
('FI', 14.0, 'LT'): 5.0,
('FI', 14.0, 'LU'): 8.0,
('FI', 14.0, 'LU'): 7.0,
('FI', 14.0, 'LV'): 12.0,
('FI', 14.0, 'MT'): 5.0,
('FI', 14.0, 'NL'): 9.0,
@@ -650,7 +650,7 @@ EU_TAX_MAP = {
('FI', 24.0, 'IE'): 23.0,
('FI', 24.0, 'IT'): 22.0,
('FI', 24.0, 'LT'): 21.0,
('FI', 24.0, 'LU'): 17.0,
('FI', 24.0, 'LU'): 16.0,
('FI', 24.0, 'LV'): 21.0,
('FI', 24.0, 'MT'): 18.0,
('FI', 24.0, 'NL'): 21.0,
@@ -676,7 +676,7 @@ EU_TAX_MAP = {
('FR', 10.0, 'IE'): 13.5,
('FR', 10.0, 'IT'): 10.0,
('FR', 10.0, 'LT'): 5.0,
('FR', 10.0, 'LU'): 8.0,
('FR', 10.0, 'LU'): 7.0,
('FR', 10.0, 'LV'): 12.0,
('FR', 10.0, 'MT'): 5.0,
('FR', 10.0, 'NL'): 9.0,
@@ -702,7 +702,7 @@ EU_TAX_MAP = {
('FR', 2.1, 'IE'): 4.8,
('FR', 2.1, 'IT'): 4.0,
('FR', 2.1, 'LT'): 5.0,
('FR', 2.1, 'LU'): 8.0,
('FR', 2.1, 'LU'): 7.0,
('FR', 2.1, 'LV'): 12.0,
('FR', 2.1, 'MT'): 5.0,
('FR', 2.1, 'NL'): 9.0,
@@ -728,7 +728,7 @@ EU_TAX_MAP = {
('FR', 20.0, 'IE'): 23.0,
('FR', 20.0, 'IT'): 22.0,
('FR', 20.0, 'LT'): 21.0,
('FR', 20.0, 'LU'): 17.0,
('FR', 20.0, 'LU'): 16.0,
('FR', 20.0, 'LV'): 21.0,
('FR', 20.0, 'MT'): 18.0,
('FR', 20.0, 'NL'): 21.0,
@@ -754,7 +754,7 @@ EU_TAX_MAP = {
('FR', 5.5, 'IE'): 13.5,
('FR', 5.5, 'IT'): 4.0,
('FR', 5.5, 'LT'): 5.0,
('FR', 5.5, 'LU'): 8.0,
('FR', 5.5, 'LU'): 7.0,
('FR', 5.5, 'LV'): 12.0,
('FR', 5.5, 'MT'): 5.0,
('FR', 5.5, 'NL'): 9.0,
@@ -780,7 +780,7 @@ EU_TAX_MAP = {
('GR', 13.0, 'IE'): 13.5,
('GR', 13.0, 'IT'): 10.0,
('GR', 13.0, 'LT'): 5.0,
('GR', 13.0, 'LU'): 8.0,
('GR', 13.0, 'LU'): 7.0,
('GR', 13.0, 'LV'): 12.0,
('GR', 13.0, 'MT'): 5.0,
('GR', 13.0, 'NL'): 9.0,
@@ -806,7 +806,7 @@ EU_TAX_MAP = {
('GR', 24.0, 'IE'): 23.0,
('GR', 24.0, 'IT'): 22.0,
('GR', 24.0, 'LT'): 21.0,
('GR', 24.0, 'LU'): 17.0,
('GR', 24.0, 'LU'): 16.0,
('GR', 24.0, 'LV'): 21.0,
('GR', 24.0, 'MT'): 18.0,
('GR', 24.0, 'NL'): 21.0,
@@ -832,7 +832,7 @@ EU_TAX_MAP = {
('GR', 6.0, 'IE'): 13.5,
('GR', 6.0, 'IT'): 4.0,
('GR', 6.0, 'LT'): 5.0,
('GR', 6.0, 'LU'): 8.0,
('GR', 6.0, 'LU'): 7.0,
('GR', 6.0, 'LV'): 12.0,
('GR', 6.0, 'MT'): 5.0,
('GR', 6.0, 'NL'): 9.0,
@@ -858,7 +858,7 @@ EU_TAX_MAP = {
('HR', 13.0, 'IE'): 13.5,
('HR', 13.0, 'IT'): 10.0,
('HR', 13.0, 'LT'): 5.0,
('HR', 13.0, 'LU'): 8.0,
('HR', 13.0, 'LU'): 7.0,
('HR', 13.0, 'LV'): 12.0,
('HR', 13.0, 'MT'): 5.0,
('HR', 13.0, 'NL'): 9.0,
@@ -884,7 +884,7 @@ EU_TAX_MAP = {
('HR', 25.0, 'IE'): 23.0,
('HR', 25.0, 'IT'): 22.0,
('HR', 25.0, 'LT'): 21.0,
('HR', 25.0, 'LU'): 17.0,
('HR', 25.0, 'LU'): 16.0,
('HR', 25.0, 'LV'): 21.0,
('HR', 25.0, 'MT'): 18.0,
('HR', 25.0, 'NL'): 21.0,
@@ -910,7 +910,7 @@ EU_TAX_MAP = {
('HR', 5.0, 'IE'): 13.5,
('HR', 5.0, 'IT'): 4.0,
('HR', 5.0, 'LT'): 5.0,
('HR', 5.0, 'LU'): 8.0,
('HR', 5.0, 'LU'): 7.0,
('HR', 5.0, 'LV'): 12.0,
('HR', 5.0, 'MT'): 5.0,
('HR', 5.0, 'NL'): 9.0,
@@ -936,7 +936,7 @@ EU_TAX_MAP = {
('HU', 18.0, 'IE'): 13.5,
('HU', 18.0, 'IT'): 10.0,
('HU', 18.0, 'LT'): 5.0,
('HU', 18.0, 'LU'): 8.0,
('HU', 18.0, 'LU'): 7.0,
('HU', 18.0, 'LV'): 12.0,
('HU', 18.0, 'MT'): 5.0,
('HU', 18.0, 'NL'): 9.0,
@@ -962,7 +962,7 @@ EU_TAX_MAP = {
('HU', 27.0, 'IE'): 23.0,
('HU', 27.0, 'IT'): 22.0,
('HU', 27.0, 'LT'): 21.0,
('HU', 27.0, 'LU'): 17.0,
('HU', 27.0, 'LU'): 16.0,
('HU', 27.0, 'LV'): 21.0,
('HU', 27.0, 'MT'): 18.0,
('HU', 27.0, 'NL'): 21.0,
@@ -988,7 +988,7 @@ EU_TAX_MAP = {
('HU', 5.0, 'IE'): 13.5,
('HU', 5.0, 'IT'): 4.0,
('HU', 5.0, 'LT'): 5.0,
('HU', 5.0, 'LU'): 8.0,
('HU', 5.0, 'LU'): 7.0,
('HU', 5.0, 'LV'): 12.0,
('HU', 5.0, 'MT'): 5.0,
('HU', 5.0, 'NL'): 9.0,
@@ -1015,7 +1015,7 @@ EU_TAX_MAP = {
('IE', 13.5, 'IE'): 23.0,
('IE', 13.5, 'IT'): 22.0,
('IE', 13.5, 'LT'): 21.0,
('IE', 13.5, 'LU'): 17.0,
('IE', 13.5, 'LU'): 16.0,
('IE', 13.5, 'LV'): 21.0,
('IE', 13.5, 'MT'): 18.0,
('IE', 13.5, 'NL'): 21.0,
@@ -1041,7 +1041,7 @@ EU_TAX_MAP = {
('IE', 23.0, 'HU'): 27.0,
('IE', 23.0, 'IT'): 22.0,
('IE', 23.0, 'LT'): 21.0,
('IE', 23.0, 'LU'): 17.0,
('IE', 23.0, 'LU'): 16.0,
('IE', 23.0, 'LV'): 21.0,
('IE', 23.0, 'MT'): 18.0,
('IE', 23.0, 'NL'): 21.0,
@@ -1067,7 +1067,7 @@ EU_TAX_MAP = {
('IE', 4.8, 'HU'): 5.0,
('IE', 4.8, 'IT'): 4.0,
('IE', 4.8, 'LT'): 5.0,
('IE', 4.8, 'LU'): 8.0,
('IE', 4.8, 'LU'): 7.0,
('IE', 4.8, 'LV'): 12.0,
('IE', 4.8, 'MT'): 5.0,
('IE', 4.8, 'NL'): 9.0,
@@ -1093,7 +1093,7 @@ EU_TAX_MAP = {
('IE', 9.0, 'HU'): 5.0,
('IE', 9.0, 'IT'): 10.0,
('IE', 9.0, 'LT'): 5.0,
('IE', 9.0, 'LU'): 8.0,
('IE', 9.0, 'LU'): 7.0,
('IE', 9.0, 'LV'): 12.0,
('IE', 9.0, 'MT'): 5.0,
('IE', 9.0, 'NL'): 9.0,
@@ -1119,7 +1119,7 @@ EU_TAX_MAP = {
('IT', 10.0, 'HU'): 5.0,
('IT', 10.0, 'IE'): 13.5,
('IT', 10.0, 'LT'): 5.0,
('IT', 10.0, 'LU'): 8.0,
('IT', 10.0, 'LU'): 7.0,
('IT', 10.0, 'LV'): 12.0,
('IT', 10.0, 'MT'): 5.0,
('IT', 10.0, 'NL'): 9.0,
@@ -1145,7 +1145,7 @@ EU_TAX_MAP = {
('IT', 22.0, 'HU'): 27.0,
('IT', 22.0, 'IE'): 23.0,
('IT', 22.0, 'LT'): 21.0,
('IT', 22.0, 'LU'): 17.0,
('IT', 22.0, 'LU'): 16.0,
('IT', 22.0, 'LV'): 21.0,
('IT', 22.0, 'MT'): 18.0,
('IT', 22.0, 'NL'): 21.0,
@@ -1171,7 +1171,7 @@ EU_TAX_MAP = {
('IT', 4.0, 'HU'): 5.0,
('IT', 4.0, 'IE'): 4.8,
('IT', 4.0, 'LT'): 5.0,
('IT', 4.0, 'LU'): 8.0,
('IT', 4.0, 'LU'): 7.0,
('IT', 4.0, 'LV'): 12.0,
('IT', 4.0, 'MT'): 5.0,
('IT', 4.0, 'NL'): 9.0,
@@ -1197,7 +1197,7 @@ EU_TAX_MAP = {
('IT', 5.0, 'HU'): 5.0,
('IT', 5.0, 'IE'): 13.5,
('IT', 5.0, 'LT'): 5.0,
('IT', 5.0, 'LU'): 8.0,
('IT', 5.0, 'LU'): 7.0,
('IT', 5.0, 'LV'): 12.0,
('IT', 5.0, 'MT'): 5.0,
('IT', 5.0, 'NL'): 9.0,
@@ -1223,7 +1223,7 @@ EU_TAX_MAP = {
('LT', 21.0, 'HU'): 27.0,
('LT', 21.0, 'IE'): 23.0,
('LT', 21.0, 'IT'): 22.0,
('LT', 21.0, 'LU'): 17.0,
('LT', 21.0, 'LU'): 16.0,
('LT', 21.0, 'LV'): 21.0,
('LT', 21.0, 'MT'): 18.0,
('LT', 21.0, 'NL'): 21.0,
@@ -1249,7 +1249,7 @@ EU_TAX_MAP = {
('LT', 5.0, 'HU'): 5.0,
('LT', 5.0, 'IE'): 13.5,
('LT', 5.0, 'IT'): 4.0,
('LT', 5.0, 'LU'): 8.0,
('LT', 5.0, 'LU'): 7.0,
('LT', 5.0, 'LV'): 12.0,
('LT', 5.0, 'MT'): 5.0,
('LT', 5.0, 'NL'): 9.0,
@@ -1275,7 +1275,7 @@ EU_TAX_MAP = {
('LT', 9.0, 'HU'): 5.0,
('LT', 9.0, 'IE'): 13.5,
('LT', 9.0, 'IT'): 10.0,
('LT', 9.0, 'LU'): 8.0,
('LT', 9.0, 'LU'): 7.0,
('LT', 9.0, 'LV'): 12.0,
('LT', 9.0, 'MT'): 5.0,
('LT', 9.0, 'NL'): 9.0,
@@ -1285,6 +1285,32 @@ EU_TAX_MAP = {
('LT', 9.0, 'SE'): 6.0,
('LT', 9.0, 'SI'): 9.5,
('LT', 9.0, 'SK'): 10.0,
('LU', 13.0, 'AT'): 20.0,
('LU', 13.0, 'BE'): 21.0,
('LU', 13.0, 'BG'): 20.0,
('LU', 13.0, 'CY'): 19.0,
('LU', 13.0, 'CZ'): 21.0,
('LU', 13.0, 'DE'): 19.0,
('LU', 13.0, 'DK'): 25.0,
('LU', 13.0, 'EE'): 20.0,
('LU', 13.0, 'ES'): 21.0,
('LU', 13.0, 'FI'): 24.0,
('LU', 13.0, 'FR'): 20.0,
('LU', 13.0, 'GR'): 24.0,
('LU', 13.0, 'HR'): 25.0,
('LU', 13.0, 'HU'): 27.0,
('LU', 13.0, 'IE'): 23.0,
('LU', 13.0, 'IT'): 22.0,
('LU', 13.0, 'LT'): 21.0,
('LU', 13.0, 'LV'): 21.0,
('LU', 13.0, 'MT'): 18.0,
('LU', 13.0, 'NL'): 21.0,
('LU', 13.0, 'PL'): 23.0,
('LU', 13.0, 'PT'): 23.0,
('LU', 13.0, 'RO'): 21.0,
('LU', 13.0, 'SE'): 18.0,
('LU', 13.0, 'SI'): 21.0,
('LU', 13.0, 'SK'): 23.0,
('LU', 14.0, 'AT'): 20.0,
('LU', 14.0, 'BE'): 21.0,
('LU', 14.0, 'BG'): 20.0,
@@ -1311,6 +1337,32 @@ EU_TAX_MAP = {
('LU', 14.0, 'SE'): 18.0,
('LU', 14.0, 'SI'): 21.0,
('LU', 14.0, 'SK'): 23.0,
('LU', 16.0, 'AT'): 20.0,
('LU', 16.0, 'BE'): 21.0,
('LU', 16.0, 'BG'): 20.0,
('LU', 16.0, 'CY'): 19.0,
('LU', 16.0, 'CZ'): 21.0,
('LU', 16.0, 'DE'): 19.0,
('LU', 16.0, 'DK'): 25.0,
('LU', 16.0, 'EE'): 20.0,
('LU', 16.0, 'ES'): 21.0,
('LU', 16.0, 'FI'): 24.0,
('LU', 16.0, 'FR'): 20.0,
('LU', 16.0, 'GR'): 24.0,
('LU', 16.0, 'HR'): 25.0,
('LU', 16.0, 'HU'): 27.0,
('LU', 16.0, 'IE'): 23.0,
('LU', 16.0, 'IT'): 22.0,
('LU', 16.0, 'LT'): 21.0,
('LU', 16.0, 'LV'): 21.0,
('LU', 16.0, 'MT'): 18.0,
('LU', 16.0, 'NL'): 21.0,
('LU', 16.0, 'PL'): 23.0,
('LU', 16.0, 'PT'): 23.0,
('LU', 16.0, 'RO'): 19.0,
('LU', 16.0, 'SE'): 25.0,
('LU', 16.0, 'SI'): 22.0,
('LU', 16.0, 'SK'): 20.0,
('LU', 17.0, 'AT'): 20.0,
('LU', 17.0, 'BE'): 21.0,
('LU', 17.0, 'BG'): 20.0,
@@ -1363,6 +1415,32 @@ EU_TAX_MAP = {
('LU', 3.0, 'SE'): 6.0,
('LU', 3.0, 'SI'): 9.5,
('LU', 3.0, 'SK'): 10.0,
('LU', 7.0, 'AT'): 10.0,
('LU', 7.0, 'BE'): 6.0,
('LU', 7.0, 'BG'): 20.0,
('LU', 7.0, 'CY'): 5.0,
('LU', 7.0, 'CZ'): 15.0,
('LU', 7.0, 'DE'): 7.0,
('LU', 7.0, 'DK'): 25.0,
('LU', 7.0, 'EE'): 9.0,
('LU', 7.0, 'ES'): 10.0,
('LU', 7.0, 'FI'): 10.0,
('LU', 7.0, 'FR'): 5.5,
('LU', 7.0, 'GR'): 13.0,
('LU', 7.0, 'HR'): 5.0,
('LU', 7.0, 'HU'): 5.0,
('LU', 7.0, 'IE'): 13.5,
('LU', 7.0, 'IT'): 10.0,
('LU', 7.0, 'LT'): 5.0,
('LU', 7.0, 'LV'): 12.0,
('LU', 7.0, 'MT'): 5.0,
('LU', 7.0, 'NL'): 9.0,
('LU', 7.0, 'PL'): 7.0,
('LU', 7.0, 'PT'): 6.0,
('LU', 7.0, 'RO'): 5.0,
('LU', 7.0, 'SE'): 6.0,
('LU', 7.0, 'SI'): 9.5,
('LU', 7.0, 'SK'): 10.0,
('LU', 8.0, 'AT'): 10.0,
('LU', 8.0, 'BE'): 6.0,
('LU', 8.0, 'BG'): 20.0,
@@ -1406,7 +1484,7 @@ EU_TAX_MAP = {
('LV', 12.0, 'IE'): 13.5,
('LV', 12.0, 'IT'): 10.0,
('LV', 12.0, 'LT'): 5.0,
('LV', 12.0, 'LU'): 8.0,
('LV', 12.0, 'LU'): 7.0,
('LV', 12.0, 'MT'): 5.0,
('LV', 12.0, 'NL'): 9.0,
('LV', 12.0, 'PL'): 8.0,
@@ -1432,7 +1510,7 @@ EU_TAX_MAP = {
('LV', 21.0, 'IE'): 23.0,
('LV', 21.0, 'IT'): 22.0,
('LV', 21.0, 'LT'): 21.0,
('LV', 21.0, 'LU'): 17.0,
('LV', 21.0, 'LU'): 16.0,
('LV', 21.0, 'MT'): 18.0,
('LV', 21.0, 'NL'): 21.0,
('LV', 21.0, 'PL'): 23.0,
@@ -1458,7 +1536,7 @@ EU_TAX_MAP = {
('LV', 5.0, 'IE'): 13.5,
('LV', 5.0, 'IT'): 4.0,
('LV', 5.0, 'LT'): 5.0,
('LV', 5.0, 'LU'): 8.0,
('LV', 5.0, 'LU'): 7.0,
('LV', 5.0, 'MT'): 5.0,
('LV', 5.0, 'NL'): 9.0,
('LV', 5.0, 'PL'): 8.0,
@@ -1484,7 +1562,7 @@ EU_TAX_MAP = {
('MT', 18.0, 'IE'): 23.0,
('MT', 18.0, 'IT'): 22.0,
('MT', 18.0, 'LT'): 21.0,
('MT', 18.0, 'LU'): 17.0,
('MT', 18.0, 'LU'): 16.0,
('MT', 18.0, 'LV'): 21.0,
('MT', 18.0, 'NL'): 21.0,
('MT', 18.0, 'PL'): 23.0,
@@ -1510,7 +1588,7 @@ EU_TAX_MAP = {
('MT', 5.0, 'IE'): 13.5,
('MT', 5.0, 'IT'): 4.0,
('MT', 5.0, 'LT'): 5.0,
('MT', 5.0, 'LU'): 8.0,
('MT', 5.0, 'LU'): 7.0,
('MT', 5.0, 'LV'): 12.0,
('MT', 5.0, 'NL'): 9.0,
('MT', 5.0, 'PL'): 8.0,
@@ -1536,7 +1614,7 @@ EU_TAX_MAP = {
('MT', 7.0, 'IE'): 13.5,
('MT', 7.0, 'IT'): 10.0,
('MT', 7.0, 'LT'): 5.0,
('MT', 7.0, 'LU'): 8.0,
('MT', 7.0, 'LU'): 7.0,
('MT', 7.0, 'LV'): 12.0,
('MT', 7.0, 'NL'): 9.0,
('MT', 7.0, 'PL'): 8.0,
@@ -1562,7 +1640,7 @@ EU_TAX_MAP = {
('NL', 21.0, 'IE'): 23.0,
('NL', 21.0, 'IT'): 22.0,
('NL', 21.0, 'LT'): 21.0,
('NL', 21.0, 'LU'): 17.0,
('NL', 21.0, 'LU'): 16.0,
('NL', 21.0, 'LV'): 21.0,
('NL', 21.0, 'MT'): 18.0,
('NL', 21.0, 'PL'): 23.0,
@@ -1588,7 +1666,7 @@ EU_TAX_MAP = {
('NL', 9.0, 'IE'): 13.5,
('NL', 9.0, 'IT'): 4.0,
('NL', 9.0, 'LT'): 5.0,
('NL', 9.0, 'LU'): 8.0,
('NL', 9.0, 'LU'): 7.0,
('NL', 9.0, 'LV'): 12.0,
('NL', 9.0, 'MT'): 5.0,
('NL', 9.0, 'PL'): 8.0,
@@ -1614,7 +1692,7 @@ EU_TAX_MAP = {
('PL', 23.0, 'IE'): 23.0,
('PL', 23.0, 'IT'): 22.0,
('PL', 23.0, 'LT'): 21.0,
('PL', 23.0, 'LU'): 17.0,
('PL', 23.0, 'LU'): 16.0,
('PL', 23.0, 'LV'): 21.0,
('PL', 23.0, 'MT'): 18.0,
('PL', 23.0, 'NL'): 21.0,
@@ -1640,7 +1718,7 @@ EU_TAX_MAP = {
('PL', 5.0, 'IE'): 13.5,
('PL', 5.0, 'IT'): 4.0,
('PL', 5.0, 'LT'): 5.0,
('PL', 5.0, 'LU'): 8.0,
('PL', 5.0, 'LU'): 7.0,
('PL', 5.0, 'LV'): 12.0,
('PL', 5.0, 'MT'): 5.0,
('PL', 5.0, 'NL'): 9.0,
@@ -1666,7 +1744,7 @@ EU_TAX_MAP = {
('PL', 8.0, 'IE'): 13.5,
('PL', 8.0, 'IT'): 10.0,
('PL', 8.0, 'LT'): 5.0,
('PL', 8.0, 'LU'): 8.0,
('PL', 8.0, 'LU'): 7.0,
('PL', 8.0, 'LV'): 12.0,
('PL', 8.0, 'MT'): 5.0,
('PL', 8.0, 'NL'): 9.0,
@@ -1692,7 +1770,7 @@ EU_TAX_MAP = {
('PT', 13.0, 'IE'): 23.0,
('PT', 13.0, 'IT'): 22.0,
('PT', 13.0, 'LT'): 21.0,
('PT', 13.0, 'LU'): 17.0,
('PT', 13.0, 'LU'): 16.0,
('PT', 13.0, 'LV'): 21.0,
('PT', 13.0, 'MT'): 18.0,
('PT', 13.0, 'NL'): 21.0,
@@ -1718,7 +1796,7 @@ EU_TAX_MAP = {
('PT', 23.0, 'IE'): 23.0,
('PT', 23.0, 'IT'): 22.0,
('PT', 23.0, 'LT'): 21.0,
('PT', 23.0, 'LU'): 17.0,
('PT', 23.0, 'LU'): 16.0,
('PT', 23.0, 'LV'): 21.0,
('PT', 23.0, 'MT'): 18.0,
('PT', 23.0, 'NL'): 21.0,
@@ -1744,7 +1822,7 @@ EU_TAX_MAP = {
('PT', 6.0, 'IE'): 13.5,
('PT', 6.0, 'IT'): 4.0,
('PT', 6.0, 'LT'): 5.0,
('PT', 6.0, 'LU'): 8.0,
('PT', 6.0, 'LU'): 7.0,
('PT', 6.0, 'LV'): 12.0,
('PT', 6.0, 'MT'): 5.0,
('PT', 6.0, 'NL'): 9.0,
@@ -1770,7 +1848,7 @@ EU_TAX_MAP = {
('RO', 19.0, 'IE'): 23.0,
('RO', 19.0, 'IT'): 22.0,
('RO', 19.0, 'LT'): 21.0,
('RO', 19.0, 'LU'): 17.0,
('RO', 19.0, 'LU'): 16.0,
('RO', 19.0, 'LV'): 21.0,
('RO', 19.0, 'MT'): 18.0,
('RO', 19.0, 'NL'): 21.0,
@@ -1796,7 +1874,7 @@ EU_TAX_MAP = {
('RO', 5.0, 'IE'): 13.5,
('RO', 5.0, 'IT'): 4.0,
('RO', 5.0, 'LT'): 5.0,
('RO', 5.0, 'LU'): 8.0,
('RO', 5.0, 'LU'): 7.0,
('RO', 5.0, 'LV'): 12.0,
('RO', 5.0, 'MT'): 5.0,
('RO', 5.0, 'NL'): 9.0,
@@ -1822,7 +1900,7 @@ EU_TAX_MAP = {
('RO', 9.0, 'IE'): 13.5,
('RO', 9.0, 'IT'): 10.0,
('RO', 9.0, 'LT'): 5.0,
('RO', 9.0, 'LU'): 8.0,
('RO', 9.0, 'LU'): 7.0,
('RO', 9.0, 'LV'): 12.0,
('RO', 9.0, 'MT'): 5.0,
('RO', 9.0, 'NL'): 9.0,
@@ -1848,7 +1926,7 @@ EU_TAX_MAP = {
('SE', 12.0, 'IE'): 13.5,
('SE', 12.0, 'IT'): 10.0,
('SE', 12.0, 'LT'): 5.0,
('SE', 12.0, 'LU'): 8.0,
('SE', 12.0, 'LU'): 7.0,
('SE', 12.0, 'LV'): 12.0,
('SE', 12.0, 'MT'): 5.0,
('SE', 12.0, 'NL'): 9.0,
@@ -1874,7 +1952,7 @@ EU_TAX_MAP = {
('SE', 25.0, 'IE'): 23.0,
('SE', 25.0, 'IT'): 22.0,
('SE', 25.0, 'LT'): 21.0,
('SE', 25.0, 'LU'): 17.0,
('SE', 25.0, 'LU'): 16.0,
('SE', 25.0, 'LV'): 21.0,
('SE', 25.0, 'MT'): 18.0,
('SE', 25.0, 'NL'): 21.0,
@@ -1900,7 +1978,7 @@ EU_TAX_MAP = {
('SE', 6.0, 'IE'): 13.5,
('SE', 6.0, 'IT'): 4.0,
('SE', 6.0, 'LT'): 5.0,
('SE', 6.0, 'LU'): 8.0,
('SE', 6.0, 'LU'): 7.0,
('SE', 6.0, 'LV'): 12.0,
('SE', 6.0, 'MT'): 5.0,
('SE', 6.0, 'NL'): 9.0,
@@ -1926,7 +2004,7 @@ EU_TAX_MAP = {
('SI', 22.0, 'IE'): 23.0,
('SI', 22.0, 'IT'): 22.0,
('SI', 22.0, 'LT'): 21.0,
('SI', 22.0, 'LU'): 17.0,
('SI', 22.0, 'LU'): 16.0,
('SI', 22.0, 'LV'): 21.0,
('SI', 22.0, 'MT'): 18.0,
('SI', 22.0, 'NL'): 21.0,
@@ -1952,7 +2030,7 @@ EU_TAX_MAP = {
('SI', 5.0, 'IE'): 13.5,
('SI', 5.0, 'IT'): 4.0,
('SI', 5.0, 'LT'): 5.0,
('SI', 5.0, 'LU'): 8.0,
('SI', 5.0, 'LU'): 7.0,
('SI', 5.0, 'LV'): 12.0,
('SI', 5.0, 'MT'): 5.0,
('SI', 5.0, 'NL'): 9.0,
@@ -1978,7 +2056,7 @@ EU_TAX_MAP = {
('SI', 9.5, 'IE'): 13.5,
('SI', 9.5, 'IT'): 10.0,
('SI', 9.5, 'LT'): 5.0,
('SI', 9.5, 'LU'): 8.0,
('SI', 9.5, 'LU'): 7.0,
('SI', 9.5, 'LV'): 12.0,
('SI', 9.5, 'MT'): 5.0,
('SI', 9.5, 'NL'): 9.0,
@@ -2004,7 +2082,7 @@ EU_TAX_MAP = {
('SK', 10.0, 'IE'): 13.5,
('SK', 10.0, 'IT'): 4.0,
('SK', 10.0, 'LT'): 5.0,
('SK', 10.0, 'LU'): 8.0,
('SK', 10.0, 'LU'): 7.0,
('SK', 10.0, 'LV'): 12.0,
('SK', 10.0, 'MT'): 5.0,
('SK', 10.0, 'NL'): 9.0,
@@ -2030,7 +2108,7 @@ EU_TAX_MAP = {
('SK', 20.0, 'IE'): 23.0,
('SK', 20.0, 'IT'): 22.0,
('SK', 20.0, 'LT'): 21.0,
('SK', 20.0, 'LU'): 17.0,
('SK', 20.0, 'LU'): 16.0,
('SK', 20.0, 'LV'): 21.0,
('SK', 20.0, 'MT'): 18.0,
('SK', 20.0, 'NL'): 21.0,

View File

@@ -110,14 +110,10 @@ class PurchaseOrderLine(models.Model):
_inherit = 'purchase.order.line'
def _compute_account_analytic_id(self):
for rec in self:
if not rec.order_id.requisition_id:
super(PurchaseOrderLine, self)._compute_account_analytic_id()
super(PurchaseOrderLine, self.filtered(lambda pol: not pol.order_id.requisition_id))._compute_account_analytic_id()
def _compute_analytic_tag_ids(self):
for rec in self:
if not rec.order_id.requisition_id:
super(PurchaseOrderLine, self)._compute_analytic_tag_ids()
super(PurchaseOrderLine, self.filtered(lambda pol: not pol.order_id.requisition_id))._compute_analytic_tag_ids()
@api.onchange('product_qty', 'product_uom')
def _onchange_quantity(self):

View File

@@ -100,6 +100,13 @@ class StockMove(models.Model):
vals['purchase_line_id'] = self.purchase_line_id.id
return vals
def _prepare_procurement_values(self):
proc_values = super()._prepare_procurement_values()
if self.restrict_partner_id:
proc_values['supplierinfo_name'] = self.restrict_partner_id
self.restrict_partner_id = False
return proc_values
def _clean_merged(self):
super(StockMove, self)._clean_merged()
self.write({'created_purchase_line_id': False})

View File

@@ -324,3 +324,12 @@ class StockRule(models.Model):
res = super(StockRule, self)._push_prepare_move_copy_values(move_to_copy, new_date)
res['purchase_line_id'] = None
return res
def _get_stock_move_values(self, product_id, product_qty, product_uom, location_id, name, origin, company_id, values):
move_values = super()._get_stock_move_values(product_id, product_qty, product_uom, location_id, name, origin, company_id, values)
if values.get('supplierinfo_name'):
move_values['restrict_partner_id'] = values['supplierinfo_name'].id
elif values.get('supplierinfo_id'):
partner = values['supplierinfo_id'].name
move_values['restrict_partner_id'] = partner.id
return move_values

View File

@@ -20,7 +20,7 @@ class Digest(models.Model):
('date', '>=', start),
('date', '<', end),
('state', 'not in', ['draft', 'cancel', 'sent']),
('company_id', '=', company.id)], ['price_total'], ['price_total'])
('company_id', '=', company.id)], ['price_total'], ['company_id'])
record.kpi_all_sale_total_value = sum([channel_sale['price_total'] for channel_sale in all_channels_sales])
def _compute_kpis_actions(self, company, user):

View File

@@ -188,11 +188,11 @@ class ProductProduct(models.Model):
'unit_cost': self.standard_price,
'quantity': quantity,
}
if self.cost_method in ('average', 'fifo'):
if self.product_tmpl_id.cost_method in ('average', 'fifo'):
fifo_vals = self._run_fifo(abs(quantity), company)
vals['remaining_qty'] = fifo_vals.get('remaining_qty')
# In case of AVCO, fix rounding issue of standard price when needed.
if self.cost_method == 'average':
if self.product_tmpl_id.cost_method == 'average':
rounding_error = currency.round(self.standard_price * self.quantity_svl - self.value_svl)
if rounding_error:
# If it is bigger than the (smallest number of the currency * quantity) / 2,
@@ -204,7 +204,7 @@ class ProductProduct(models.Model):
float_repr(rounding_error, precision_digits=currency.decimal_places),
currency.symbol
)
if self.cost_method == 'fifo':
if self.product_tmpl_id.cost_method == 'fifo':
vals.update(fifo_vals)
return vals

View File

@@ -19,7 +19,7 @@ from flectra.addons.event.controllers.main import EventController
from flectra.http import request
from flectra.osv import expression
from flectra.tools.misc import get_lang, format_date
from flectra.exceptions import UserError
class WebsiteEventController(http.Controller):
@@ -322,6 +322,9 @@ class WebsiteEventController(http.Controller):
"""
allowed_fields = request.env['event.registration']._get_website_registration_allowed_fields()
registration_fields = {key: v for key, v in request.env['event.registration']._fields.items() if key in allowed_fields}
for ticket_id in list(filter(lambda x: x is not None, [form_details[field] if 'event_ticket_id' in field else None for field in form_details.keys()])):
if int(ticket_id) not in event.event_ticket_ids.ids and len(event.event_ticket_ids.ids) > 0:
raise UserError(_("This ticket is not available for sale for this event"))
registrations = {}
global_values = {}
for key, value in form_details.items():

View File

@@ -44,16 +44,26 @@ class TestEventData(TestEventQuestionCommon):
'date_begin': FieldsDatetime.to_string(datetime.today() + timedelta(days=1)),
'date_end': FieldsDatetime.to_string(datetime.today() + timedelta(days=15)),
})
ticket_id_1 = self.env['event.event.ticket'].create([{
'name': 'Regular',
'event_id': event.id,
'seats_max': 200,
}])
ticket_id_2 = self.env['event.event.ticket'].create([{
'name': 'VIP',
'event_id': event.id,
'seats_max': 200,
}])
form_details = {
'1-name': 'Pixis',
'1-email': 'pixis@gmail.com',
'1-phone': '+32444444444',
'1-event_ticket_id': '2',
'1-event_ticket_id': ticket_id_1.id,
'2-name': 'Geluchat',
'2-email': 'geluchat@gmail.com',
'2-phone': '+32777777777',
'2-event_ticket_id': '3',
'2-event_ticket_id': ticket_id_2.id,
'question_answer-1-%s' % self.event_question_1.id: '5',
'question_answer-2-%s' % self.event_question_1.id: '9',
'question_answer-0-%s' % self.event_question_2.id: '7',
@@ -64,12 +74,12 @@ class TestEventData(TestEventQuestionCommon):
registrations = WebsiteEvent()._process_attendees_form(event, form_details)
self.assertEqual(registrations, [
{'name': 'Pixis', 'email': 'pixis@gmail.com', 'phone': '+32444444444', 'event_ticket_id': 2,
{'name': 'Pixis', 'email': 'pixis@gmail.com', 'phone': '+32444444444', 'event_ticket_id': ticket_id_1.id,
'registration_answer_ids': [
(0, 0, {'question_id': self.event_question_1.id, 'value_answer_id': 5}),
(0, 0, {'question_id': self.event_question_2.id, 'value_answer_id': 7}),
(0, 0, {'question_id': self.event_question_3.id, 'value_text_box': 'Free Text'})]},
{'name': 'Geluchat', 'email': 'geluchat@gmail.com', 'phone': '+32777777777', 'event_ticket_id': 3,
{'name': 'Geluchat', 'email': 'geluchat@gmail.com', 'phone': '+32777777777', 'event_ticket_id': ticket_id_2.id,
'registration_answer_ids': [
(0, 0, {'question_id': self.event_question_1.id, 'value_answer_id': 9}),
(0, 0, {'question_id': self.event_question_2.id, 'value_answer_id': 7}),