mirror of
https://github.com/OCA/intrastat-extrastat.git
synced 2025-02-16 17:13:41 +02:00
[MIG] intrastat_product to v17
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
{
|
||||
"name": "Intrastat Product",
|
||||
"version": "16.0.1.6.1",
|
||||
"version": "17.0.1.0.0",
|
||||
"category": "Intrastat",
|
||||
"license": "AGPL-3",
|
||||
"summary": "Base module for Intrastat Product",
|
||||
|
||||
@@ -3,17 +3,17 @@
|
||||
import logging
|
||||
|
||||
|
||||
def pre_init_hook(cr):
|
||||
def pre_init_hook(env):
|
||||
"""Prepopulate stored computed fields for faster installation"""
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.info("Prepopulating stored computed fields")
|
||||
cr.execute(
|
||||
env.cr.execute(
|
||||
"""
|
||||
alter table account_move
|
||||
add column if not exists src_dest_country_id integer;
|
||||
"""
|
||||
)
|
||||
cr.execute(
|
||||
env.cr.execute(
|
||||
"""
|
||||
with countries as (
|
||||
select am.id as move_id,
|
||||
|
||||
@@ -3,7 +3,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 Command, api, fields, models
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
@@ -73,9 +73,9 @@ class AccountMove(models.Model):
|
||||
for line in inv.invoice_line_ids:
|
||||
vals = self._get_intrastat_line_vals(line)
|
||||
if vals:
|
||||
line_vals.append(vals)
|
||||
line_vals.append(Command.create(vals))
|
||||
if line_vals:
|
||||
inv.intrastat_line_ids = [(0, 0, x) for x in line_vals]
|
||||
inv.intrastat_line_ids = line_vals
|
||||
|
||||
def _get_intrastat_line_vals(self, line):
|
||||
vals = {}
|
||||
|
||||
@@ -10,7 +10,7 @@ from datetime import date
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from stdnum.vatin import is_valid
|
||||
|
||||
from odoo import _, api, fields, models
|
||||
from odoo import Command, _, api, fields, models
|
||||
from odoo.exceptions import RedirectWarning, UserError, ValidationError
|
||||
from odoo.tools import float_is_zero
|
||||
|
||||
@@ -46,8 +46,6 @@ class IntrastatProductDeclaration(models.Model):
|
||||
comodel_name="res.company",
|
||||
string="Company",
|
||||
required=True,
|
||||
readonly=True,
|
||||
states={"draft": [("readonly", False)]},
|
||||
default=lambda self: self.env.company,
|
||||
)
|
||||
company_country_code = fields.Char(
|
||||
@@ -65,11 +63,7 @@ class IntrastatProductDeclaration(models.Model):
|
||||
note = fields.Html(
|
||||
string="Notes",
|
||||
)
|
||||
year = fields.Char(
|
||||
required=True,
|
||||
readonly=True,
|
||||
states={"draft": [("readonly", False)]},
|
||||
)
|
||||
year = fields.Char(required=True)
|
||||
month = fields.Selection(
|
||||
selection=[
|
||||
("01", "01"),
|
||||
@@ -86,8 +80,6 @@ class IntrastatProductDeclaration(models.Model):
|
||||
("12", "12"),
|
||||
],
|
||||
required=True,
|
||||
readonly=True,
|
||||
states={"draft": [("readonly", False)]},
|
||||
)
|
||||
year_month = fields.Char(
|
||||
compute="_compute_year_month",
|
||||
@@ -101,27 +93,21 @@ class IntrastatProductDeclaration(models.Model):
|
||||
string="Type",
|
||||
required=True,
|
||||
tracking=True,
|
||||
readonly=True,
|
||||
states={"draft": [("readonly", False)]},
|
||||
)
|
||||
action = fields.Selection(
|
||||
selection="_get_action",
|
||||
required=True,
|
||||
default="replace",
|
||||
states={"done": [("readonly", True)]},
|
||||
tracking=True,
|
||||
)
|
||||
revision = fields.Integer(
|
||||
default=1,
|
||||
states={"done": [("readonly", True)]},
|
||||
help="Used to keep track of changes",
|
||||
)
|
||||
computation_line_ids = fields.One2many(
|
||||
comodel_name="intrastat.product.computation.line",
|
||||
inverse_name="parent_id",
|
||||
string="Intrastat Product Computation Lines",
|
||||
readonly=True,
|
||||
states={"draft": [("readonly", False)]},
|
||||
)
|
||||
declaration_line_ids = fields.One2many(
|
||||
comodel_name="intrastat.product.declaration.line",
|
||||
@@ -147,9 +133,8 @@ class IntrastatProductDeclaration(models.Model):
|
||||
reporting_level = fields.Selection(
|
||||
selection="_get_reporting_level",
|
||||
compute="_compute_reporting_level",
|
||||
readonly=True,
|
||||
readonly=False,
|
||||
store=True,
|
||||
states={"draft": [("readonly", False)]},
|
||||
)
|
||||
xml_attachment_id = fields.Many2one("ir.attachment", string="XML Attachment")
|
||||
xml_attachment_datas = fields.Binary(
|
||||
@@ -241,8 +226,7 @@ class IntrastatProductDeclaration(models.Model):
|
||||
this.reporting_level = reporting_level
|
||||
|
||||
@api.depends("declaration_type", "year_month")
|
||||
def name_get(self):
|
||||
res = []
|
||||
def _compute_display_name(self):
|
||||
type2label = dict(
|
||||
self.fields_get("declaration_type", "selection")["declaration_type"][
|
||||
"selection"
|
||||
@@ -254,8 +238,7 @@ class IntrastatProductDeclaration(models.Model):
|
||||
year_month=rec.year_month,
|
||||
declaration_type=type2label.get(rec.declaration_type),
|
||||
)
|
||||
res.append((rec.id, name))
|
||||
return res
|
||||
rec.display_name = name
|
||||
|
||||
def copy(self, default=None):
|
||||
self.ensure_one()
|
||||
@@ -639,8 +622,10 @@ class IntrastatProductDeclaration(models.Model):
|
||||
if float_is_zero(inv_line.quantity, precision_digits=qty_prec):
|
||||
_logger.info(
|
||||
"Skipping invoice line %s qty %s "
|
||||
"of invoice %s. Reason: qty = 0"
|
||||
% (inv_line.name, inv_line.quantity, invoice.name)
|
||||
"of invoice %s. Reason: qty = 0",
|
||||
inv_line.name,
|
||||
inv_line.quantity,
|
||||
invoice.name,
|
||||
)
|
||||
continue
|
||||
|
||||
@@ -652,8 +637,10 @@ class IntrastatProductDeclaration(models.Model):
|
||||
_logger.info(
|
||||
"Skipping invoice line %s qty %s "
|
||||
"of invoice %s. Reason: partner_country = "
|
||||
"company country"
|
||||
% (inv_line.name, inv_line.quantity, invoice.name)
|
||||
"company country",
|
||||
inv_line.name,
|
||||
inv_line.quantity,
|
||||
invoice.name,
|
||||
)
|
||||
continue
|
||||
|
||||
@@ -670,8 +657,10 @@ class IntrastatProductDeclaration(models.Model):
|
||||
else:
|
||||
_logger.info(
|
||||
"Skipping invoice line %s qty %s "
|
||||
"of invoice %s. Reason: no product nor Intrastat Code"
|
||||
% (inv_line.name, inv_line.quantity, invoice.name)
|
||||
"of invoice %s. Reason: no product nor Intrastat Code",
|
||||
inv_line.name,
|
||||
inv_line.quantity,
|
||||
invoice.name,
|
||||
)
|
||||
continue
|
||||
|
||||
@@ -775,10 +764,8 @@ class IntrastatProductDeclaration(models.Model):
|
||||
messages, dict
|
||||
): # 2 layers of dict (partner, product)
|
||||
for message, origins in messages.items():
|
||||
note += "<li>%s <small>(%s)</small></li>" % (
|
||||
message,
|
||||
", ".join(origins),
|
||||
)
|
||||
origin_str = ", ".join(origins)
|
||||
note += f"<li>{message} <small>({origin_str})</small></li>"
|
||||
else: # 1st layer=dict, 2nd layer=set (invoice)
|
||||
for message in messages:
|
||||
note += "<li>%s</li>" % message
|
||||
@@ -818,12 +805,11 @@ class IntrastatProductDeclaration(models.Model):
|
||||
vals = {"note": self._prepare_html_note(notedict, key2label)}
|
||||
if not lines:
|
||||
vals["action"] = "nihil"
|
||||
vals["note"] += "<h3>%s</h3><p>%s</p>" % (
|
||||
_("No records found for the selected period !"),
|
||||
_("The declaration Action has been set to <em>nihil</em>."),
|
||||
)
|
||||
nihil_title = _("No records found for the selected period !")
|
||||
nihil_note = _("The declaration Action has been set to <em>nihil</em>.")
|
||||
vals["note"] += f"<h3>{nihil_title}</h3><p>{nihil_note}</p>"
|
||||
else:
|
||||
vals["computation_line_ids"] = [(0, 0, x) for x in lines]
|
||||
vals["computation_line_ids"] = [Command.create(x) for x in lines]
|
||||
|
||||
self.write(vals)
|
||||
if vals["note"]:
|
||||
@@ -852,12 +838,8 @@ class IntrastatProductDeclaration(models.Model):
|
||||
ipdl = self.declaration_line_ids
|
||||
line_number = 1
|
||||
for cl_lines in dl_group.values():
|
||||
# TODO v17: pass line_number as argument of _prepare_declaration_line()
|
||||
# we can't afford to modify the proto of _prepare_declaration_line() in v16
|
||||
vals = cl_lines._prepare_declaration_line()
|
||||
declaration_line = ipdl.with_context(
|
||||
default_line_number=line_number
|
||||
).create(vals)
|
||||
vals = cl_lines._prepare_declaration_line(line_number)
|
||||
declaration_line = ipdl.create(vals)
|
||||
cl_lines.write({"declaration_line_id": declaration_line.id})
|
||||
line_number += 1
|
||||
|
||||
@@ -1198,7 +1180,7 @@ class IntrastatProductComputationLine(models.Model):
|
||||
fields_to_sum = ["weight", "suppl_unit_qty"]
|
||||
return fields_to_sum
|
||||
|
||||
def _prepare_declaration_line(self):
|
||||
def _prepare_declaration_line(self, line_number):
|
||||
fields_to_sum = self._fields_to_sum()
|
||||
vals = self[0]._prepare_grouped_fields(fields_to_sum)
|
||||
for computation_line in self:
|
||||
@@ -1219,6 +1201,7 @@ class IntrastatProductComputationLine(models.Model):
|
||||
if vals["intrastat_unit_id"] and not vals["suppl_unit_qty"]:
|
||||
vals["suppl_unit_qty"] = 1
|
||||
vals["amount_company_currency"] = int(round(vals["amount_company_currency"]))
|
||||
vals["line_number"] = line_number
|
||||
return vals
|
||||
|
||||
|
||||
|
||||
@@ -28,12 +28,10 @@ class IntrastatTransaction(models.Model):
|
||||
active = fields.Boolean(default=True)
|
||||
|
||||
@api.depends("code", "description")
|
||||
def name_get(self):
|
||||
res = []
|
||||
def _compute_display_name(self):
|
||||
for this in self:
|
||||
name = this.code
|
||||
if this.description:
|
||||
name += " " + this.description
|
||||
name = shorten(name, 55)
|
||||
res.append((this.id, name))
|
||||
return res
|
||||
this.display_name = name
|
||||
|
||||
@@ -19,9 +19,6 @@ class IntrastatTransportMode(models.Model):
|
||||
description = fields.Char(translate=True)
|
||||
|
||||
@api.depends("name", "code")
|
||||
def name_get(self):
|
||||
res = []
|
||||
def _compute_display_name(self):
|
||||
for mode in self:
|
||||
name = f"{mode.code}. {mode.name}"
|
||||
res.append((mode.id, name))
|
||||
return res
|
||||
mode.display_name = f"{mode.code}. {mode.name}"
|
||||
|
||||
@@ -9,6 +9,7 @@ from odoo import fields, models
|
||||
class IntrastatUnit(models.Model):
|
||||
_name = "intrastat.unit"
|
||||
_description = "Intrastat Supplementary Units"
|
||||
_order = "name"
|
||||
|
||||
name = fields.Char(required=True)
|
||||
description = fields.Char(required=True)
|
||||
@@ -19,3 +20,11 @@ class IntrastatUnit(models.Model):
|
||||
"to this Intrastat Supplementary Unit.",
|
||||
)
|
||||
active = fields.Boolean(default=True)
|
||||
|
||||
_sql_constraints = [
|
||||
(
|
||||
"name_uniq",
|
||||
"unique(name)",
|
||||
"An intrastat supplementary unit with the same name already exists!",
|
||||
)
|
||||
]
|
||||
|
||||
@@ -29,7 +29,6 @@ class ResCompany(models.Model):
|
||||
intrastat = fields.Char(
|
||||
string="Intrastat Declaration",
|
||||
store=True,
|
||||
readonly=True,
|
||||
compute="_compute_intrastat",
|
||||
)
|
||||
intrastat_region_id = fields.Many2one(
|
||||
|
||||
@@ -205,20 +205,25 @@ class IntrastatProductDeclarationXlsx(models.AbstractModel):
|
||||
res = []
|
||||
wanted_list_computation = declarations._xls_computation_line_fields()
|
||||
wanted_list_declaration = declarations._xls_declaration_line_fields()
|
||||
for declaration in declarations:
|
||||
dname = declaration.display_name
|
||||
type2label = dict(
|
||||
self.env["intrastat.product.declaration"].fields_get(
|
||||
"declaration_type", "selection"
|
||||
)["declaration_type"]["selection"]
|
||||
)
|
||||
for decl in declarations:
|
||||
dname = " ".join([decl.year_month, type2label[decl.declaration_type]])
|
||||
res += [
|
||||
{
|
||||
"ws_name": "%s %s" % (dname, _("comput.")),
|
||||
"ws_name": " ".join([dname, _("comput.")]),
|
||||
"generate_ws_method": "_intrastat_report_computation",
|
||||
"title": "%s : %s" % (dname, _("Computation Lines")),
|
||||
"title": " : ".join([dname, _("Computation Lines")]),
|
||||
"wanted_list": wanted_list_computation,
|
||||
"col_specs": template,
|
||||
},
|
||||
{
|
||||
"ws_name": "%s %s" % (dname, _("decl.")),
|
||||
"ws_name": " ".join([dname, _("decl.")]),
|
||||
"generate_ws_method": "_intrastat_report_declaration",
|
||||
"title": "%s : %s" % (dname, _("Declaration Lines")),
|
||||
"title": " : ".join([dname, _("Declaration Lines")]),
|
||||
"wanted_list": wanted_list_declaration,
|
||||
"col_specs": template,
|
||||
},
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_intrastat_unit_read,Read access on Intrastat Supplementary Units to everybody,model_intrastat_unit,,1,0,0,0
|
||||
access_intrastat_unit_read,Read access on Intrastat Supplementary Units to employees,model_intrastat_unit,base.group_user,1,0,0,0
|
||||
access_intrastat_unit_full,Full access on Intrastat Supplementary Units to Finance manager,model_intrastat_unit,account.group_account_manager,1,1,1,1
|
||||
access_intrastat_transaction_read,Read access on Intrastat Transaction Types to everybody,model_intrastat_transaction,,1,0,0,0
|
||||
access_intrastat_transaction_read,Read access on Intrastat Transaction Types to employees,model_intrastat_transaction,base.group_user,1,0,0,0
|
||||
access_intrastat_transaction_full,Full access on Intrastat Transaction Types to Finance manager,model_intrastat_transaction,account.group_account_manager,1,1,1,1
|
||||
access_intrastat_transport_mode_read,Read access on Intrastat Transport Modes to everybody,model_intrastat_transport_mode,,1,0,0,0
|
||||
access_intrastat_transport_mode_read,Read access on Intrastat Transport Modes to employees,model_intrastat_transport_mode,base.group_user,1,0,0,0
|
||||
access_intrastat_transport_mode_full,Full access on Intrastat Transport Modes to Finance manager,model_intrastat_transport_mode,account.group_account_manager,1,1,1,1
|
||||
access_intrastat_region_read,Read access on Intrastat Regions,model_intrastat_region,,1,0,0,0
|
||||
access_intrastat_region_read,Read access on Intrastat Regions to employees,model_intrastat_region,base.group_user,1,0,0,0
|
||||
access_intrastat_region_full,Full access on Intrastat Regions,model_intrastat_region,account.group_account_manager,1,1,1,1
|
||||
access_hs_code_financial_mgr_full,Full access on H.S. Code to financial mgr,product_harmonized_system.model_hs_code,account.group_account_manager,1,1,1,1
|
||||
access_read_sale_move_intrastat_line,Read access to Sale User on Invoice Intrastat Lines,model_account_move_intrastat_line,sales_team.group_sale_salesman,1,0,0,0
|
||||
|
||||
|
@@ -17,10 +17,7 @@ class TestIntrastatProductPurchase(IntrastatPurchaseCommon):
|
||||
with freeze_time(date_order):
|
||||
self._create_purchase_order()
|
||||
self.purchase.button_confirm()
|
||||
self.purchase.picking_ids.action_assign()
|
||||
for line in self.purchase.picking_ids.move_line_ids:
|
||||
line.qty_done = line.reserved_uom_qty
|
||||
self.purchase.picking_ids._action_done()
|
||||
self.purchase.picking_ids.button_validate()
|
||||
self.assertEqual("done", self.purchase.picking_ids.state)
|
||||
|
||||
with freeze_time(date_order):
|
||||
|
||||
@@ -13,10 +13,7 @@ class TestIntrastatProductSale(IntrastatSaleCommon):
|
||||
def test_sale_to_invoice_default(self):
|
||||
self._create_sale_order(self.customer)
|
||||
self.sale.action_confirm()
|
||||
self.sale.picking_ids.action_assign()
|
||||
for line in self.sale.picking_ids.move_line_ids:
|
||||
line.qty_done = line.reserved_uom_qty
|
||||
self.sale.picking_ids._action_done()
|
||||
self.sale.picking_ids.button_validate()
|
||||
self.assertEqual("done", self.sale.picking_ids.state)
|
||||
|
||||
invoice = self.sale._create_invoices()
|
||||
@@ -34,10 +31,7 @@ class TestIntrastatProductSale(IntrastatSaleCommon):
|
||||
# Set intrastat transport mode to rail
|
||||
self.sale.intrastat_transport_id = self.transport_rail
|
||||
self.sale.action_confirm()
|
||||
self.sale.picking_ids.action_assign()
|
||||
for line in self.sale.picking_ids.move_line_ids:
|
||||
line.qty_done = line.reserved_uom_qty
|
||||
self.sale.picking_ids._action_done()
|
||||
self.sale.picking_ids.button_validate()
|
||||
self.assertEqual("done", self.sale.picking_ids.state)
|
||||
|
||||
invoice = self.sale._create_invoices()
|
||||
@@ -57,10 +51,7 @@ class TestIntrastatProductSale(IntrastatSaleCommon):
|
||||
# Set intrastat transport mode to rail
|
||||
self.sale.intrastat_transport_id = self.transport_rail
|
||||
self.sale.action_confirm()
|
||||
self.sale.picking_ids.action_assign()
|
||||
for line in self.sale.picking_ids.move_line_ids:
|
||||
line.qty_done = line.reserved_uom_qty
|
||||
self.sale.picking_ids._action_done()
|
||||
self.sale.picking_ids.button_validate()
|
||||
self.assertEqual("done", self.sale.picking_ids.state)
|
||||
|
||||
with freeze_time(date_order):
|
||||
@@ -96,10 +87,7 @@ class TestIntrastatProductSale(IntrastatSaleCommon):
|
||||
# Set intrastat transport mode to rail
|
||||
self.sale.intrastat_transport_id = self.transport_rail
|
||||
self.sale.action_confirm()
|
||||
self.sale.picking_ids.action_assign()
|
||||
for line in self.sale.picking_ids.move_line_ids:
|
||||
line.qty_done = line.reserved_uom_qty
|
||||
self.sale.picking_ids._action_done()
|
||||
self.sale.picking_ids.button_validate()
|
||||
self.assertEqual("done", self.sale.picking_ids.state)
|
||||
|
||||
with freeze_time(date_order):
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<field name="intrastat" invisible="1" />
|
||||
<field
|
||||
name="intrastat_transport_id"
|
||||
attrs="{'invisible': [('intrastat', '!=', 'extended')]}"
|
||||
invisible="intrastat != 'extended'"
|
||||
widget="selection"
|
||||
/>
|
||||
<field name="src_dest_country_id" string="Destination Country" />
|
||||
@@ -24,7 +24,7 @@
|
||||
id="intrastat_lines"
|
||||
string="Intrastat transaction details"
|
||||
groups="intrastat_product.group_invoice_intrastat_transaction_details"
|
||||
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'))]}"
|
||||
invisible="move_type not in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')"
|
||||
>
|
||||
<div>
|
||||
<button
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<button
|
||||
name="action_gather"
|
||||
type="object"
|
||||
attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('action', '=', 'nihil')]}"
|
||||
invisible="state != 'draft' or action == 'nihil'"
|
||||
string="Generate Lines from Invoices"
|
||||
class="btn-primary"
|
||||
groups="account.group_account_user"
|
||||
@@ -19,7 +19,7 @@
|
||||
string="Confirm"
|
||||
type="object"
|
||||
class="btn-primary"
|
||||
states="draft"
|
||||
invisible="state != 'draft'"
|
||||
help="Generate declaration lines"
|
||||
groups="account.group_account_user"
|
||||
/>
|
||||
@@ -28,7 +28,7 @@
|
||||
string="Generate XML File"
|
||||
type="object"
|
||||
class="btn-primary"
|
||||
states="confirmed"
|
||||
invisible="state != 'confirmed'"
|
||||
help="Generate XML file and set declaration to 'Done'"
|
||||
groups="account.group_account_user"
|
||||
/>
|
||||
@@ -36,7 +36,7 @@
|
||||
name="back2draft"
|
||||
string="Back to Draft"
|
||||
type="object"
|
||||
states="confirmed,done"
|
||||
invisible="state == 'draft'"
|
||||
confirm="Are you sure you want to go back to draft?"
|
||||
groups="account.group_account_user"
|
||||
/>
|
||||
@@ -55,10 +55,13 @@
|
||||
</div>
|
||||
<group name="top-block">
|
||||
<group name="properties-1">
|
||||
<field name="year" />
|
||||
<field name="month" />
|
||||
<field name="declaration_type" />
|
||||
<field name="reporting_level" />
|
||||
<field name="year" readonly="state != 'draft'" />
|
||||
<field name="month" readonly="state != 'draft'" />
|
||||
<field
|
||||
name="declaration_type"
|
||||
readonly="state != 'draft'"
|
||||
/>
|
||||
<field name="reporting_level" readonly="state != 'draft'" />
|
||||
<field
|
||||
name="xml_attachment_datas"
|
||||
filename="xml_attachment_name"
|
||||
@@ -68,8 +71,8 @@
|
||||
<field name="xml_attachment_id" invisible="1" />
|
||||
</group>
|
||||
<group name="properties-2">
|
||||
<field name="action" />
|
||||
<field name="revision" />
|
||||
<field name="action" readonly="state == 'done'" />
|
||||
<field name="revision" readonly="state == 'done'" />
|
||||
<field
|
||||
name="total_amount"
|
||||
widget="monetary"
|
||||
@@ -79,6 +82,7 @@
|
||||
<field
|
||||
name="company_id"
|
||||
groups="base.group_multi_company"
|
||||
readonly="state != 'draft'"
|
||||
/>
|
||||
<field name="company_country_code" invisible="1" />
|
||||
<field name="currency_id" invisible="1" />
|
||||
@@ -88,6 +92,7 @@
|
||||
<page string="Transactions" name="computation_lines">
|
||||
<field
|
||||
name="computation_line_ids"
|
||||
readonly="state != 'draft'"
|
||||
context="{'declaration_type': declaration_type, 'reporting_level': reporting_level}"
|
||||
nolabel="1"
|
||||
/>
|
||||
@@ -95,7 +100,7 @@
|
||||
<page
|
||||
string="Declaration Lines"
|
||||
name="declaration_lines"
|
||||
states="confirmed,done"
|
||||
invisible="state == 'draft'"
|
||||
>
|
||||
<field
|
||||
name="declaration_line_ids"
|
||||
@@ -165,6 +170,11 @@
|
||||
string="Draft"
|
||||
domain="[('state', '=', 'draft')]"
|
||||
/>
|
||||
<filter
|
||||
name="confirmed"
|
||||
string="Confirmed"
|
||||
domain="[('state', '=', 'confirmed')]"
|
||||
/>
|
||||
<filter name="done" string="Done" domain="[('state', '=', 'done')]" />
|
||||
<group string="Group By" name="group_by">
|
||||
<filter
|
||||
@@ -177,6 +187,11 @@
|
||||
string="Type"
|
||||
context="{'group_by': 'declaration_type'}"
|
||||
/>
|
||||
<filter
|
||||
name="state_group_by"
|
||||
string="State"
|
||||
context="{'group_by': 'state'}"
|
||||
/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
@@ -220,15 +235,17 @@
|
||||
<field name="product_id" />
|
||||
<field
|
||||
name="hs_code_id"
|
||||
attrs="{'required': [('reporting_level', '=', 'extended')], 'invisible': [('reporting_level', '!=', 'extended')]}"
|
||||
required="reporting_level == 'extended'"
|
||||
invisible="reporting_level != 'extended'"
|
||||
/>
|
||||
<field
|
||||
name="src_dest_country_id"
|
||||
attrs="{'invisible': [('reporting_level', '!=', 'extended')]}"
|
||||
invisible="reporting_level != 'extended'"
|
||||
/>
|
||||
<field
|
||||
name="src_dest_country_code"
|
||||
attrs="{'required': [('reporting_level', '=', 'extended')], 'invisible': [('reporting_level', '!=', 'extended')]}"
|
||||
required="reporting_level == 'extended'"
|
||||
invisible="reporting_level != 'extended'"
|
||||
/>
|
||||
<field
|
||||
name="amount_company_currency"
|
||||
@@ -244,42 +261,45 @@
|
||||
<field name="transaction_id" required="1" />
|
||||
<label
|
||||
for="weight"
|
||||
attrs="{'required': [('reporting_level', '=', 'extended')], 'invisible': [('reporting_level', '!=', 'extended')]}"
|
||||
required="reporting_level == 'extended'"
|
||||
invisible="reporting_level != 'extended'"
|
||||
/>
|
||||
<div
|
||||
name="weight"
|
||||
attrs="{'required': [('reporting_level', '=', 'extended')], 'invisible': [('reporting_level', '!=', 'extended')]}"
|
||||
required="reporting_level == 'extended'"
|
||||
invisible="reporting_level != 'extended'"
|
||||
>
|
||||
<field name="weight" class="oe_inline" /> Kg
|
||||
<field name="weight" class="oe_inline" /> kg
|
||||
</div>
|
||||
<field
|
||||
name="suppl_unit_qty"
|
||||
attrs="{'required': [('reporting_level', '=', 'extended'), ('intrastat_unit_id', '!=', False)], 'invisible': ['|', ('reporting_level', '!=', 'extended'), ('intrastat_unit_id', '=', False)]}"
|
||||
required="reporting_level == 'extended' and intrastat_unit_id"
|
||||
invisible="reporting_level != 'extended' or not intrastat_unit_id"
|
||||
/>
|
||||
<field
|
||||
name="intrastat_unit_id"
|
||||
attrs="{'invisible': ['|', ('reporting_level', '!=', 'extended'), ('intrastat_unit_id', '=', False)]}"
|
||||
invisible="reporting_level != 'extended' or not intrastat_unit_id"
|
||||
/>
|
||||
<field
|
||||
name="transport_id"
|
||||
attrs="{'required': [('reporting_level', '=', 'extended')], 'invisible': [('reporting_level', '!=', 'extended')]}"
|
||||
required="reporting_level == 'extended'"
|
||||
invisible="reporting_level != 'extended'"
|
||||
/>
|
||||
<field name="incoterm_id" invisible="1" />
|
||||
<field
|
||||
name="region_id"
|
||||
attrs="{'invisible': [('reporting_level', '!=', 'extended')]}"
|
||||
/>
|
||||
<field name="region_id" invisible="reporting_level != 'extended'" />
|
||||
<field
|
||||
name="region_code"
|
||||
attrs="{'required': [('reporting_level', '=', 'extended')], 'invisible': [('reporting_level', '!=', 'extended')]}"
|
||||
required="reporting_level == 'extended'"
|
||||
invisible="reporting_level != 'extended'"
|
||||
/>
|
||||
<field
|
||||
name="product_origin_country_id"
|
||||
attrs="{'invisible': [('reporting_level', '!=', 'extended')]}"
|
||||
invisible="reporting_level != 'extended'"
|
||||
/>
|
||||
<field
|
||||
name="product_origin_country_code"
|
||||
attrs="{'invisible': [('reporting_level', '!=', 'extended')], 'required': [('reporting_level', '=', 'extended')]}"
|
||||
required="reporting_level == 'extended'"
|
||||
invisible="reporting_level != 'extended'"
|
||||
/>
|
||||
<field name="partner_id" />
|
||||
<field name="vat" />
|
||||
@@ -298,26 +318,26 @@
|
||||
<tree>
|
||||
<field
|
||||
name="parent_id"
|
||||
invisible="not context.get('intrastat_product_computation_line_main_view')"
|
||||
column_invisible="not context.get('intrastat_product_computation_line_main_view')"
|
||||
/>
|
||||
<field name="declaration_type" invisible="1" />
|
||||
<field name="reporting_level" invisible="1" />
|
||||
<field name="company_country_code" invisible="1" />
|
||||
<field name="declaration_type" column_invisible="1" />
|
||||
<field name="reporting_level" column_invisible="1" />
|
||||
<field name="company_country_code" column_invisible="1" />
|
||||
<field name="product_id" optional="show" />
|
||||
<field
|
||||
name="hs_code_id"
|
||||
optional="show"
|
||||
attrs="{'column_invisible': [('parent.reporting_level', '!=', 'extended')]}"
|
||||
column_invisible="parent.reporting_level != 'extended'"
|
||||
/>
|
||||
<field
|
||||
name="src_dest_country_id"
|
||||
optional="hide"
|
||||
attrs="{'column_invisible': [('parent.reporting_level', '!=', 'extended')]}"
|
||||
column_invisible="parent.reporting_level != 'extended'"
|
||||
/>
|
||||
<field
|
||||
name="src_dest_country_code"
|
||||
optional="show"
|
||||
attrs="{'column_invisible': [('parent.reporting_level', '!=', 'extended')]}"
|
||||
column_invisible="parent.reporting_level != 'extended'"
|
||||
/>
|
||||
<field name="amount_company_currency" sum="1" />
|
||||
<field
|
||||
@@ -329,44 +349,45 @@
|
||||
<field
|
||||
name="weight"
|
||||
optional="show"
|
||||
attrs="{'column_invisible': [('parent.reporting_level', '!=', 'extended')]}"
|
||||
column_invisible="parent.reporting_level != 'extended'"
|
||||
/>
|
||||
<field
|
||||
name="suppl_unit_qty"
|
||||
optional="show"
|
||||
attrs="{'column_invisible': [('parent.reporting_level', '!=', 'extended')], 'invisible': [('intrastat_unit_id', '=', False)]}"
|
||||
column_invisible="parent.reporting_level != 'extended'"
|
||||
invisible="not intrastat_unit_id"
|
||||
/>
|
||||
<field
|
||||
name="intrastat_unit_id"
|
||||
optional="show"
|
||||
attrs="{'column_invisible': [('parent.reporting_level', '!=', 'extended')]}"
|
||||
column_invisible="parent.reporting_level != 'extended'"
|
||||
/>
|
||||
<field
|
||||
name="transport_id"
|
||||
optional="show"
|
||||
attrs="{'column_invisible': [('parent.reporting_level', '!=', 'extended')]}"
|
||||
column_invisible="parent.reporting_level != 'extended'"
|
||||
/>
|
||||
<field
|
||||
name="region_id"
|
||||
optional="hide"
|
||||
attrs="{'column_invisible': [('parent.reporting_level', '!=', 'extended')]}"
|
||||
column_invisible="parent.reporting_level != 'extended'"
|
||||
/>
|
||||
<field
|
||||
name="region_code"
|
||||
optional="show"
|
||||
attrs="{'column_invisible': [('parent.reporting_level', '!=', 'extended')]}"
|
||||
column_invisible="parent.reporting_level != 'extended'"
|
||||
/>
|
||||
<field
|
||||
name="product_origin_country_id"
|
||||
optional="hide"
|
||||
string="Product C/O"
|
||||
attrs="{'column_invisible': [('parent.reporting_level', '!=', 'extended')]}"
|
||||
column_invisible="parent.reporting_level != 'extended'"
|
||||
/>
|
||||
<field
|
||||
name="product_origin_country_code"
|
||||
optional="show"
|
||||
string="Product C/O"
|
||||
attrs="{'column_invisible': [('parent.reporting_level', '!=', 'extended')]}"
|
||||
column_invisible="parent.reporting_level != 'extended'"
|
||||
/>
|
||||
<field name="vat" optional="show" />
|
||||
<field name="invoice_id" optional="show" />
|
||||
@@ -389,11 +410,11 @@
|
||||
<field name="company_country_code" invisible="1" />
|
||||
<field
|
||||
name="hs_code_id"
|
||||
attrs="{'invisible': [('reporting_level', '!=', 'extended')]}"
|
||||
invisible="reporting_level != 'extended'"
|
||||
/>
|
||||
<field
|
||||
name="src_dest_country_code"
|
||||
attrs="{'invisible': [('reporting_level', '!=', 'extended')]}"
|
||||
invisible="reporting_level != 'extended'"
|
||||
/>
|
||||
<field
|
||||
name="amount_company_currency"
|
||||
@@ -402,36 +423,30 @@
|
||||
/>
|
||||
<field name="company_currency_id" invisible="1" />
|
||||
<field name="transaction_id" />
|
||||
<label
|
||||
for="weight"
|
||||
attrs="{'invisible': [('reporting_level', '!=', 'extended')]}"
|
||||
/>
|
||||
<div
|
||||
name="weight"
|
||||
attrs="{'invisible': [('reporting_level', '!=', 'extended')]}"
|
||||
>
|
||||
<label for="weight" invisible="reporting_level != 'extended'" />
|
||||
<div name="weight" invisible="reporting_level != 'extended'">
|
||||
<field name="weight" class="oe_inline" /> Kg
|
||||
</div>
|
||||
<field
|
||||
name="suppl_unit_qty"
|
||||
attrs="{'invisible': [('reporting_level', '!=', 'extended')]}"
|
||||
invisible="reporting_level != 'extended'"
|
||||
/>
|
||||
<field
|
||||
name="intrastat_unit_id"
|
||||
attrs="{'invisible': [('reporting_level', '!=', 'extended')]}"
|
||||
invisible="reporting_level != 'extended'"
|
||||
/>
|
||||
<field
|
||||
name="transport_id"
|
||||
attrs="{'invisible': [('reporting_level', '!=', 'extended')]}"
|
||||
invisible="reporting_level != 'extended'"
|
||||
/>
|
||||
<field
|
||||
name="region_code"
|
||||
attrs="{'invisible': [('reporting_level', '!=', 'extended')]}"
|
||||
invisible="reporting_level != 'extended'"
|
||||
/>
|
||||
<field name="incoterm_id" invisible="1" />
|
||||
<field
|
||||
name="product_origin_country_code"
|
||||
attrs="{'invisible': [('reporting_level', '!=', 'extended')]}"
|
||||
invisible="reporting_level != 'extended'"
|
||||
/>
|
||||
<field name="vat" />
|
||||
</group>
|
||||
@@ -448,11 +463,11 @@
|
||||
<tree>
|
||||
<field
|
||||
name="parent_id"
|
||||
invisible="not context.get('intrastat_product_declaration_line_main_view')"
|
||||
column_invisible="not context.get('intrastat_product_declaration_line_main_view')"
|
||||
/>
|
||||
<field name="declaration_type" invisible="1" />
|
||||
<field name="reporting_level" invisible="1" />
|
||||
<field name="company_country_code" invisible="1" />
|
||||
<field name="declaration_type" column_invisible="1" />
|
||||
<field name="reporting_level" column_invisible="1" />
|
||||
<field name="company_country_code" column_invisible="1" />
|
||||
<field
|
||||
name="line_number"
|
||||
optional="show"
|
||||
@@ -461,45 +476,46 @@
|
||||
/>
|
||||
<field
|
||||
name="hs_code_id"
|
||||
attrs="{'column_invisible': [('parent.reporting_level', '!=', 'extended')]}"
|
||||
column_invisible="parent.reporting_level != 'extended'"
|
||||
optional="show"
|
||||
/>
|
||||
<field
|
||||
name="src_dest_country_code"
|
||||
attrs="{'column_invisible': [('parent.reporting_level', '!=', 'extended')]}"
|
||||
column_invisible="parent.reporting_level != 'extended'"
|
||||
optional="show"
|
||||
/>
|
||||
<field name="amount_company_currency" sum="1" />
|
||||
<field name="transaction_code" />
|
||||
<field
|
||||
name="weight"
|
||||
attrs="{'column_invisible': [('parent.reporting_level', '!=', 'extended')]}"
|
||||
column_invisible="parent.reporting_level != 'extended'"
|
||||
optional="show"
|
||||
/>
|
||||
<field
|
||||
name="suppl_unit_qty"
|
||||
attrs="{'column_invisible': [('parent.reporting_level', '!=', 'extended')]}"
|
||||
column_invisible="parent.reporting_level != 'extended'"
|
||||
invisible="not intrastat_unit_id"
|
||||
optional="show"
|
||||
/>
|
||||
<field
|
||||
name="intrastat_unit_id"
|
||||
attrs="{'column_invisible': [('parent.reporting_level', '!=', 'extended')]}"
|
||||
column_invisible="parent.reporting_level != 'extended'"
|
||||
optional="show"
|
||||
/>
|
||||
<field
|
||||
name="transport_id"
|
||||
attrs="{'column_invisible': [('parent.reporting_level', '!=', 'extended')]}"
|
||||
column_invisible="parent.reporting_level != 'extended'"
|
||||
optional="show"
|
||||
/>
|
||||
<field
|
||||
name="region_code"
|
||||
attrs="{'column_invisible': [('parent.reporting_level', '!=', 'extended')]}"
|
||||
column_invisible="parent.reporting_level != 'extended'"
|
||||
optional="show"
|
||||
/>
|
||||
<field name="incoterm_id" invisible="1" />
|
||||
<field name="incoterm_id" column_invisible="1" />
|
||||
<field
|
||||
name="product_origin_country_code"
|
||||
attrs="{'column_invisible': [('parent.reporting_level', '!=', 'extended')]}"
|
||||
column_invisible="parent.reporting_level != 'extended'"
|
||||
string="Product C/O"
|
||||
optional="show"
|
||||
/>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
name="web_ribbon"
|
||||
title="Archived"
|
||||
bg_color="bg-danger"
|
||||
attrs="{'invisible': [('active', '=', True)]}"
|
||||
invisible="active"
|
||||
/>
|
||||
<field name="active" invisible="1" />
|
||||
<group name="main">
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
name="web_ribbon"
|
||||
text="Archived"
|
||||
bg_color="bg-danger"
|
||||
attrs="{'invisible': [('active', '=', True)]}"
|
||||
invisible="active"
|
||||
/>
|
||||
<group name="main">
|
||||
<field name="name" />
|
||||
|
||||
@@ -13,52 +13,53 @@
|
||||
ref="intrastat_base.view_intrastat_res_config_settings"
|
||||
/>
|
||||
<field name="arch" type="xml">
|
||||
<div id="intrastat-settings" position="inside">
|
||||
<div class="o_setting_left_pane" />
|
||||
<div
|
||||
class="o_setting_right_pane"
|
||||
id="intrastat-product-main-params"
|
||||
>
|
||||
<div class="row">
|
||||
<label for="intrastat_arrivals" class="col-md-5" />
|
||||
<xpath expr="//setting[@id='intrastat']/div" position="inside">
|
||||
<div class="row mt16">
|
||||
<label
|
||||
for="intrastat_arrivals"
|
||||
class="col-lg-5 o_light_label"
|
||||
/>
|
||||
<field name="intrastat_arrivals" />
|
||||
<field name="country_id" invisible="1" />
|
||||
</div>
|
||||
<div class="row">
|
||||
<label for="intrastat_dispatches" class="col-md-5" />
|
||||
<div class="row mt16">
|
||||
<label
|
||||
for="intrastat_dispatches"
|
||||
class="col-lg-5 o_light_label"
|
||||
/>
|
||||
<field name="intrastat_dispatches" />
|
||||
</div>
|
||||
<div class="row">
|
||||
<label for="intrastat_transport_id" class="col-md-5" />
|
||||
<div class="row mt16">
|
||||
<label
|
||||
for="intrastat_transport_id"
|
||||
class="col-lg-5 o_light_label"
|
||||
/>
|
||||
<field name="intrastat_transport_id" />
|
||||
</div>
|
||||
<div
|
||||
class="row"
|
||||
attrs="{'invisible': [('country_code', 'not in', ['BE'])]}"
|
||||
>
|
||||
<label for="intrastat_region_id" class="col-md-5" />
|
||||
class="row mt16"
|
||||
invisible="country_code not in ['BE']"
|
||||
>
|
||||
<label
|
||||
for="intrastat_region_id"
|
||||
class="col-lg-5 o_light_label"
|
||||
/>
|
||||
<field
|
||||
name="intrastat_region_id"
|
||||
domain="[('country_id','=', country_id)]"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="o_setting_left_pane">
|
||||
<field
|
||||
name="intrastat_accessory_costs"
|
||||
attrs="{'invisible': [('country_code', 'in', ['BE'])]}"
|
||||
name="intrastat_region_id"
|
||||
domain="[('country_id','=', country_id)]"
|
||||
/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<div class="row">
|
||||
<label
|
||||
for="intrastat_accessory_costs"
|
||||
class="col-12"
|
||||
attrs="{'invisible': [('country_code', 'in', ['BE'])]}"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
<xpath expr="//setting[@id='intrastat']" position="after">
|
||||
<setting
|
||||
id="intrastat-accessory_costs"
|
||||
string="Accessory Costs"
|
||||
invisible="country_code in ['BE']"
|
||||
help="Include Accessory Costs in Fiscal Value of Product"
|
||||
>
|
||||
<field name="intrastat_accessory_costs" />
|
||||
</setting>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<field name="incoterm" position="after">
|
||||
<field
|
||||
name="intrastat_transport_id"
|
||||
attrs="{'invisible': [('intrastat', '!=', 'extended')]}"
|
||||
invisible="intrastat != 'extended'"
|
||||
widget="selection"
|
||||
/>
|
||||
<field name="intrastat" invisible="1" />
|
||||
|
||||
Reference in New Issue
Block a user