mirror of
https://github.com/OCA/intrastat-extrastat.git
synced 2025-02-16 17:13:41 +02:00
this week's ci errors
This commit is contained in:
committed by
Alexis de Lattre
parent
1cf720e20b
commit
a2b57cef5a
@@ -22,7 +22,7 @@
|
||||
|
||||
{
|
||||
'name': 'Intrastat Reporting Base',
|
||||
'version': '1.2',
|
||||
'version': '8.0.1.2.0',
|
||||
'category': 'Intrastat',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Base module for Intrastat reporting',
|
||||
|
||||
@@ -32,39 +32,43 @@ class IntrastatCommon(models.AbstractModel):
|
||||
_description = "Common functions for intrastat reports for products "
|
||||
"and services"
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
@api.depends('declaration_line_ids.amount_company_currency')
|
||||
def _compute_numbers(self):
|
||||
total_amount = 0 # it is an integer
|
||||
num_lines = 0
|
||||
for line in self.declaration_line_ids:
|
||||
total_amount += line.amount_company_currency
|
||||
num_lines += 1
|
||||
self.num_decl_lines = num_lines
|
||||
self.total_amount = total_amount
|
||||
for this in self:
|
||||
total_amount = 0 # it is an integer
|
||||
num_lines = 0
|
||||
for line in this.declaration_line_ids:
|
||||
total_amount += line.amount_company_currency
|
||||
num_lines += 1
|
||||
this.num_decl_lines = num_lines
|
||||
this.total_amount = total_amount
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
def _check_generate_lines(self):
|
||||
"""Check wether all requirements are met for generating lines."""
|
||||
if not self.company_id:
|
||||
raise UserError(_("Company not yet set on intrastat report."))
|
||||
company_obj = self.company_id
|
||||
if not company_obj.country_id:
|
||||
raise UserError(
|
||||
_("The country is not set on the company '%s'.")
|
||||
% company_obj.name)
|
||||
if company_obj.currency_id.name != 'EUR':
|
||||
raise UserError(
|
||||
_("The company currency must be 'EUR', but is currently '%s'.")
|
||||
% company_obj.currency_id.name)
|
||||
for this in self:
|
||||
if not this.company_id:
|
||||
raise UserError(_("Company not yet set on intrastat report."))
|
||||
company = this.company_id
|
||||
if not company.country_id:
|
||||
raise UserError(
|
||||
_("The country is not set on the company '%s'.")
|
||||
% company.name)
|
||||
if company.currency_id.name != 'EUR':
|
||||
raise UserError(
|
||||
_("The company currency must be 'EUR', but is currently "
|
||||
"'%s'.")
|
||||
% company.currency_id.name)
|
||||
return True
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
def _check_generate_xml(self):
|
||||
if not self.company_id.partner_id.vat:
|
||||
raise UserError(
|
||||
_("The VAT number is not set for the partner '%s'.")
|
||||
% self.company_id.partner_id.name)
|
||||
for this in self:
|
||||
if not this.company_id.partner_id.vat:
|
||||
raise UserError(
|
||||
_("The VAT number is not set for the partner '%s'.")
|
||||
% this.company_id.partner_id.name)
|
||||
return True
|
||||
|
||||
@api.model
|
||||
@@ -146,18 +150,19 @@ class IntrastatCommon(models.AbstractModel):
|
||||
"""
|
||||
return False
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
def send_reminder_email(self, mail_template_xmlid):
|
||||
mail_template = self.env.ref(mail_template_xmlid)
|
||||
if self.company_id.intrastat_remind_user_ids:
|
||||
mail_template.send_mail(self.id)
|
||||
logger.info(
|
||||
'Intrastat Reminder email has been sent (XMLID: %s).'
|
||||
% mail_template_xmlid)
|
||||
else:
|
||||
logger.warning(
|
||||
'The list of users receiving the Intrastat Reminder is empty '
|
||||
'on company %s' % self.company_id.name)
|
||||
for this in self:
|
||||
if this.company_id.intrastat_remind_user_ids:
|
||||
mail_template.send_mail(this.id)
|
||||
logger.info(
|
||||
'Intrastat Reminder email has been sent (XMLID: %s).'
|
||||
% mail_template_xmlid)
|
||||
else:
|
||||
logger.warning(
|
||||
'The list of users receiving the Intrastat Reminder is '
|
||||
'empty on company %s' % this.company_id.name)
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
@@ -33,13 +33,14 @@ class ProductTemplate(models.Model):
|
||||
"costs and all services related to the sale of products. "
|
||||
"This option is used for Intrastat reports.")
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
@api.constrains('type', 'is_accessory_cost')
|
||||
def _check_accessory_cost(self):
|
||||
if self.is_accessory_cost and self.type != 'service':
|
||||
raise ValidationError(
|
||||
_("The option 'Is accessory cost?' should only be "
|
||||
"activated on 'Service' products. You have activated "
|
||||
"this option for the product '%s' which is of type "
|
||||
"'%s'"
|
||||
% (self.name, self.type)))
|
||||
for this in self:
|
||||
if this.is_accessory_cost and this.type != 'service':
|
||||
raise ValidationError(
|
||||
_("The option 'Is accessory cost?' should only be "
|
||||
"activated on 'Service' products. You have activated "
|
||||
"this option for the product '%s' which is of type "
|
||||
"'%s'") %
|
||||
(self.name, self.type))
|
||||
|
||||
@@ -36,21 +36,23 @@ class ResCompany(models.Model):
|
||||
compute='_compute_intrastat_email_list',
|
||||
string='List of emails of Users Receiving the Intrastat Reminder')
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
@api.depends(
|
||||
'intrastat_remind_user_ids', 'intrastat_remind_user_ids.email')
|
||||
def _compute_intrastat_email_list(self):
|
||||
emails = []
|
||||
for user in self.intrastat_remind_user_ids:
|
||||
if user.email:
|
||||
emails.append(user.email)
|
||||
self.intrastat_email_list = ','.join(emails)
|
||||
for this in self:
|
||||
emails = []
|
||||
for user in this.intrastat_remind_user_ids:
|
||||
if user.email:
|
||||
emails.append(user.email)
|
||||
this.intrastat_email_list = ','.join(emails)
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
@api.constrains('intrastat_remind_user_ids')
|
||||
def _check_intrastat_remind_users(self):
|
||||
for user in self.intrastat_remind_user_ids:
|
||||
if not user.email:
|
||||
raise ValidationError(
|
||||
_("Missing e-mail address on user '%s'.")
|
||||
% (user.name))
|
||||
for this in self:
|
||||
for user in this.intrastat_remind_user_ids:
|
||||
if not user.email:
|
||||
raise ValidationError(
|
||||
_("Missing e-mail address on user '%s'.") %
|
||||
(user.name))
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
{
|
||||
'name': 'Intrastat Product',
|
||||
'version': '1.4',
|
||||
'version': '8.0.1.4.0',
|
||||
'category': 'Intrastat',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Base module for Intrastat Product',
|
||||
|
||||
@@ -181,13 +181,13 @@ class IntrastatProductDeclaration(models.Model):
|
||||
compute='_check_validity',
|
||||
string='Valid')
|
||||
|
||||
@api.one
|
||||
@api.model
|
||||
@api.constrains('year')
|
||||
def _check_year(self):
|
||||
s = str(self.year)
|
||||
if len(s) != 4 or s[0] != '2':
|
||||
raise ValidationError(
|
||||
_("Invalid Year !"))
|
||||
for this in self:
|
||||
s = str(this.year)
|
||||
if len(s) != 4 or s[0] != '2':
|
||||
raise ValidationError(_("Invalid Year !"))
|
||||
|
||||
_sql_constraints = [
|
||||
('date_uniq',
|
||||
@@ -197,29 +197,32 @@ class IntrastatProductDeclaration(models.Model):
|
||||
"or change the revision number of this one."),
|
||||
]
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
@api.depends('company_id')
|
||||
def _compute_company_country_code(self):
|
||||
if self.company_id:
|
||||
self.company_country_code = \
|
||||
self.company_id.country_id.code.lower()
|
||||
for this in self:
|
||||
if this.company_id:
|
||||
this.company_country_code = \
|
||||
self.company_id.country_id.code.lower()
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
@api.depends('year', 'month')
|
||||
def _compute_year_month(self):
|
||||
if self.year and self.month:
|
||||
self.year_month = '-'.join(
|
||||
[str(self.year), format(self.month, '02')])
|
||||
for this in self:
|
||||
if this.year and this.month:
|
||||
this.year_month = '-'.join(
|
||||
[str(this.year), format(this.month, '02')])
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
@api.depends('month')
|
||||
def _check_validity(self):
|
||||
""" TO DO: logic based upon computation lines """
|
||||
self.valid = True
|
||||
for this in self:
|
||||
this.valid = True
|
||||
|
||||
@api.one
|
||||
@api.returns('self', lambda value: value.id)
|
||||
@api.multi
|
||||
def copy(self, default=None):
|
||||
self.ensure_one()
|
||||
default = default or {}
|
||||
default['revision'] = self.revision + 1
|
||||
return super(IntrastatProductDeclaration, self).copy(default)
|
||||
@@ -812,11 +815,12 @@ class IntrastatProductComputationLine(models.Model):
|
||||
'res.country', string='Country of Origin of the Product',
|
||||
help="Country of origin of the product i.e. product 'made in ____'")
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
@api.depends('transport_id')
|
||||
def _check_validity(self):
|
||||
""" TO DO: logic based upon fields """
|
||||
self.valid = True
|
||||
for this in self:
|
||||
this.valid = True
|
||||
|
||||
@api.onchange('product_id')
|
||||
def _onchange_product(self):
|
||||
|
||||
@@ -41,15 +41,16 @@ class IntrastatTransaction(models.Model):
|
||||
default=lambda self: self.env['res.company']._company_default_get(
|
||||
'intrastat.transaction'))
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
@api.depends('code', 'description')
|
||||
def _compute_display_name(self):
|
||||
display_name = self.code
|
||||
if self.description:
|
||||
display_name += ' ' + self.description
|
||||
self.display_name = len(display_name) > 55 \
|
||||
and display_name[:55] + '...' \
|
||||
or display_name
|
||||
for this in self:
|
||||
display_name = this.code
|
||||
if this.description:
|
||||
display_name += ' ' + this.description
|
||||
this.display_name = len(display_name) > 55 \
|
||||
and display_name[:55] + '...' \
|
||||
or display_name
|
||||
|
||||
_sql_constraints = [(
|
||||
'intrastat_transaction_code_unique',
|
||||
|
||||
@@ -38,10 +38,11 @@ class IntrastatTransportMode(models.Model):
|
||||
name = fields.Char(string='Name', required=True, translate=True)
|
||||
description = fields.Char(string='Description', translate=True)
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
@api.depends('name', 'code')
|
||||
def _display_name(self):
|
||||
self.display_name = '%s. %s' % (self.code, self.name)
|
||||
for this in self:
|
||||
this.display_name = '%s. %s' % (this.code, this.name)
|
||||
|
||||
_sql_constraints = [(
|
||||
'intrastat_transport_code_unique',
|
||||
|
||||
@@ -78,14 +78,15 @@ class ResCompany(models.Model):
|
||||
('standard', 'Standard'),
|
||||
('extended', 'Extended')]
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
@api.depends('intrastat_arrivals', 'intrastat_dispatches')
|
||||
def _compute_intrastat(self):
|
||||
if self.intrastat_arrivals == 'exempt' \
|
||||
and self.intrastat_dispatches == 'exempt':
|
||||
self.intrastat = 'exempt'
|
||||
elif self.intrastat_arrivals == 'extended' \
|
||||
or self.intrastat_dispatches == 'extended':
|
||||
self.intrastat = 'extended'
|
||||
else:
|
||||
self.intrastat = 'standard'
|
||||
for this in self:
|
||||
if this.intrastat_arrivals == 'exempt' \
|
||||
and this.intrastat_dispatches == 'exempt':
|
||||
this.intrastat = 'exempt'
|
||||
elif this.intrastat_arrivals == 'extended' \
|
||||
or this.intrastat_dispatches == 'extended':
|
||||
this.intrastat = 'extended'
|
||||
else:
|
||||
this.intrastat = 'standard'
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
{
|
||||
'name': 'Product Harmonized System Codes',
|
||||
'version': '0.2',
|
||||
'version': '8.0.0.2.0',
|
||||
'category': 'Reporting',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Base module for Product Import/Export reports',
|
||||
|
||||
@@ -56,20 +56,22 @@ class HSCode(models.Model):
|
||||
product_tmpl_ids = fields.One2many(
|
||||
'product.template', 'hs_code_id', string='Products')
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
@api.depends('local_code')
|
||||
def _compute_hs_code(self):
|
||||
self.hs_code = self.local_code and self.local_code[:6]
|
||||
for this in self:
|
||||
this.hs_code = this.local_code and this.local_code[:6]
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
@api.depends('local_code', 'description')
|
||||
def _compute_display_name(self):
|
||||
display_name = self.local_code
|
||||
if self.description:
|
||||
display_name += ' ' + self.description
|
||||
self.display_name = len(display_name) > 55 \
|
||||
and display_name[:55] + '...' \
|
||||
or display_name
|
||||
for this in self:
|
||||
display_name = this.local_code
|
||||
if this.description:
|
||||
display_name += ' ' + this.description
|
||||
this.display_name = len(display_name) > 55 \
|
||||
and display_name[:55] + '...' \
|
||||
or display_name
|
||||
|
||||
_sql_constraints = [
|
||||
('local_code_company_uniq', 'unique(local_code, company_id)',
|
||||
|
||||
Reference in New Issue
Block a user