mirror of
https://github.com/OCA/intrastat-extrastat.git
synced 2025-02-16 17:13:41 +02:00
[FIX] intrastat_base: this week's ci errors + wrong variable name
This commit is contained in:
committed by
Alexis de Lattre
parent
59a3934f59
commit
863da64b04
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Intrastat Reporting Base',
|
'name': 'Intrastat Reporting Base',
|
||||||
'version': '1.2',
|
'version': '8.0.1.2.0',
|
||||||
'category': 'Intrastat',
|
'category': 'Intrastat',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
'summary': 'Base module for Intrastat reporting',
|
'summary': 'Base module for Intrastat reporting',
|
||||||
|
|||||||
@@ -32,39 +32,43 @@ class IntrastatCommon(models.AbstractModel):
|
|||||||
_description = "Common functions for intrastat reports for products "
|
_description = "Common functions for intrastat reports for products "
|
||||||
"and services"
|
"and services"
|
||||||
|
|
||||||
@api.one
|
@api.multi
|
||||||
@api.depends('declaration_line_ids.amount_company_currency')
|
@api.depends('declaration_line_ids.amount_company_currency')
|
||||||
def _compute_numbers(self):
|
def _compute_numbers(self):
|
||||||
total_amount = 0 # it is an integer
|
for this in self:
|
||||||
num_lines = 0
|
total_amount = 0 # it is an integer
|
||||||
for line in self.declaration_line_ids:
|
num_lines = 0
|
||||||
total_amount += line.amount_company_currency
|
for line in this.declaration_line_ids:
|
||||||
num_lines += 1
|
total_amount += line.amount_company_currency
|
||||||
self.num_decl_lines = num_lines
|
num_lines += 1
|
||||||
self.total_amount = total_amount
|
this.num_decl_lines = num_lines
|
||||||
|
this.total_amount = total_amount
|
||||||
|
|
||||||
@api.one
|
@api.multi
|
||||||
def _check_generate_lines(self):
|
def _check_generate_lines(self):
|
||||||
"""Check wether all requirements are met for generating lines."""
|
"""Check wether all requirements are met for generating lines."""
|
||||||
if not self.company_id:
|
for this in self:
|
||||||
raise UserError(_("Company not yet set on intrastat report."))
|
if not this.company_id:
|
||||||
company_obj = self.company_id
|
raise UserError(_("Company not yet set on intrastat report."))
|
||||||
if not company_obj.country_id:
|
company = this.company_id
|
||||||
raise UserError(
|
if not company.country_id:
|
||||||
_("The country is not set on the company '%s'.")
|
raise UserError(
|
||||||
% company_obj.name)
|
_("The country is not set on the company '%s'.")
|
||||||
if company_obj.currency_id.name != 'EUR':
|
% company.name)
|
||||||
raise UserError(
|
if company.currency_id.name != 'EUR':
|
||||||
_("The company currency must be 'EUR', but is currently '%s'.")
|
raise UserError(
|
||||||
% company_obj.currency_id.name)
|
_("The company currency must be 'EUR', but is currently "
|
||||||
|
"'%s'.")
|
||||||
|
% company.currency_id.name)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@api.one
|
@api.multi
|
||||||
def _check_generate_xml(self):
|
def _check_generate_xml(self):
|
||||||
if not self.company_id.partner_id.vat:
|
for this in self:
|
||||||
raise UserError(
|
if not this.company_id.partner_id.vat:
|
||||||
_("The VAT number is not set for the partner '%s'.")
|
raise UserError(
|
||||||
% self.company_id.partner_id.name)
|
_("The VAT number is not set for the partner '%s'.")
|
||||||
|
% this.company_id.partner_id.name)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
@@ -146,18 +150,19 @@ class IntrastatCommon(models.AbstractModel):
|
|||||||
"""
|
"""
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@api.one
|
@api.multi
|
||||||
def send_reminder_email(self, mail_template_xmlid):
|
def send_reminder_email(self, mail_template_xmlid):
|
||||||
mail_template = self.env.ref(mail_template_xmlid)
|
mail_template = self.env.ref(mail_template_xmlid)
|
||||||
if self.company_id.intrastat_remind_user_ids:
|
for this in self:
|
||||||
mail_template.send_mail(self.id)
|
if this.company_id.intrastat_remind_user_ids:
|
||||||
logger.info(
|
mail_template.send_mail(this.id)
|
||||||
'Intrastat Reminder email has been sent (XMLID: %s).'
|
logger.info(
|
||||||
% mail_template_xmlid)
|
'Intrastat Reminder email has been sent (XMLID: %s).'
|
||||||
else:
|
% mail_template_xmlid)
|
||||||
logger.warning(
|
else:
|
||||||
'The list of users receiving the Intrastat Reminder is empty '
|
logger.warning(
|
||||||
'on company %s' % self.company_id.name)
|
'The list of users receiving the Intrastat Reminder is '
|
||||||
|
'empty on company %s' % this.company_id.name)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
|
|||||||
@@ -33,13 +33,14 @@ class ProductTemplate(models.Model):
|
|||||||
"costs and all services related to the sale of products. "
|
"costs and all services related to the sale of products. "
|
||||||
"This option is used for Intrastat reports.")
|
"This option is used for Intrastat reports.")
|
||||||
|
|
||||||
@api.one
|
@api.multi
|
||||||
@api.constrains('type', 'is_accessory_cost')
|
@api.constrains('type', 'is_accessory_cost')
|
||||||
def _check_accessory_cost(self):
|
def _check_accessory_cost(self):
|
||||||
if self.is_accessory_cost and self.type != 'service':
|
for this in self:
|
||||||
raise ValidationError(
|
if this.is_accessory_cost and this.type != 'service':
|
||||||
_("The option 'Is accessory cost?' should only be "
|
raise ValidationError(
|
||||||
"activated on 'Service' products. You have activated "
|
_("The option 'Is accessory cost?' should only be "
|
||||||
"this option for the product '%s' which is of type "
|
"activated on 'Service' products. You have activated "
|
||||||
"'%s'"
|
"this option for the product '%s' which is of type "
|
||||||
% (self.name, self.type)))
|
"'%s'") %
|
||||||
|
(this.name, this.type))
|
||||||
|
|||||||
@@ -36,21 +36,23 @@ class ResCompany(models.Model):
|
|||||||
compute='_compute_intrastat_email_list',
|
compute='_compute_intrastat_email_list',
|
||||||
string='List of emails of Users Receiving the Intrastat Reminder')
|
string='List of emails of Users Receiving the Intrastat Reminder')
|
||||||
|
|
||||||
@api.one
|
@api.multi
|
||||||
@api.depends(
|
@api.depends(
|
||||||
'intrastat_remind_user_ids', 'intrastat_remind_user_ids.email')
|
'intrastat_remind_user_ids', 'intrastat_remind_user_ids.email')
|
||||||
def _compute_intrastat_email_list(self):
|
def _compute_intrastat_email_list(self):
|
||||||
emails = []
|
for this in self:
|
||||||
for user in self.intrastat_remind_user_ids:
|
emails = []
|
||||||
if user.email:
|
for user in this.intrastat_remind_user_ids:
|
||||||
emails.append(user.email)
|
if user.email:
|
||||||
self.intrastat_email_list = ','.join(emails)
|
emails.append(user.email)
|
||||||
|
this.intrastat_email_list = ','.join(emails)
|
||||||
|
|
||||||
@api.one
|
@api.multi
|
||||||
@api.constrains('intrastat_remind_user_ids')
|
@api.constrains('intrastat_remind_user_ids')
|
||||||
def _check_intrastat_remind_users(self):
|
def _check_intrastat_remind_users(self):
|
||||||
for user in self.intrastat_remind_user_ids:
|
for this in self:
|
||||||
if not user.email:
|
for user in this.intrastat_remind_user_ids:
|
||||||
raise ValidationError(
|
if not user.email:
|
||||||
_("Missing e-mail address on user '%s'.")
|
raise ValidationError(
|
||||||
% (user.name))
|
_("Missing e-mail address on user '%s'.") %
|
||||||
|
(user.name))
|
||||||
|
|||||||
Reference in New Issue
Block a user