[MIG] Migrate all modules from v11 to v12

This commit is contained in:
Alexis de Lattre
2019-05-28 19:09:32 +02:00
committed by João Marques
parent 24f4161e5e
commit fb4032fac0
20 changed files with 180 additions and 170 deletions

View File

@@ -7,7 +7,7 @@
{
'name': 'Intrastat Product',
'version': '11.0.1.2.0',
'version': '12.0.1.0.0',
'category': 'Intrastat',
'license': 'AGPL-3',
'summary': 'Base module for Intrastat Product',
@@ -17,10 +17,10 @@
'intrastat_base',
'product_harmonized_system',
'sale_stock',
'purchase',
'purchase_stock',
'report_xlsx_helper',
],
'excludes': ['report_intrastat'],
'excludes': ['account_intrastat'],
'data': [
'views/hs_code.xml',
'views/intrastat_region.xml',
@@ -38,5 +38,5 @@
'data/intrastat_unit.xml',
],
'demo': ['demo/intrastat_demo.xml'],
'installable': False,
'installable': True,
}

View File

@@ -18,7 +18,7 @@
<record id="intrastat_unit_g" model="intrastat.unit">
<field name="name">g</field>
<field name="description">Gram</field>
<field name="uom_id" ref="product.product_uom_gram"/>
<field name="uom_id" ref="uom.product_uom_gram"/>
</record>
<record id="intrastat_unit_gi_FS" model="intrastat.unit">
<field name="name">gi F/S</field>
@@ -71,7 +71,7 @@
<record id="intrastat_unit_l" model="intrastat.unit">
<field name="name">l</field>
<field name="description">Litre</field>
<field name="uom_id" ref="product.product_uom_litre"/>
<field name="uom_id" ref="uom.product_uom_litre"/>
</record>
<record id="intrastat_unit_1000l" model="intrastat.unit">
<field name="name">1000 l</field>
@@ -84,7 +84,7 @@
<record id="intrastat_unit_m" model="intrastat.unit">
<field name="name">m</field>
<field name="description">Metre</field>
<field name="uom_id" ref="product.product_uom_meter"/>
<field name="uom_id" ref="uom.product_uom_meter"/>
</record>
<record id="intrastat_unit_m2" model="intrastat.unit">
<field name="name">m2</field>
@@ -105,7 +105,7 @@
<record id="intrastat_unit_pce" model="intrastat.unit">
<field name="name">items</field>
<field name="description">Number of items</field>
<field name="uom_id" ref="product.product_uom_unit"/>
<field name="uom_id" ref="uom.product_uom_unit"/>
</record>
<record id="intrastat_unit_100pce" model="intrastat.unit">
<field name="name">100 items</field>

View File

@@ -18,7 +18,7 @@
<record id="base.main_company" model="res.company">
<field name="intrastat_arrivals">extended</field>
<field name="intrastat_dispatches">extended</field>
<field name="intrastat_incoterm_id" ref="stock.incoterm_DDU"/>
<field name="intrastat_incoterm_id" ref="account.incoterm_DDU"/>
<field name="intrastat_transport_id" ref="intrastat_transport_3"/>
</record>

View File

@@ -1,4 +1,4 @@
# Copyright 2011-2017 Akretion (http://www.akretion.com)
# Copyright 2011-2017 Akretion France (http://www.akretion.com)
# Copyright 2009-2018 Noviat (http://www.noviat.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Luc de Meyer <info@noviat.com>
@@ -9,8 +9,6 @@ from odoo import api, fields, models
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
# in v10, the sale_stock module defines an incoterms_id
# Odoo v8 name: incoterm_id
intrastat_transaction_id = fields.Many2one(
comodel_name='intrastat.transaction',
string='Intrastat Transaction Type',
@@ -29,7 +27,7 @@ class AccountInvoice(models.Model):
"arrivals.")
intrastat_country = fields.Boolean(
compute='_compute_intrastat_country', string='Intrastat Country',
store=True, readonly=True, compute_sudo=True)
store=True, compute_sudo=True)
src_dest_region_id = fields.Many2one(
comodel_name='intrastat.region',
string='Origin/Destination Region',
@@ -39,9 +37,8 @@ class AccountInvoice(models.Model):
ondelete='restrict')
intrastat = fields.Char(
string='Intrastat Declaration',
related='company_id.intrastat', readonly=True, compute_sudo=True)
related='company_id.intrastat')
@api.multi
@api.depends('partner_shipping_id.country_id', 'partner_id.country_id')
def _compute_intrastat_country(self):
for inv in self:
@@ -55,7 +52,7 @@ class AccountInvoice(models.Model):
@api.model
def _default_src_dest_region_id(self):
rco = self.env['res.company']
company = rco._company_default_get('account.invoice')
company = rco._company_default_get()
return company.intrastat_region_id

