mirror of
https://github.com/OCA/intrastat-extrastat.git
synced 2025-02-16 17:13:41 +02:00
* Add product_origin_country_id on declaration/computation lines Copy incoterms and destination country from SO to invoice when invoicing from SO We need weight even when supplementary units is used Small cleanups and enhancements * Add support for accessory costs Add default values for intrastat transaction on company Code cleanup * If rounded weight is 0, put 1 Take into account the taxes for B2C Small code cleanup * Remove field exclude_from_intrastat Re-organise view of intrastat.product.declaration * Add option intrastat_accessory_costs on company Set more fields as invisible (localisation should put them visible if they need it) Fix handling of suppl. units when hs_code is empty on invoice line (but set on product) Small usability enhancements * Include selection of type of invoice in search, for better perf Isolate domain in a _prepare method, for easier inheritance WARNING: I changed the default selection of invoice type ; adapt it in your localization m odule if necessary Add intrastat_transaction_in_refund for company (not needed for France, but may be needed elsewhere) Add a log when an invoice line is skipped * Include product code in warning msg on weight * Inspired by the PR https://github.com/akretion/account-financial-reporting/pull/8 of Luc de Meyer
49 lines
2.0 KiB
Python
49 lines
2.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
##############################################################################
|
|
#
|
|
# Intrastat Product module for Odoo
|
|
# Copyright (C) 2011-2015 Akretion (http://www.akretion.com)
|
|
# Copyright (C) 2009-2015 Noviat (http://www.noviat.com)
|
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
|
# @author Luc de Meyer <info@noviat.com>
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero General Public License as
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
# License, or (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Affero General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
#
|
|
##############################################################################
|
|
|
|
from openerp import models, fields, api, _
|
|
from openerp.exceptions import ValidationError
|
|
|
|
|
|
class HSCode(models.Model):
|
|
_inherit = "hs.code"
|
|
|
|
intrastat_unit_id = fields.Many2one(
|
|
'intrastat.unit', string='Intrastat Supplementary Unit')
|
|
|
|
@api.constrains('local_code')
|
|
def _hs_code(self):
|
|
if self.company_id.country_id.intrastat:
|
|
if not self.local_code.isdigit():
|
|
raise ValidationError(
|
|
_("Intrastat Codes should only contain digits. "
|
|
"This is not the case for code '%s'.")
|
|
% self.local_code)
|
|
if len(self.local_code) != 8:
|
|
raise ValidationError(
|
|
_("Intrastat Codes should "
|
|
"contain 8 digits. This is not the case for "
|
|
"Intrastat Code '%s' which has %d digits.")
|
|
% (self.local_code, len(self.local_code)))
|