From 91065dd9a6d3a2ac8d7df6251168c02eb4bafc10 Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 29 Nov 2016 13:53:52 +0100 Subject: [PATCH 01/11] import code from launchpad --- l10n_nl_intrastat/__init__.py | 2 + l10n_nl_intrastat/__openerp__.py | 59 ++++ l10n_nl_intrastat/i18n/l10n_nl_intrastat.pot | 172 +++++++++++ l10n_nl_intrastat/i18n/nl.po | 172 +++++++++++ l10n_nl_intrastat/model/__init__.py | 1 + l10n_nl_intrastat/model/l10n_nl_intrastat.py | 289 ++++++++++++++++++ .../security/ir.model.access.csv | 3 + l10n_nl_intrastat/view/l10n_nl_intrastat.xml | 74 +++++ 8 files changed, 772 insertions(+) create mode 100644 l10n_nl_intrastat/__init__.py create mode 100644 l10n_nl_intrastat/__openerp__.py create mode 100644 l10n_nl_intrastat/i18n/l10n_nl_intrastat.pot create mode 100644 l10n_nl_intrastat/i18n/nl.po create mode 100644 l10n_nl_intrastat/model/__init__.py create mode 100644 l10n_nl_intrastat/model/l10n_nl_intrastat.py create mode 100644 l10n_nl_intrastat/security/ir.model.access.csv create mode 100644 l10n_nl_intrastat/view/l10n_nl_intrastat.xml diff --git a/l10n_nl_intrastat/__init__.py b/l10n_nl_intrastat/__init__.py new file mode 100644 index 000000000..5f214a295 --- /dev/null +++ b/l10n_nl_intrastat/__init__.py @@ -0,0 +1,2 @@ +import model + diff --git a/l10n_nl_intrastat/__openerp__.py b/l10n_nl_intrastat/__openerp__.py new file mode 100644 index 000000000..7281fc8e0 --- /dev/null +++ b/l10n_nl_intrastat/__openerp__.py @@ -0,0 +1,59 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Intrastat report for the Netherlands (ICP) +# +# Based on lp:new-report-intrastat, +# Copyright (C) 2010-2011 Akretion (http://www.akretion.com). All Rights Reserved +# @author Alexis de Lattre +# +# Modifications Copyright (C) 2012 Therp BV +# +# 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 . +# +############################################################################## + +{ + 'name': 'Intrastat reporting (ICP) for the Netherlands', + 'version': '1.0', + 'category': 'Localisation/Report Intrastat', + 'license': 'AGPL-3', + 'description': """ +Opgaaf IntraCommunautaire Prestaties (ICP) + +Based on Akretion's Intrastat framework, this module provides an +intrastat report for the Netherlands. Only generating the required data +for a manual declaration is supported. Message communication with the +tax authority has not yet been implemented. + +The intrastat base module requires the country field required on +partner addresses. Selected countries are marked for inclusion in this report. + +Amounts for products and services are reported separately. All services +are reported, regardless of the 'Accessory cost setting' which is used in +the French version of this report. + +To exclude specific lines from the report, you can mark specific taxes +as such. If such a tax is applied to the line, the line will not be +included in the reported amounts. +""", + 'author': 'Therp BV', + 'website': 'https://launchpad.net/new-report-intrastat', + 'depends': ['intrastat_base'], + 'data': [ + 'view/l10n_nl_intrastat.xml', + 'security/ir.model.access.csv', + ], +} + diff --git a/l10n_nl_intrastat/i18n/l10n_nl_intrastat.pot b/l10n_nl_intrastat/i18n/l10n_nl_intrastat.pot new file mode 100644 index 000000000..71de90fe6 --- /dev/null +++ b/l10n_nl_intrastat/i18n/l10n_nl_intrastat.pot @@ -0,0 +1,172 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * l10n_nl_intrastat +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 6.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-10-23 11:48+0000\n" +"PO-Revision-Date: 2012-10-23 11:48+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: l10n_nl_intrastat +#: model:ir.model,name:l10n_nl_intrastat.model_l10n_nl_report_intrastat +msgid "Declaration of intracommunautary transactions (ICP)" +msgstr "" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat.line,amount_service:0 +msgid "Amount services" +msgstr "" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat,state:0 +msgid "State" +msgstr "" + +#. module: l10n_nl_intrastat +#: selection:l10n_nl.report.intrastat,state:0 +msgid "Draft" +msgstr "" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat.line,amount_product:0 +msgid "Amount products" +msgstr "" + +#. module: l10n_nl_intrastat +#: code:addons/l10n_nl_intrastat/model/l10n_nl_intrastat.py:144 +#, python-format +msgid "" +"Missing country on the invoice addresses of the following partners:\n" +"%s" +msgstr "" + +#. module: l10n_nl_intrastat +#: help:l10n_nl.report.intrastat,notes:0 +msgid "You can add some comments here if you want." +msgstr "" + +#. module: l10n_nl_intrastat +#: help:l10n_nl.report.intrastat,company_id:0 +msgid "Related company." +msgstr "" + +#. module: l10n_nl_intrastat +#: help:l10n_nl.report.intrastat,date_done:0 +msgid "Last date when the intrastat declaration was converted to 'Done' state." +msgstr "" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat,company_id:0 +msgid "Company" +msgstr "" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat.line,vat:0 +msgid "VAT" +msgstr "" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat,total_amount:0 +msgid "Total amount" +msgstr "" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat.line,country_code:0 +msgid "Country Code" +msgstr "" + +#. module: l10n_nl_intrastat +#: view:l10n_nl.report.intrastat:0 field:l10n_nl.report.intrastat,notes:0 +msgid "Notes" +msgstr "" + +#. module: l10n_nl_intrastat +#: model:ir.model,name:l10n_nl_intrastat.model_l10n_nl_report_intrastat_line +msgid "ICP report line" +msgstr "" + +#. module: l10n_nl_intrastat +#: code:addons/l10n_nl_intrastat/model/l10n_nl_intrastat.py:219 +#, python-format +msgid "Cannot remove IPC reports in a non-draft state" +msgstr "" + +#. module: l10n_nl_intrastat +#: code:addons/l10n_nl_intrastat/model/l10n_nl_intrastat.py:119 +#: code:addons/l10n_nl_intrastat/model/l10n_nl_intrastat.py:143 +#: code:addons/l10n_nl_intrastat/model/l10n_nl_intrastat.py:218 +#, python-format +msgid "Error" +msgstr "" + +#. module: l10n_nl_intrastat +#: help:l10n_nl.report.intrastat,state:0 +msgid "" +"State of the declaration. When the state is set to 'Done', the parameters " +"become read-only." +msgstr "" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat.line,report_id:0 +msgid "ICP report" +msgstr "" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat,line_ids:0 +msgid "ICP line" +msgstr "" + +#. module: l10n_nl_intrastat +#: help:l10n_nl.report.intrastat,total_amount:0 +msgid "Total amount in company currency of the declaration." +msgstr "" + +#. module: l10n_nl_intrastat +#: code:addons/l10n_nl_intrastat/model/l10n_nl_intrastat.py:120 +#, python-format +msgid "Cannot generate reports lines in a non-draft state" +msgstr "" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat,period_id:0 +msgid "Period" +msgstr "" + +#. module: l10n_nl_intrastat +#: view:l10n_nl.report.intrastat:0 +msgid "Generate lines" +msgstr "" + +#. module: l10n_nl_intrastat +#: selection:l10n_nl.report.intrastat,state:0 +msgid "Done" +msgstr "" + +#. module: l10n_nl_intrastat +#: view:l10n_nl.report.intrastat:0 +msgid "Cancel" +msgstr "" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat.line,partner_id:0 +msgid "Partner" +msgstr "" + +#. module: l10n_nl_intrastat +#: model:ir.actions.act_window,name:l10n_nl_intrastat.l10n_nl_intrastat_tree_action +#: model:ir.ui.menu,name:l10n_nl_intrastat.l10n_nl_intrastat_report_menu +msgid "ICP Report" +msgstr "" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat,date_done:0 +msgid "Date done" +msgstr "" diff --git a/l10n_nl_intrastat/i18n/nl.po b/l10n_nl_intrastat/i18n/nl.po new file mode 100644 index 000000000..c2bf38289 --- /dev/null +++ b/l10n_nl_intrastat/i18n/nl.po @@ -0,0 +1,172 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * l10n_nl_intrastat +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 6.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-12-04 11:31+0000\n" +"PO-Revision-Date: 2012-12-04 11:31+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: l10n_nl_intrastat +#: model:ir.model,name:l10n_nl_intrastat.model_l10n_nl_report_intrastat +msgid "Declaration of intracommunautary transactions (ICP)" +msgstr "Opgaaf Intracommunautaire Prestaties (ICP)" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat.line,amount_service:0 +msgid "Amount services" +msgstr "Totaalbedrag diensten" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat,state:0 +msgid "State" +msgstr "Status" + +#. module: l10n_nl_intrastat +#: selection:l10n_nl.report.intrastat,state:0 +msgid "Draft" +msgstr "Concept" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat.line,amount_product:0 +msgid "Amount products" +msgstr "Totaalbedrag leveringen" + +#. module: l10n_nl_intrastat +#: code:addons/l10n_nl_intrastat/model/l10n_nl_intrastat.py:144 +#, python-format +msgid "Missing country on the invoice addresses of the following partners:\n" +"%s" +msgstr "Ontbrekend land op het factuuradresvan de volgende partner:\n" +"%s" + +#. module: l10n_nl_intrastat +#: help:l10n_nl.report.intrastat,notes:0 +msgid "You can add some comments here if you want." +msgstr "Hier kunnen eventuele aantekeningen geplaatst worden." + +#. module: l10n_nl_intrastat +#: help:l10n_nl.report.intrastat,company_id:0 +msgid "Related company." +msgstr "Bedrijf van deze aangifte." + +#. module: l10n_nl_intrastat +#: help:l10n_nl.report.intrastat,date_done:0 +msgid "Last date when the intrastat declaration was converted to 'Done' state." +msgstr "Datum van de laatste statuswijziging naar 'Gereed'." + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat,company_id:0 +msgid "Company" +msgstr "Bedrijf" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat.line,vat:0 +msgid "VAT" +msgstr "BTW-nummer" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat,total_amount:0 +msgid "Total amount" +msgstr "Totaalbedrag" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat.line,country_code:0 +msgid "Country Code" +msgstr "Landcode" + +#. module: l10n_nl_intrastat +#: view:l10n_nl.report.intrastat:0 +#: field:l10n_nl.report.intrastat,notes:0 +msgid "Notes" +msgstr "Aantekeningen" + +#. module: l10n_nl_intrastat +#: model:ir.model,name:l10n_nl_intrastat.model_l10n_nl_report_intrastat_line +msgid "ICP report line" +msgstr "ICP aangifteregel" + +#. module: l10n_nl_intrastat +#: code:addons/l10n_nl_intrastat/model/l10n_nl_intrastat.py:219 +#, python-format +msgid "Cannot remove IPC reports in a non-draft state" +msgstr "Alleen aangiften in concept-status kunnen worden verwijderd" + +#. module: l10n_nl_intrastat +#: code:addons/l10n_nl_intrastat/model/l10n_nl_intrastat.py:119 +#: code:addons/l10n_nl_intrastat/model/l10n_nl_intrastat.py:143 +#: code:addons/l10n_nl_intrastat/model/l10n_nl_intrastat.py:218 +#, python-format +msgid "Error" +msgstr "Fout" + +#. module: l10n_nl_intrastat +#: help:l10n_nl.report.intrastat,state:0 +msgid "State of the declaration. When the state is set to 'Done', the parameters become read-only." +msgstr "Status van de aangifte. Wanneer de status op 'Gereed' staat, worden de gegevens alleen-lezen." + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat.line,report_id:0 +msgid "ICP report" +msgstr "Aangifte ICP" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat,line_ids:0 +msgid "ICP line" +msgstr "ICP-regel" + +#. module: l10n_nl_intrastat +#: help:l10n_nl.report.intrastat,total_amount:0 +msgid "Total amount in company currency of the declaration." +msgstr "Totaalbedrag van de aangifte in de bedrijfsvaluta" + +#. module: l10n_nl_intrastat +#: code:addons/l10n_nl_intrastat/model/l10n_nl_intrastat.py:120 +#, python-format +msgid "Cannot generate reports lines in a non-draft state" +msgstr "Kan alleen regels genereren voor een aangifte in concept-status" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat,period_id:0 +msgid "Period" +msgstr "Periode" + +#. module: l10n_nl_intrastat +#: view:l10n_nl.report.intrastat:0 +msgid "Generate lines" +msgstr "Regels aanmaken" + +#. module: l10n_nl_intrastat +#: selection:l10n_nl.report.intrastat,state:0 +msgid "Done" +msgstr "Gereed" + +#. module: l10n_nl_intrastat +#: view:l10n_nl.report.intrastat:0 +msgid "Cancel" +msgstr "Annuleer" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat.line,partner_id:0 +msgid "Partner" +msgstr "Relatie" + +#. module: l10n_nl_intrastat +#: model:ir.actions.act_window,name:l10n_nl_intrastat.l10n_nl_intrastat_tree_action +#: model:ir.ui.menu,name:l10n_nl_intrastat.l10n_nl_intrastat_report_menu +msgid "ICP Report" +msgstr "Aangifte ICP" + +#. module: l10n_nl_intrastat +#: field:l10n_nl.report.intrastat,date_done:0 +msgid "Date done" +msgstr "Datum gereed" + diff --git a/l10n_nl_intrastat/model/__init__.py b/l10n_nl_intrastat/model/__init__.py new file mode 100644 index 000000000..0cc5e41b3 --- /dev/null +++ b/l10n_nl_intrastat/model/__init__.py @@ -0,0 +1 @@ +import l10n_nl_intrastat diff --git a/l10n_nl_intrastat/model/l10n_nl_intrastat.py b/l10n_nl_intrastat/model/l10n_nl_intrastat.py new file mode 100644 index 000000000..6d648a9fc --- /dev/null +++ b/l10n_nl_intrastat/model/l10n_nl_intrastat.py @@ -0,0 +1,289 @@ +# -*- encoding: utf-8 -*- +"""Define intrastat report (ICP) for dutch tax authorities.""" +############################################################################## +# +# OpenERP Report intrastat for NL +# Copyright (C) 2012 - 2015 Therp BV +# +# Based on and containing code snippets from lp:new-report-intrastat +# by Alexis de Lattre , +# Copyright (C) 2010-2011 Akretion (http://www.akretion.com). +# All Rights Reserved +# +# 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 . +# +############################################################################## +from openerp import api, models, fields, _ +from openerp.exceptions import Warning +from datetime import datetime +from dateutil.relativedelta import relativedelta +from openerp.addons.decimal_precision import decimal_precision as dp + + +class ReportIntrastat(models.Model): + """Define intrastat report (ICP) for dutch tax authorities.""" + _name = "l10n_nl.report.intrastat" + _description = "Declaration of intracommunautary transactions (ICP)" + _order = "period_id desc" + _rec_name = 'period_id' + + def _default_period_id(self): + """ + By default, take the previous period relative to the + current date. Courtesy of Alexis. + """ + period_model = self.env['account.period'] + date = datetime.strftime( + datetime.today() + relativedelta(day=1, months=-1), '%Y-%m-%d') + period_ids = period_model.find(dt=date) + return period_ids and period_ids[0] or False + + def _default_company_id(self): + """Default company is active user company.""" + return self.env.user.company_id.id + + period_id = fields.Many2one( + string='Period', + comodel_name='account.period', + states={'done': [('readonly', True)]}, + default=_default_period_id, + ) + company_id = fields.Many2one( + string='Company', + comodel_name='res.company', + required=True, + states={'done': [('readonly', True)]}, + help="Related company.", + default=_default_company_id, + ) + total_amount = fields.Float( + string='Total amount', + readonly=True, + help="Total amount in company currency of the declaration.", + digits=dp.get_precision('Account'), + ) + state = fields.Selection( + string='State', + selection=[ + ('draft', 'Draft'), + ('done', 'Done'), + ], + default='draft', + readonly=True, + help=( + "State of the declaration. When the state is set to 'Done', " + "the parameters become read-only." + ), + ) + date_done = fields.Date( + string='Date done', + readonly=True, + help=( + "Last date when the intrastat declaration was converted to " + "'Done' state." + ), + ) + notes = fields.Text( + string='Notes', + help="You can add some comments here if you want.", + ) + line_ids = fields.One2many( + string='ICP line', + comodel_name='l10n_nl.report.intrastat.line', + inverse_name='report_id', + readonly=True, + ) + + @api.one + def set_draft(self): + """ + Reset report state to draft. + """ + return self.write({'state': 'draft'}) + + @api.one + def generate_lines(self): + """ + Collect the data lines for the given report. + Unlink any existing lines first. + """ + # Generating lines is only allowed for report in draft state: + if self.state != 'draft': + raise Warning(_( + 'Cannot generate reports lines in a non-draft state')) + # Other models: + report_line_model = self.env['l10n_nl.report.intrastat.line'] + currency_model = self.env['res.currency'] + invoice_model = self.env['account.invoice'] + invoice_line_model = self.env['account.invoice.line'] + + total_amount = 0.0 + partner_amounts_map = {} + # Check wether all configuration done to generate report + self.env['report.intrastat.common']._check_generate_lines(self) + + # Remove existing lines + for line_obj in self.line_ids: + line_obj.unlink() + # Define search for invoices for period and company: + company_obj = self.company_id # simplify access + invoice_domain = [ + ('type', 'in', ('out_invoice', 'out_refund')), + ('period_id', '=', self.period_id.id), + ('state', 'in', ('open', 'paid')), + ('company_id', '=', company_obj.id), + ] + # Signal invoices without a country + # (Should not happen, as country_id on parter is set to required) + invalid_invoices = invoice_model.search_read( + domain=invoice_domain + [('partner_id.country_id', '=', False)], + fields=['partner_id'] + ) + if invalid_invoices: + raise Warning( + _( + "Missing country on the invoice addresses of the" + " following partners:\n%s" + ) % "\n".join( + inv['partner_id'][1] for inv in invalid_invoices) + ) + # Search invoices that need intrastat reporting: + invoice_records = invoice_model.search( + invoice_domain + [ + ('partner_id.country_id.intrastat', '=', True), + ('partner_id.country_id.id', '!=', company_obj.country_id.id), + ] + ) + invoice_ids = [inv['id'] for inv in invoice_records] + invoice_line_records = invoice_line_model.search( + [('invoice_id', 'in', invoice_ids)]) + + # Gather amounts from invoice lines + for line in invoice_line_records: + # Ignore invoiceline if taxes should not be included in intrastat: + if any( + tax.exclude_from_intrastat_if_present + for tax in line.invoice_line_tax_id): + continue + # Report is per commercial partner: + commercial_partner_id = ( + line.invoice_id.partner_id.commercial_partner_id.id) + if commercial_partner_id not in partner_amounts_map: + partner_amounts_map[commercial_partner_id] = { + 'amount_product': 0.0, + 'amount_service': 0.0, + } + amounts = partner_amounts_map[commercial_partner_id] + # Determine product or service: + if (line.product_id + and ( + line.product_id.type == 'service' + or line.product_id.is_accessory_cost)): + amount_type = 'amount_service' + else: + amount_type = 'amount_product' + sign = line.invoice_id.type == 'out_refund' and -1 or 1 + amount = sign * line.price_subtotal + # Convert currency amount if necessary: + line_currency_obj = line.invoice_id.currency_id # simplify + invoice_date = line.invoice_id.date_invoice + if (line_currency_obj + and line_currency_obj.id != company_obj.currency_id.id): + amount = ( + line_currency_obj.with_context(date=invoice_date).compute( + amount, company_obj.currency_id, round=True) + ) + # Accumulate totals: + amounts[amount_type] += amount # per partner and type + total_amount += amount # grand total + + # Create report lines + for (partner_id, vals) in partner_amounts_map.items(): + if not (vals['amount_service'] or vals['amount_product']): + continue + vals.update({ + 'partner_id': partner_id, + 'report_id': self.id + }) + report_line_model.create(vals) + + return self.write({ + 'total_amount': total_amount, + 'date_done': fields.Date.today(), + 'state': 'done', + }) + + def unlink(self, cr, uid, ids, context=None): + """ + Do not allow unlinking of confirmed reports + """ + if not ids: + return True + if isinstance(ids, (int, long)): + ids = [ids] + non_draft_ids = self.search( + cr, uid, + [('id', 'in', ids), ('state', '!=', 'draft')], + context=context + ) + if non_draft_ids: + raise Warning(_('Cannot remove IPC reports in a non-draft state')) + return super(ReportIntrastat, self).unlink( + cr, uid, ids, context=context) + + +class ReportIntrastatLine(models.Model): + """Lines for dutch ICP report.""" + _name = "l10n_nl.report.intrastat.line" + _description = "ICP report line" + _order = "report_id, country_code" + _rec_name = 'partner_id' + + report_id = fields.Many2one( + string='ICP report', + comodel_name='l10n_nl.report.intrastat', + readonly=True, + required=True, + ondelete="CASCADE" + ) + partner_id = fields.Many2one( + string='Partner', + comodel_name='res.partner', + readonly=True, + required=True, + ) + vat = fields.Char( + string='VAT', + related='partner_id.vat', + store=True, + readonly=True, + ) + country_code = fields.Char( + string='Country Code', + related='partner_id.country_id.code', + store=True, + readonly=True, + ) + amount_product = fields.Float( + string='Amount products', + readonly=True, + digits=dp.get_precision('Account'), + ) + amount_service = fields.Float( + string='Amount services', + readonly=True, + digits=dp.get_precision('Account'), + ) + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/l10n_nl_intrastat/security/ir.model.access.csv b/l10n_nl_intrastat/security/ir.model.access.csv new file mode 100644 index 000000000..c850ace5d --- /dev/null +++ b/l10n_nl_intrastat/security/ir.model.access.csv @@ -0,0 +1,3 @@ +"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" +"access_l10n_nl_report_intrastat","Account manager can use ICP reports","model_l10n_nl_report_intrastat","account.group_account_manager",1,1,1,1 +"access_l10n_nl_report_intrastat_line","Account manager can use ICP report lines","model_l10n_nl_report_intrastat_line","account.group_account_manager",1,1,1,1 diff --git a/l10n_nl_intrastat/view/l10n_nl_intrastat.xml b/l10n_nl_intrastat/view/l10n_nl_intrastat.xml new file mode 100644 index 000000000..ebb874c9e --- /dev/null +++ b/l10n_nl_intrastat/view/l10n_nl_intrastat.xml @@ -0,0 +1,74 @@ + + + + + + l10n_nl.intrastat.report.form + l10n_nl.report.intrastat + +
+ + + + + +