View File

@@ -1,4 +1,4 @@
# Copyright 2011-2017 Akretion (http://www.akretion.com)
# Copyright 2011-2017 Akretion France (http://www.akretion.com)
# Copyright 2009-2018 Noviat (http://www.noviat.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Luc de Meyer <info@noviat.com>
@@ -27,35 +27,24 @@ class IntrastatProductDeclaration(models.Model):
]
@api.model
def _default_year(self):
if datetime.now().month == 1:
year = datetime.now().year - 1
else:
year = datetime.now().year
return str(year)
@api.model
def _default_month(self):
if datetime.now().month == 1:
return 12
else:
return datetime.now().month - 1
@api.model
def _default_action(self):
return 'replace'
def default_get(self, fields_list):
res = super(IntrastatProductDeclaration, self).default_get(fields_list)
decl_date = fields.Date.context_today(self) - relativedelta(months=1)
res.update({
'year': str(decl_date.year),
'month': decl_date.month,
})
return res
company_id = fields.Many2one(
comodel_name='res.company', string='Company', readonly=True,
default=lambda self: self.env['res.company']._company_default_get(
'intrastat.product.declaration'))
default=lambda self: self.env['res.company']._company_default_get())
company_country_code = fields.Char(
compute='_compute_company_country_code',
string='Company Country Code', readonly=True, store=True,
help="Used in views and methods of localization modules.")
year = fields.Char(
string='Year', required=True,
default=lambda self: self._default_year(),
states={'done': [('readonly', True)]})
month = fields.Selection([
(1, '01'),
@@ -71,7 +60,6 @@ class IntrastatProductDeclaration(models.Model):
(11, '11'),
(12, '12')
], string='Month', required=True,
default=lambda self: self._default_month(),
states={'done': [('readonly', True)]})
year_month = fields.Char(
compute='_compute_year_month', string='Period', readonly=True,
@@ -84,7 +72,7 @@ class IntrastatProductDeclaration(models.Model):
action = fields.Selection(
selection='_get_action',
string='Action', required=True,
default=lambda self: self._default_action(),
default='replace',
states={'done': [('readonly', True)]},
track_visibility='onchange')
revision = fields.Integer(
@@ -107,8 +95,7 @@ class IntrastatProductDeclaration(models.Model):
compute='_compute_numbers', string='Total Fiscal Amount', store=True,
help="Total fiscal amount in company currency of the declaration.")
currency_id = fields.Many2one(
'res.currency', related='company_id.currency_id', readonly=True,
string='Currency')
'res.currency', related='company_id.currency_id', string='Currency')
state = fields.Selection(
selection=[('draft', 'Draft'),
('done', 'Done')],
@@ -152,7 +139,6 @@ class IntrastatProductDeclaration(models.Model):
('append', 'Append'),
('nihil', 'Nihil')]
@api.multi
@api.depends('company_id')
def _compute_company_country_code(self):
for this in self:
@@ -163,7 +149,6 @@ class IntrastatProductDeclaration(models.Model):
this.company_country_code = \
this.company_id.country_id.code.lower()
@api.multi
@api.depends('year', 'month')
def _compute_year_month(self):
for this in self:
@@ -171,7 +156,6 @@ class IntrastatProductDeclaration(models.Model):
this.year_month = '-'.join(
[this.year, format(this.month, '02')])
@api.multi
@api.depends('month')
def _compute_check_validity(self):
""" TO DO: logic based upon computation lines """
@@ -196,7 +180,6 @@ class IntrastatProductDeclaration(models.Model):
self.company_id.intrastat_dispatches == 'extended' \
and 'extended' or 'standard'
@api.multi
def copy(self, default=None):
self.ensure_one()
default = default or {}
@@ -322,10 +305,9 @@ class IntrastatProductDeclaration(models.Model):
def _get_amount(self, inv_line):
invoice = inv_line.invoice_id
amount = invoice.currency_id.with_context(
date=invoice.date_invoice).compute(
inv_line.price_subtotal,
self.company_id.currency_id)
amount = invoice.currency_id._convert(
inv_line.price_subtotal, self.company_id.currency_id,
self.company_id, invoice.date_invoice)
return amount
def _get_region(self, inv_line):
@@ -379,7 +361,10 @@ class IntrastatProductDeclaration(models.Model):
return transport
def _get_incoterm(self, inv_line):
incoterm = inv_line.invoice_id.incoterms_id \
# WARNING for v12: there are 2 incoterm fields on account.invoice
# cf https://github.com/odoo/odoo/issues/31641
# the field to use is 'incoterm_id' defined in the 'account' module
incoterm = inv_line.invoice_id.incoterm_id \
or self.company_id.intrastat_incoterm_id
if not incoterm:
msg = _(
@@ -441,7 +426,7 @@ class IntrastatProductDeclaration(models.Model):
domain = [
('date_invoice', '>=', start_date),
('date_invoice', '<=', end_date),
('state', 'in', ['open', 'paid']),
('state', 'in', ['open', 'in_payment', 'paid']),
('intrastat_country', '=', True),
('company_id', '=', self.company_id.id)]
return domain
@@ -479,10 +464,11 @@ class IntrastatProductDeclaration(models.Model):
accessory_costs and
inv_line.product_id and
inv_line.product_id.is_accessory_cost):
acost = invoice.currency_id.with_context(
date=invoice.date_invoice).compute(
acost = invoice.currency_id._convert(
inv_line.price_subtotal,
self.company_id.currency_id)
self.company_id.currency_id,
self.company_id,
invoice.date_invoice)
total_inv_accessory_costs_cc += acost
continue
@@ -599,14 +585,13 @@ class IntrastatProductDeclaration(models.Model):
def _get_uom_refs(self, ref):
uom_refs = {
'weight_uom_categ': self.env.ref('product.product_uom_categ_kgm'),
'kg_uom': self.env.ref('product.product_uom_kgm'),
'pce_uom_categ': self.env.ref('product.product_uom_categ_unit'),
'pce_uom': self.env.ref('product.product_uom_unit')
'weight_uom_categ': self.env.ref('uom.product_uom_categ_kgm'),
'kg_uom': self.env.ref('uom.product_uom_kgm'),
'pce_uom_categ': self.env.ref('uom.product_uom_categ_unit'),
'pce_uom': self.env.ref('uom.product_uom_unit')
}
return uom_refs[ref]
@api.multi
def action_gather(self):
self.ensure_one()
self.message_post(body=_("Generate Lines from Invoices"))
@@ -716,7 +701,6 @@ class IntrastatProductDeclaration(models.Model):
vals['amount_company_currency']))
return vals
@api.multi
def generate_declaration(self):
""" generate declaration lines """
self.ensure_one()
@@ -740,7 +724,6 @@ class IntrastatProductDeclaration(models.Model):
cl.write({'declaration_line_id': declaration_line.id})
return True
@api.multi
def generate_xml(self):
""" generate the INTRASTAT Declaration XML file """
self.ensure_one()
@@ -756,7 +739,6 @@ class IntrastatProductDeclaration(models.Model):
raise UserError(
_("No XML File has been generated."))
@api.multi
def create_xls(self):
if self.env.context.get('computation_lines'):
report_file = 'instrastat_transactions'
@@ -802,11 +784,9 @@ class IntrastatProductDeclaration(models.Model):
"""
return {}
@api.multi
def done(self):
self.write({'state': 'done'})
@api.multi
def back2draft(self):
self.write({'state': 'draft'})
@@ -819,20 +799,11 @@ class IntrastatProductComputationLine(models.Model):
'intrastat.product.declaration',
string='Intrastat Product Declaration',
ondelete='cascade', readonly=True)
company_id = fields.Many2one(
'res.company', related='parent_id.company_id',
string="Company", readonly=True)
company_id = fields.Many2one(related='parent_id.company_id')
company_currency_id = fields.Many2one(
'res.currency', related='company_id.currency_id',
string="Company currency", readonly=True)
type = fields.Selection(
related='parent_id.type',
string='Type',
readonly=True)
reporting_level = fields.Selection(
related='parent_id.reporting_level',
string='Reporting Level',
readonly=True)
related='company_id.currency_id', string="Company currency")
type = fields.Selection(related='parent_id.type')
reporting_level = fields.Selection(related='parent_id.reporting_level')
valid = fields.Boolean(
compute='_compute_check_validity',
string='Valid')
@@ -840,7 +811,7 @@ class IntrastatProductComputationLine(models.Model):
'account.invoice.line', string='Invoice Line', readonly=True)
invoice_id = fields.Many2one(
'account.invoice', related='invoice_line_id.invoice_id',
string='Invoice', readonly=True)
string='Invoice')
declaration_line_id = fields.Many2one(
'intrastat.product.declaration.line',
string='Declaration Line', readonly=True)
@@ -849,14 +820,12 @@ class IntrastatProductComputationLine(models.Model):
help="Country of Origin/Destination",
domain=[('intrastat', '=', True)])
product_id = fields.Many2one(
'product.product', related='invoice_line_id.product_id',
string='Product', readonly=True)
'product.product', related='invoice_line_id.product_id')
hs_code_id = fields.Many2one(
'hs.code', string='Intrastat Code')
intrastat_unit_id = fields.Many2one(
'intrastat.unit', related='hs_code_id.intrastat_unit_id',
string='Suppl. Unit', readonly=True,
help="Intrastat Supplementary Unit")
string='Suppl. Unit', help="Intrastat Supplementary Unit")
weight = fields.Float(
string='Weight',
digits=dp.get_precision('Stock Weight'), help="Net weight in Kg")
@@ -883,7 +852,7 @@ class IntrastatProductComputationLine(models.Model):
'intrastat.region', string='Intrastat Region')
# extended declaration
incoterm_id = fields.Many2one(
'stock.incoterms', string='Incoterm')
'account.incoterms', string='Incoterm')
transport_id = fields.Many2one(
'intrastat.transport_mode',
string='Transport Mode')
@@ -891,13 +860,15 @@ 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.multi
@api.depends('transport_id')
def _compute_check_validity(self):
""" TO DO: logic based upon fields """
for this in self:
this.valid = True
# TODO: product_id is a readonly related field 'invoice_line_id.product_id'
# so the onchange is non-sense. Either we convert product_id to a regular
# field or we keep it a related field and we remove this onchange
@api.onchange('product_id')
def _onchange_product(self):
self.weight = 0.0
@@ -920,20 +891,11 @@ class IntrastatProductDeclarationLine(models.Model):
'intrastat.product.declaration',
string='Intrastat Product Declaration',
ondelete='cascade', readonly=True)
company_id = fields.Many2one(
'res.company', related='parent_id.company_id',
string="Company", readonly=True)
company_id = fields.Many2one(related='parent_id.company_id')
company_currency_id = fields.Many2one(
'res.currency', related='company_id.currency_id',
string="Company currency", readonly=True)
type = fields.Selection(
related='parent_id.type',
string='Type',
readonly=True)
reporting_level = fields.Selection(
related='parent_id.reporting_level',
string='Reporting Level',
readonly=True)
related='company_id.currency_id', string="Company currency")
type = fields.Selection(related='parent_id.type')
reporting_level = fields.Selection(related='parent_id.reporting_level')
computation_line_ids = fields.One2many(
'intrastat.product.computation.line', 'declaration_line_id',
string='Computation Lines', readonly=True)
@@ -946,8 +908,7 @@ class IntrastatProductDeclarationLine(models.Model):
string='Intrastat Code')
intrastat_unit_id = fields.Many2one(
'intrastat.unit', related='hs_code_id.intrastat_unit_id',
string='Suppl. Unit', readonly=True,
help="Intrastat Supplementary Unit")
string='Suppl. Unit', help="Intrastat Supplementary Unit")
weight = fields.Integer(
string='Weight', help="Net weight in Kg")
suppl_unit_qty = fields.Integer(
@@ -965,7 +926,7 @@ class IntrastatProductDeclarationLine(models.Model):
'intrastat.region', string='Intrastat Region')
# extended declaration
incoterm_id = fields.Many2one(
'stock.incoterms', string='Incoterm')
'account.incoterms', string='Incoterm')
transport_id = fields.Many2one(
'intrastat.transport_mode',
string='Transport Mode')

View File

@@ -20,5 +20,4 @@ class IntrastatRegion(models.Model):
description = fields.Char(string='Description')
company_id = fields.Many2one(
comodel_name='res.company', string='Company',
default=lambda self: self.env['res.company']._company_default_get(
'intrastat.region'))
default=lambda self: self.env['res.company']._company_default_get())

View File

@@ -1,4 +1,4 @@
# Copyright 2011-2017 Akretion (http://www.akretion.com)
# Copyright 2011-2017 Akretion France (http://www.akretion.com)
# Copyright 2009-2018 Noviat (http://www.noviat.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Luc de Meyer <info@noviat.com>
@@ -10,7 +10,6 @@ class IntrastatTransaction(models.Model):
_name = 'intrastat.transaction'
_description = "Intrastat Transaction"
_order = 'code'
_rec_name = 'display_name'
_sql_constraints = [(
'intrastat_transaction_code_unique',
'UNIQUE(code, company_id)',
@@ -18,21 +17,17 @@ class IntrastatTransaction(models.Model):
code = fields.Char(string='Code', required=True)
description = fields.Text(string='Description')
display_name = fields.Char(
compute='_compute_display_name_field', string="Display Name",
readonly=True, store=True)
company_id = fields.Many2one(
comodel_name='res.company', string='Company',
default=lambda self: self.env['res.company']._company_default_get(
'intrastat.transaction'))
default=lambda self: self.env['res.company']._company_default_get())
@api.multi
@api.depends('code', 'description')
def _compute_display_name_field(self):
def name_get(self):
res = []
for this in self:
display_name = this.code
name = this.code
if this.description:
display_name += ' ' + this.description
this.display_name = len(display_name) > 55 \
and display_name[:55] + '...' \
or display_name
name += ' ' + this.description
name = len(name) > 55 and name[:55] + '...' or name
res.append((this.id, this.name))
return res

View File

@@ -9,22 +9,20 @@ from odoo import api, fields, models
class IntrastatTransportMode(models.Model):
_name = 'intrastat.transport_mode'
_description = "Intrastat Transport Mode"
_rec_name = 'display_name'
_order = 'code'
_sql_constraints = [(
'intrastat_transport_code_unique',
'UNIQUE(code)',
'Code must be unique.')]
display_name = fields.Char(
string='Display Name', compute='_compute_display_name', store=True,
readonly=True)
code = fields.Char(string='Code', required=True)
name = fields.Char(string='Name', required=True, translate=True)
description = fields.Char(string='Description', translate=True)
@api.multi
@api.depends('name', 'code')
def _compute_display_name(self):
for this in self:
this.display_name = '%s. %s' % (this.code, this.name)
def name_get(self):
res = []
for mode in self:
name = '%s. %s' % (mode.code, mode.name)
res.append((mode.id, name))
return res

View File

@@ -13,7 +13,7 @@ class IntrastatUnit(models.Model):
name = fields.Char(string='Name', required=True)
description = fields.Char(string='Description', required=True)
uom_id = fields.Many2one(
comodel_name='product.uom', string='Regular UoM',
comodel_name='uom.uom', string='Regular UoM',
help="Select the regular Unit of Measure of Odoo that corresponds "
"to this Intrastat Supplementary Unit.")
active = fields.Boolean(default=True)

View File

@@ -10,7 +10,7 @@ class ResCompany(models.Model):
_inherit = 'res.company'
intrastat_incoterm_id = fields.Many2one(
comodel_name='stock.incoterms',
comodel_name='account.incoterms',
string='Default Incoterm for Intrastat',
help="International Commercial Terms are a series of "
"predefined commercial terms used in international "
@@ -59,7 +59,6 @@ class ResCompany(models.Model):
('standard', 'Standard'),
('extended', 'Extended')]
@api.multi
@api.depends('intrastat_arrivals', 'intrastat_dispatches')
def _compute_intrastat(self):
for this in self:

View File

@@ -9,27 +9,25 @@ class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
intrastat_incoterm_id = fields.Many2one(
related='company_id.intrastat_incoterm_id')
related='company_id.intrastat_incoterm_id', readonly=False)
intrastat_arrivals = fields.Selection(
related='company_id.intrastat_arrivals')
related='company_id.intrastat_arrivals', readonly=False)
intrastat_dispatches = fields.Selection(
related='company_id.intrastat_dispatches')
intrastat = fields.Char(related='company_id.intrastat', readonly=True)
related='company_id.intrastat_dispatches', readonly=False)
intrastat = fields.Char(related='company_id.intrastat')
intrastat_transport_id = fields.Many2one(
related='company_id.intrastat_transport_id')
related='company_id.intrastat_transport_id', readonly=False)
intrastat_region_id = fields.Many2one(
related='company_id.intrastat_region_id')
related='company_id.intrastat_region_id', readonly=False)
intrastat_transaction_out_invoice = fields.Many2one(
related='company_id.intrastat_transaction_out_invoice')
related='company_id.intrastat_transaction_out_invoice', readonly=False)
intrastat_transaction_out_refund = fields.Many2one(
related='company_id.intrastat_transaction_out_refund')
related='company_id.intrastat_transaction_out_refund', readonly=False)
intrastat_transaction_in_invoice = fields.Many2one(
related='company_id.intrastat_transaction_in_invoice')
related='company_id.intrastat_transaction_in_invoice', readonly=False)
intrastat_transaction_in_refund = fields.Many2one(
related='company_id.intrastat_transaction_in_refund')
related='company_id.intrastat_transaction_in_refund', readonly=False)
intrastat_accessory_costs = fields.Boolean(
related='company_id.intrastat_accessory_costs')
country_id = fields.Many2one(
related='company_id.country_id', readonly=True)
country_code = fields.Char(
related='company_id.country_id.code', readonly=True)
related='company_id.intrastat_accessory_costs', readonly=False)
country_id = fields.Many2one(related='company_id.country_id')
country_code = fields.Char(related='company_id.country_id.code')

View File

@@ -1,7 +1,8 @@
# Copyright 2010-2017 Akretion (http://www.akretion.com)
# Copyright 2010-2019 Akretion France (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
from odoo import fields, models
class SaleOrder(models.Model):
@@ -12,9 +13,8 @@ class SaleOrder(models.Model):
help="This information is used in Intrastat reports")
intrastat = fields.Selection(
string='Intrastat Declaration',
related='company_id.intrastat_dispatches', readonly=True)
related='company_id.intrastat_dispatches')
@api.multi
def _prepare_invoice(self):
'''Copy destination country to invoice'''
vals = super(SaleOrder, self)._prepare_invoice()

View File

@@ -2,7 +2,7 @@
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Luc de Meyer <info@noviat.com>
from odoo import api, fields, models
from odoo import fields, models
class StockWarehouse(models.Model):
@@ -15,14 +15,11 @@ class StockWarehouse(models.Model):
class StockLocation(models.Model):
_inherit = 'stock.location'
@api.multi
def get_intrastat_region(self):
self.ensure_one()
locations = self.search(
[('parent_left', '<=', self.parent_left),
('parent_right', '>=', self.parent_right)])
locations = self.search([('id', 'parent_of', self.id)])
warehouses = self.env['stock.warehouse'].search([
('lot_stock_id', 'in', [x.id for x in locations]),
('lot_stock_id', 'in', locations.ids),
('region_id', '!=', False)])
if warehouses:
return warehouses[0].region_id

View File

@@ -0,0 +1,2 @@
* Alexis de Lattre, Akretion <alexis.delattre@akretion.com>
* Luc De Meyer, Noviat <info@noviat.com>

View File

@@ -0,0 +1,11 @@
This module contains common objects and fields for the Intrastat Product reporting.
It should be used in combination with country-specific Intrastat Product reporting modules
such as:
- *l10n_fr_intrastat_product*:
the module for the *Déclaration d'Echange de Biens* (DEB) for France
- *l10n_be_intrastat_product*:
the module for the Intrastat Product Declaration for Belgium
These country-specific modules can be found in the OCA localization for those countries.

View File

@@ -0,0 +1 @@
This module is NOT compatible with the *account_intrastat* module from Odoo Enterprise.

View File

@@ -0,0 +1,34 @@
This module is used in combination with the country-specific
localization module(s).
Coding guidelines for localization module:
------------------------------------------
We recommend to start by copying an existing module, e.g. l10n_be_intrastat_product
and adapt the code for the specific needs of your country.
* Declaration Object
Create a new class as follows:
.. code-block:: python
class L10nCcIntrastatProductDeclaration(models.Model):
_name = 'l10n.cc.intrastat.product.declaration'
_description = "Intrastat Product Declaration for YourCountry"
_inherit = ['intrastat.product.declaration', 'mail.thread']
whereby cc = your country code
* Computation & Declaration Lines
Create also new objects inheriting from the Computation and Declaration Line Objects
so that you can add methods or customise the methods from the base modules (make a PR when
the customization or new method is required for multiple countries).
Adapt also the parent_id fields of the newly created objects
(cf. l10n_be_intrastat_product as example).
* XML Files: Menu, Action, Views
Cf. l10n_be_istrastat_product as example, replace "be" by your Country Code.

View File

@@ -120,7 +120,7 @@
<field name="name">intrastat.product.declaration.graph</field>
<field name="model">intrastat.product.declaration</field>
<field name="arch" type="xml">
<graph string="Intrastat Product" type="bar">
<graph string="Intrastat Product" type="bar" stacked="False">
<field name="year_month" type="row"/>
<field name="type" type="row"/>
<field name="total_amount" type="measure"/>
@@ -128,6 +128,19 @@
</field>
</record>
<record id="intrastat_product_declaration_view_pivot" model="ir.ui.view">
<field name="name">intrastat.product.declaration.pivot</field>
<field name="model">intrastat.product.declaration</field>
<field name="arch" type="xml">
<pivot string="Intrastat Product">
<field name="year_month" type="row"/>
<field name="type" type="col"/>
<field name="total_amount" type="measure"/>
</pivot>
</field>
</record>
<!-- No menuitem nor action since these are provided by the localization modules -->
<record id="intrastat_product_computation_line_view_form" model="ir.ui.view">
@@ -150,9 +163,8 @@
<field name="company_currency_id" invisible="1"/>
<field name="transaction_id"/>
<label for="weight"/>
<div>
<field name="weight" class="oe_inline"/>
<label string=" Kg" class="oe_inline"/>
<div name="weight">
<field name="weight" class="oe_inline"/> Kg
</div>
<field name="suppl_unit_qty"/>
<field name="intrastat_unit_id"/>
@@ -216,9 +228,8 @@
<field name="company_currency_id" invisible="1"/>
<field name="transaction_id"/>
<label for="weight"/>
<div>
<field name="weight" class="oe_inline"/>
<label string=" Kg" class="oe_inline"/>
<div name="weight">
<field name="weight" class="oe_inline"/> Kg
</div>
<field name="suppl_unit_qty"/>
<field name="intrastat_unit_id"/>

View File

@@ -15,11 +15,17 @@
<field name="model">intrastat.unit</field>
<field name="arch" type="xml">
<form string="Intrastat Supplementary Unit">
<group>
<div class="oe_button_box" name="button_box">
<button name="toggle_active" type="object"
class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button"
options='{"terminology": "archive"}'/>
</button>
</div>
<group name="main">
<field name="name"/>
<field name="uom_id" required="1"/>
<field name="description"/>
<field name="active"/>
</group>
</form>
</field>
@@ -44,6 +50,7 @@
<search string="Search Intrastat Supplementary Units">
<field name="name"
filter_domain="['|', ('name', 'ilike', self), ('description', 'ilike', self)]"/>
<filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
<group string="Group By" name="groupby">
<filter name="uom_groupby" string="Regular UoM"
context="{'group_by': 'uom_id'}"/>

View File

@@ -21,7 +21,7 @@
<div class="col-xs-12 col-md-12 o_setting_box">
<div class="o_setting_left_pane"/>
<div class="o_setting_right_pane">
<div class="o_setting_right_pane" id="intrastat-product-main-params">
<div class="row">
<label for="intrastat_arrivals" class="col-md-5 o_light_label"/>
<field name="intrastat_arrivals"/>
@@ -34,7 +34,7 @@
<label for="intrastat_transport_id" class="col-md-5 o_light_label"/>
<field name="intrastat_transport_id"/>
</div>
<div class="row">
<div class="row" attrs="{'invisible': [('country_code', 'in', ['FR'])]}">
<label for="intrastat_incoterm_id" class="col-md-5 o_light_label"/>
<field name="intrastat_incoterm_id"/>
</div>
@@ -50,7 +50,7 @@
<label for="intrastat_transaction_in_invoice" class="col-md-5 o_light_label"/>
<field name="intrastat_transaction_in_invoice"/>
</div>
<div class="row">
<div class="row" attrs="{'invisible': [('country_code', 'in', ['FR'])]}">
<label for="intrastat_transaction_in_refund" class="col-md-5 o_light_label"/>
<field name="intrastat_transaction_in_refund"/>
</div>