intrastat_base: use fiscal position, following suggestion on issue #110

Improve layout of config page
This commit is contained in:
Alexis de Lattre
2021-01-05 16:16:36 +01:00
parent 270e2316c3
commit c9a7e55625
10 changed files with 64 additions and 49 deletions

View File

@@ -1 +1,2 @@
from . import models
from . import wizards

View File

@@ -19,9 +19,9 @@
"views/product_template.xml",
"views/res_partner.xml",
"views/res_country.xml",
"views/account_tax.xml",
"views/res_config_settings.xml",
"views/intrastat.xml",
"views/account_fiscal_position.xml",
],
"demo": ["demo/intrastat_demo.xml"],
"installable": True,

View File

@@ -1,6 +1,5 @@
from . import res_country
from . import product_template
from . import account_tax
from . import res_company
from . import res_config_settings
from . import intrastat_common
from . import account_fiscal_position

View File

@@ -0,0 +1,30 @@
# Copyright 2020 Akretion France (http://www.akretion.com/)
# @author: <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class AccountFiscalPosition(models.Model):
_inherit = "account.fiscal.position"
intrastat = fields.Boolean(
string="Intrastat",
help="Set to True if the invoices with this fiscal position should "
"be taken into account for the generation of the intrastat reports."
)
class AccountFiscalPositionTemplate(models.Model):
_inherit = "account.fiscal.position.template"
intrastat = fields.Boolean(string="Intrastat")
class AccountChartTemplate(models.Model):
_inherit = "account.chart.template"
def _get_fp_vals(self, company, position):
vals = super()._get_fp_vals(company, position)
vals['intrastat'] = position.intrastat
return vals

View File

@@ -1,26 +0,0 @@
# Copyright 2011-2020 Akretion France (http://www.akretion.com).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class AccountTax(models.Model):
_inherit = "account.tax"
exclude_from_intrastat_if_present = fields.Boolean(
string="Exclude invoice line from intrastat if this tax is present",
help="If this tax is present on an invoice line, this invoice "
"line will be skipped when generating Intrastat Product or "
"Service lines from invoices.",
)
class AccountTaxTemplate(models.Model):
_inherit = "account.tax.template"
exclude_from_intrastat_if_present = fields.Boolean(
string="Exclude invoice line from intrastat if this tax is present",
help="If this tax is present on an invoice line, this invoice "
"line will be skipped when generating Intrastat Product or "
"Service lines from invoices.",
)

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2020 Akretion France (https://akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="view_account_position_form" model="ir.ui.view">
<field name="name">intrastat.account.fiscal.position.form</field>
<field name="model">account.fiscal.position</field>
<field name="inherit_id" ref="account.view_account_position_form" />
<field name="arch" type="xml">
<field name="vat_required" position="after">
<field name="intrastat"/>
</field>
</field>
</record>
<record id="view_account_position_tree" model="ir.ui.view">
<field name="name">intrastat.account.fiscal.position.tree</field>
<field name="model">account.fiscal.position</field>
<field name="inherit_id" ref="account.view_account_position_tree" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="intrastat" optional="show"/>
</field>
</field>
</record>
</odoo>

View File

@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2011-2020 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).
-->
<odoo>
<record id="view_tax_form" model="ir.ui.view">
<field name="name">intrastat.base.tax</field>
<field name="model">account.tax</field>
<field name="inherit_id" ref="account.view_tax_form" />
<field name="arch" type="xml">
<group name="advanced_booleans" position="inside">
<field name="exclude_from_intrastat_if_present" />
</group>
</field>
</record>
</odoo>

View File

@@ -14,13 +14,13 @@
<xpath expr="//div[@id='analytic']" position="after">
<h2>Intrastat</h2>
<div class="row mt16 o_settings_container" id="intrastat">
<div class="col-xs-12 col-md-12 o_setting_box">
<div class="col-12 col-lg-12 o_setting_box" id="intrastat-settings">
<div class="o_setting_left_pane" />
<div class="o_setting_right_pane">
<div class="row">
<label
for="intrastat_remind_user_ids"
class="col-md-5 o_light_label"
class="col-md-5"
/>
<field
name="intrastat_remind_user_ids"

View File

@@ -0,0 +1 @@
from . import res_config_settings