From 0f518d433e38c8b086b066b5ecbe042abff27f8f Mon Sep 17 00:00:00 2001 From: Andreas Osim Date: Mon, 3 Oct 2022 17:38:24 +0200 Subject: [PATCH] Let intrastat code to be deactivated (instead of deletion) --- ext/custom-addons/dp_custom/i18n/de.po | 7 +++ ext/custom-addons/dp_custom/models/product.py | 11 ++++ .../dp_custom/models/res_partner.py | 12 +++++ .../dp_custom/security/ir.model.access.csv | 1 + .../dp_custom/views/account_views.xml | 2 +- .../dp_custom/views/product_views.xml | 52 +++++++++++++++++++ .../dp_custom/views/res_partner_views.xml | 1 + .../dp_custom/views/sale_views.xml | 2 +- .../dp_custom/views/stock_views.xml | 2 +- 9 files changed, 87 insertions(+), 3 deletions(-) diff --git a/ext/custom-addons/dp_custom/i18n/de.po b/ext/custom-addons/dp_custom/i18n/de.po index d7ee421a..e74195cf 100644 --- a/ext/custom-addons/dp_custom/i18n/de.po +++ b/ext/custom-addons/dp_custom/i18n/de.po @@ -18,6 +18,13 @@ msgstr "" "X-Launchpad-Export-Date: 2014-09-24 09:44+0000\n" "X-Generator: Launchpad (build 17196)\n" +#. module: dp_custom +#: model:ir.ui.view,arch_db:dp_custom.view_report_intrastat_code_tz_tree +#: model:ir.ui.view,arch_db:dp_custom.view_report_intrastat_code_tz_form +msgid "Active" +msgstr "Aktiv" + + #. module: dp_custom #: model:ir.ui.view,arch_db:dp_custom.view_sale_cart #: model:ir.ui.view,arch_db:dp_custom.view_cart_tree diff --git a/ext/custom-addons/dp_custom/models/product.py b/ext/custom-addons/dp_custom/models/product.py index 458aa7fd..0ca5c0f5 100644 --- a/ext/custom-addons/dp_custom/models/product.py +++ b/ext/custom-addons/dp_custom/models/product.py @@ -39,6 +39,17 @@ else: ssl._create_default_https_context = _create_unverified_https_context +class ReportIntrastatCode(models.Model): + _inherit = "report.intrastat.code" + + active = fields.Boolean(string='Active', default=True, help="If unchecked, it will allow you to hide the code without removing it.") + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + intrastat_id = fields.Many2one('report.intrastat.code', string='Intrastat Code') + class ProductXCategory(models.Model): _name = 'product.xcategory' _description = 'X-Kategorie' diff --git a/ext/custom-addons/dp_custom/models/res_partner.py b/ext/custom-addons/dp_custom/models/res_partner.py index a3da9ba4..8e5b868b 100644 --- a/ext/custom-addons/dp_custom/models/res_partner.py +++ b/ext/custom-addons/dp_custom/models/res_partner.py @@ -95,6 +95,7 @@ class Partner(models.Model): partner_flash = fields.Char() fax = fields.Char(string='Fax') user_id = fields.Many2one(track_visibility='onchange') + freight_category_id = fields.Many2one(comodel_name='res.partner.freight_category', string='Fracht-Kategorie') # make pricelist searchable (store=True) --> code copied from: \ext\odoo\addons\product\models\res_partner.py! # property_product_pricelist = fields.Many2one( @@ -690,6 +691,17 @@ class Partner(models.Model): return res +class ResPartnerFreightCategory(models.Model): + _name = 'res.partner.freight_category' + _description = 'Fracht-Kategorie' + _order = 'name' + + name = fields.Char(string='Fracht-Kategorie', required=True) + description = fields.Char(string='Beschreibung', required=True) + + _sql_constraints = [ + ('name_uniq', 'unique(name)', 'Die Fracht-Kategorie muss eindeutig sein') + ] class PartnerSector(models.Model): diff --git a/ext/custom-addons/dp_custom/security/ir.model.access.csv b/ext/custom-addons/dp_custom/security/ir.model.access.csv index b6101206..e52c6adc 100644 --- a/ext/custom-addons/dp_custom/security/ir.model.access.csv +++ b/ext/custom-addons/dp_custom/security/ir.model.access.csv @@ -13,3 +13,4 @@ access_commission_account_user,access_commission_account_user,model_commission_a access_commission_account_manager,access_commission_account_manager,model_commission_account,sales_team.group_sale_manager,1,1,1,1 access_res_confirmation_queue_user,access_res_confirmation_queue_user,model_res_confirmation_queue,base.group_user,1,1,1,1 access_sale_cart,access_sale_cart,model_sale_cart,dp_custom.rule_cart_multi_company,1,0,0,0 +access_res_partner_freight_category,access_res_partner_freight_category,model_res_partner_freight_category,base.group_user,1,1,1,1 diff --git a/ext/custom-addons/dp_custom/views/account_views.xml b/ext/custom-addons/dp_custom/views/account_views.xml index a4a14383..a3fc3c8a 100644 --- a/ext/custom-addons/dp_custom/views/account_views.xml +++ b/ext/custom-addons/dp_custom/views/account_views.xml @@ -16,7 +16,7 @@ --> - + diff --git a/ext/custom-addons/dp_custom/views/product_views.xml b/ext/custom-addons/dp_custom/views/product_views.xml index 87c37689..4d9dc0e8 100644 --- a/ext/custom-addons/dp_custom/views/product_views.xml +++ b/ext/custom-addons/dp_custom/views/product_views.xml @@ -20,6 +20,10 @@ + + + + @@ -186,4 +190,52 @@ action="product_xcategory_action"/> + + + report.intrastat.code.tz_tree + report.intrastat.code + + + + + + + + + report.intrastat.code.tz_form + report.intrastat.code + + + + + +
+ +
+
+
+
+ + + + report.intrastat.code.search + report.intrastat.code + {'filter_active': 1} + + + + + + + + + + + diff --git a/ext/custom-addons/dp_custom/views/res_partner_views.xml b/ext/custom-addons/dp_custom/views/res_partner_views.xml index aabeb796..54b86422 100644 --- a/ext/custom-addons/dp_custom/views/res_partner_views.xml +++ b/ext/custom-addons/dp_custom/views/res_partner_views.xml @@ -46,6 +46,7 @@
+ diff --git a/ext/custom-addons/dp_custom/views/sale_views.xml b/ext/custom-addons/dp_custom/views/sale_views.xml index cc264c68..e66b0bbf 100644 --- a/ext/custom-addons/dp_custom/views/sale_views.xml +++ b/ext/custom-addons/dp_custom/views/sale_views.xml @@ -95,7 +95,7 @@
- + diff --git a/ext/custom-addons/dp_custom/views/stock_views.xml b/ext/custom-addons/dp_custom/views/stock_views.xml index 79949ff7..ee2fe423 100644 --- a/ext/custom-addons/dp_custom/views/stock_views.xml +++ b/ext/custom-addons/dp_custom/views/stock_views.xml @@ -15,7 +15,7 @@ - +