intrastat_product_generic

This commit is contained in:
Luc De Meyer
2020-02-27 22:11:12 +01:00
parent b325f3eb6b
commit 034cd83688
6 changed files with 32 additions and 27 deletions

View File

@@ -1,5 +1,5 @@
# Copyright 2011-2017 Akretion (http://www.akretion.com)
# Copyright 2009-2019 Noviat (http://www.noviat.com)
# Copyright 2009-2020 Noviat (http://www.noviat.com)
# Copyright 2018 brain-tec AG (http://www.braintec-group.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Luc de Meyer <info@noviat.com>

View File

@@ -1,5 +1,5 @@
# Copyright 2011-2017 Akretion France (http://www.akretion.com)
# Copyright 2009-2018 Noviat (http://www.noviat.com)
# Copyright 2009-2020 Noviat (http://www.noviat.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Luc de Meyer <info@noviat.com>
@@ -58,9 +58,7 @@ class AccountMove(models.Model):
@api.model
def _default_src_dest_region_id(self):
rco = self.env["res.company"]
company = rco._company_default_get()
return company.intrastat_region_id
return self.env.company.intrastat_region_id
class AccountMoveLine(models.Model):

View File

@@ -5,6 +5,7 @@
import logging
from datetime import date, datetime
from dateutil.relativedelta import relativedelta
from odoo import _, api, fields, models
@@ -40,7 +41,7 @@ class IntrastatProductDeclaration(models.Model):
comodel_name="res.company",
string="Company",
readonly=True,
default=lambda self: self.env["res.company"]._company_default_get(),
default=lambda self: self._default_company_id(),
)
company_country_code = fields.Char(
compute="_compute_company_country_code",
@@ -148,6 +149,10 @@ class IntrastatProductDeclaration(models.Model):
)
valid = fields.Boolean(compute="_compute_check_validity", string="Valid")
@api.model
def _default_company_id(self):
return self.env.company
@api.model
def _get_type(self):
res = []

View File

@@ -1,7 +1,7 @@
# Copyright 2009-2018 Noviat nv/sa (www.noviat.com).
# Copyright 2009-2020 Noviat nv/sa (www.noviat.com).
# @author Luc de Meyer <info@noviat.com>
from odoo import fields, models
from odoo import api, fields, models
class IntrastatRegion(models.Model):
@@ -24,5 +24,9 @@ class IntrastatRegion(models.Model):
company_id = fields.Many2one(
comodel_name="res.company",
string="Company",
default=lambda self: self.env["res.company"]._company_default_get(),
default=lambda self: self._default_company_id(),
)
@api.model
def _default_company_id(self):
return self.env.company

View File

@@ -1,5 +1,5 @@
# Copyright 2011-2017 Akretion France (http://www.akretion.com)
# Copyright 2009-2018 Noviat (http://www.noviat.com)
# Copyright 2009-2020 Noviat (http://www.noviat.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Luc de Meyer <info@noviat.com>
@@ -23,9 +23,13 @@ class IntrastatTransaction(models.Model):
company_id = fields.Many2one(
comodel_name="res.company",
string="Company",
default=lambda self: self.env["res.company"]._company_default_get(),
default=lambda self: self._default_company_id(),
)
@api.model
def _default_company_id(self):
return self.env.company
@api.depends("code", "description")
def name_get(self):
res = []

View File

@@ -1,20 +1,14 @@
# Copyright 2009-2018 Noviat.
# Copyright 2009-2020 Noviat.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Generic Intrastat Product Declaration',
'version': '12.0.1.0.0',
'category': 'Accounting & Finance',
'website': 'https://github.com/OCA/intrastat',
'author': 'Noviat,'
'Odoo Community Association (OCA)',
'license': 'AGPL-3',
'installable': True,
'depends': [
'intrastat_product',
],
'data': [
'security/intrastat_security.xml',
'views/intrastat_product.xml'
],
"name": "Generic Intrastat Product Declaration",
"version": "13.0.1.0.0",
"category": "Accounting & Finance",
"website": "https://github.com/OCA/intrastat",
"author": "Noviat," "Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": ["intrastat_product"],
"data": ["security/intrastat_security.xml", "views/intrastat_product.xml"],
}