odoo-addon-l10n-br-fiscal 16.0.2.17.0__py3-none-any.whl → 16.0.19.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- odoo/addons/l10n_br_fiscal/README.rst +11 -4
- odoo/addons/l10n_br_fiscal/__manifest__.py +20 -12
- odoo/addons/l10n_br_fiscal/constants/fiscal.py +64 -18
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.cest.csv +1043 -983
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.cfop.csv +620 -620
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.cst.csv +58 -0
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.document.type.csv +1 -0
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.legal.nature.csv +82 -0
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.nbs.csv +791 -764
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.operation.indicator.csv +27 -0
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.partner.profile.csv +11 -0
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.tax.classification.csv +163 -0
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.tax.csv +32 -0
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal.tax.group.csv +3 -0
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal_icms_tax_definition_data.xml +340 -352
- odoo/addons/l10n_br_fiscal/data/operation_data.xml +1 -1
- odoo/addons/l10n_br_fiscal/data/simplified_tax_data.xml +5 -5
- odoo/addons/l10n_br_fiscal/data/uom.alias.csv +25 -0
- odoo/addons/l10n_br_fiscal/data/uom_data.xml +104 -33
- odoo/addons/l10n_br_fiscal/demo/__init__.py +21 -15
- odoo/addons/l10n_br_fiscal/demo/company_demo.xml +6 -0
- odoo/addons/l10n_br_fiscal/demo/fiscal_document_demo.xml +3 -377
- odoo/addons/l10n_br_fiscal/demo/fiscal_document_nfse_demo.xml +0 -12
- odoo/addons/l10n_br_fiscal/demo/fiscal_operation_demo.xml +2 -2
- odoo/addons/l10n_br_fiscal/demo/icms_tax_definition_demo.xml +5 -2
- odoo/addons/l10n_br_fiscal/demo/res_users_demo.xml +2 -2
- odoo/addons/l10n_br_fiscal/i18n/l10n_br_fiscal.pot +1161 -804
- odoo/addons/l10n_br_fiscal/i18n/pt_BR.po +22 -22
- odoo/addons/l10n_br_fiscal/migrations/16.0.13.0.0/pre-migration.py +25 -0
- odoo/addons/l10n_br_fiscal/migrations/16.0.14.0.0/pre-migration.py +30 -0
- odoo/addons/l10n_br_fiscal/migrations/16.0.14.0.5/pre-migration.py +15 -0
- odoo/addons/l10n_br_fiscal/migrations/16.0.4.0.0/pre-migration.py +220 -0
- odoo/addons/l10n_br_fiscal/migrations/16.0.5.0.0/pre-migration.py +33 -0
- odoo/addons/l10n_br_fiscal/migrations/16.0.5.2.0/pre-migration.py +21 -0
- odoo/addons/l10n_br_fiscal/models/__init__.py +3 -8
- odoo/addons/l10n_br_fiscal/models/cest.py +0 -8
- odoo/addons/l10n_br_fiscal/models/cfop.py +91 -0
- odoo/addons/l10n_br_fiscal/models/city_taxation_code.py +1 -3
- odoo/addons/l10n_br_fiscal/models/comment.py +2 -2
- odoo/addons/l10n_br_fiscal/models/cst.py +0 -1
- odoo/addons/l10n_br_fiscal/models/data_abstract.py +26 -0
- odoo/addons/l10n_br_fiscal/models/data_ncm_nbs_abstract.py +1 -1
- odoo/addons/l10n_br_fiscal/models/document.py +131 -222
- odoo/addons/l10n_br_fiscal/models/document_line.py +82 -5
- odoo/addons/l10n_br_fiscal/models/document_line_mixin.py +1952 -138
- odoo/addons/l10n_br_fiscal/models/document_mixin.py +741 -6
- odoo/addons/l10n_br_fiscal/models/document_related.py +12 -9
- odoo/addons/l10n_br_fiscal/models/document_serie.py +33 -0
- odoo/addons/l10n_br_fiscal/models/document_type.py +0 -6
- odoo/addons/l10n_br_fiscal/models/ibpt.py +1 -1
- odoo/addons/l10n_br_fiscal/models/icms_regulation.py +2 -2
- odoo/addons/l10n_br_fiscal/models/invalidate_number.py +4 -5
- odoo/addons/l10n_br_fiscal/models/legal_nature.py +20 -0
- odoo/addons/l10n_br_fiscal/models/nbm.py +0 -8
- odoo/addons/l10n_br_fiscal/models/ncm.py +0 -12
- odoo/addons/l10n_br_fiscal/models/operation.py +49 -15
- odoo/addons/l10n_br_fiscal/models/operation_dashboard.py +3 -2
- odoo/addons/l10n_br_fiscal/models/operation_indicator.py +58 -0
- odoo/addons/l10n_br_fiscal/models/operation_line.py +75 -6
- odoo/addons/l10n_br_fiscal/models/partner_profile.py +6 -0
- odoo/addons/l10n_br_fiscal/models/product_mixin.py +24 -21
- odoo/addons/l10n_br_fiscal/models/product_template.py +23 -13
- odoo/addons/l10n_br_fiscal/models/res_company.py +31 -9
- odoo/addons/l10n_br_fiscal/models/res_partner.py +38 -6
- odoo/addons/l10n_br_fiscal/models/simplified_tax.py +0 -3
- odoo/addons/l10n_br_fiscal/models/simplified_tax_range.py +8 -0
- odoo/addons/l10n_br_fiscal/models/tax.py +144 -55
- odoo/addons/l10n_br_fiscal/models/tax_classification.py +81 -0
- odoo/addons/l10n_br_fiscal/models/tax_definition.py +72 -23
- odoo/addons/l10n_br_fiscal/models/tax_pis_cofins.py +0 -3
- odoo/addons/l10n_br_fiscal/models/tax_pis_cofins_base.py +1 -1
- odoo/addons/l10n_br_fiscal/models/tax_pis_cofins_credit.py +1 -1
- odoo/addons/l10n_br_fiscal/models/uom_uom.py +15 -30
- odoo/addons/l10n_br_fiscal/security/fiscal_security.xml +11 -27
- odoo/addons/l10n_br_fiscal/security/ir.model.access.csv +11 -10
- odoo/addons/l10n_br_fiscal/static/description/index.html +27 -21
- odoo/addons/l10n_br_fiscal/static/src/js/list_renderer_with_button.esm.js +38 -0
- odoo/addons/l10n_br_fiscal/tests/__init__.py +3 -2
- odoo/addons/l10n_br_fiscal/tests/test_document_edition.py +308 -0
- odoo/addons/l10n_br_fiscal/tests/test_fiscal_document_generic.py +23 -129
- odoo/addons/l10n_br_fiscal/tests/test_fiscal_document_nfse.py +5 -15
- odoo/addons/l10n_br_fiscal/tests/test_fiscal_document_serie.py +60 -0
- odoo/addons/l10n_br_fiscal/tests/test_ibpt.py +4 -3
- odoo/addons/l10n_br_fiscal/tests/test_icms_regulation.py +2 -2
- odoo/addons/l10n_br_fiscal/tests/test_ncm.py +4 -1
- odoo/addons/l10n_br_fiscal/tests/test_tax_benefit.py +17 -22
- odoo/addons/l10n_br_fiscal/tests/test_tax_classification.py +110 -0
- odoo/addons/l10n_br_fiscal/tools.py +1 -1
- odoo/addons/l10n_br_fiscal/views/cest_view.xml +2 -4
- odoo/addons/l10n_br_fiscal/views/cfop_view.xml +25 -5
- odoo/addons/l10n_br_fiscal/views/city_taxation_code.xml +1 -4
- odoo/addons/l10n_br_fiscal/views/cnae_view.xml +2 -4
- odoo/addons/l10n_br_fiscal/views/comment_view.xml +2 -4
- odoo/addons/l10n_br_fiscal/views/cst_view.xml +6 -8
- odoo/addons/l10n_br_fiscal/views/{document_fiscal_line_mixin_view.xml → document_line_mixin_view.xml} +525 -385
- odoo/addons/l10n_br_fiscal/views/document_line_view.xml +101 -82
- odoo/addons/l10n_br_fiscal/views/document_related_view.xml +44 -46
- odoo/addons/l10n_br_fiscal/views/document_serie_view.xml +2 -6
- odoo/addons/l10n_br_fiscal/views/document_type_view.xml +0 -8
- odoo/addons/l10n_br_fiscal/views/document_view.xml +303 -370
- odoo/addons/l10n_br_fiscal/views/icms_regulation_view.xml +14 -16
- odoo/addons/l10n_br_fiscal/views/icms_relief_view.xml +8 -10
- odoo/addons/l10n_br_fiscal/views/invalidate_number_view.xml +46 -48
- odoo/addons/l10n_br_fiscal/views/l10n_br_fiscal_action.xml +166 -280
- odoo/addons/l10n_br_fiscal/views/l10n_br_fiscal_menu.xml +25 -99
- odoo/addons/l10n_br_fiscal/views/legal_nature_view.xml +40 -0
- odoo/addons/l10n_br_fiscal/views/nbm_view.xml +5 -6
- odoo/addons/l10n_br_fiscal/views/nbs_view.xml +5 -6
- odoo/addons/l10n_br_fiscal/views/ncm_view.xml +12 -15
- odoo/addons/l10n_br_fiscal/views/operation_dashboard_view.xml +13 -12
- odoo/addons/l10n_br_fiscal/views/operation_indicator_view.xml +75 -0
- odoo/addons/l10n_br_fiscal/views/operation_line_view.xml +22 -21
- odoo/addons/l10n_br_fiscal/views/operation_view.xml +4 -19
- odoo/addons/l10n_br_fiscal/views/partner_profile_view.xml +3 -6
- odoo/addons/l10n_br_fiscal/views/product_genre_view.xml +7 -9
- odoo/addons/l10n_br_fiscal/views/product_product_view.xml +37 -14
- odoo/addons/l10n_br_fiscal/views/product_template_view.xml +34 -14
- odoo/addons/l10n_br_fiscal/views/res_company_view.xml +55 -52
- odoo/addons/l10n_br_fiscal/views/res_config_settings_view.xml +23 -28
- odoo/addons/l10n_br_fiscal/views/res_partner_view.xml +22 -2
- odoo/addons/l10n_br_fiscal/views/service_type_view.xml +7 -8
- odoo/addons/l10n_br_fiscal/views/simplified_tax_range_view.xml +0 -2
- odoo/addons/l10n_br_fiscal/views/simplified_tax_view.xml +0 -2
- odoo/addons/l10n_br_fiscal/views/tax_classification.xml +110 -0
- odoo/addons/l10n_br_fiscal/views/tax_definition_view.xml +157 -129
- odoo/addons/l10n_br_fiscal/views/tax_estimate_view.xml +0 -2
- odoo/addons/l10n_br_fiscal/views/tax_group_view.xml +3 -6
- odoo/addons/l10n_br_fiscal/views/tax_ipi_control_seal_view.xml +0 -2
- odoo/addons/l10n_br_fiscal/views/tax_ipi_guideline_class_view.xml +0 -2
- odoo/addons/l10n_br_fiscal/views/tax_ipi_guideline_view.xml +2 -4
- odoo/addons/l10n_br_fiscal/views/tax_pis_cofins_base_view.xml +2 -4
- odoo/addons/l10n_br_fiscal/views/tax_pis_cofins_credit_view.xml +2 -4
- odoo/addons/l10n_br_fiscal/views/tax_pis_cofins_view.xml +5 -7
- odoo/addons/l10n_br_fiscal/views/tax_view.xml +5 -7
- odoo/addons/l10n_br_fiscal/views/uom_uom.xml +24 -17
- odoo/addons/l10n_br_fiscal/wizards/__init__.py +1 -0
- odoo/addons/l10n_br_fiscal/wizards/base_wizard_mixin.py +1 -1
- odoo/addons/l10n_br_fiscal/wizards/document_import_wizard_mixin.py +129 -0
- odoo/addons/l10n_br_fiscal/wizards/document_import_wizard_mixin.xml +41 -0
- {odoo_addon_l10n_br_fiscal-16.0.2.17.0.dist-info → odoo_addon_l10n_br_fiscal-16.0.19.4.0.dist-info}/METADATA +15 -6
- odoo_addon_l10n_br_fiscal-16.0.19.4.0.dist-info/RECORD +210 -0
- {odoo_addon_l10n_br_fiscal-16.0.2.17.0.dist-info → odoo_addon_l10n_br_fiscal-16.0.19.4.0.dist-info}/WHEEL +1 -1
- odoo/addons/l10n_br_fiscal/data/l10n_br_fiscal_email_template.xml +0 -68
- odoo/addons/l10n_br_fiscal/data/partner_profile_data.xml +0 -96
- odoo/addons/l10n_br_fiscal/data/uom_alternative_data.xml +0 -58
- odoo/addons/l10n_br_fiscal/demo/l10n_br_fiscal_document_email.xml +0 -54
- odoo/addons/l10n_br_fiscal/demo/subsequent_operation_demo.xml +0 -10
- odoo/addons/l10n_br_fiscal/models/document_email.py +0 -74
- odoo/addons/l10n_br_fiscal/models/document_line_mixin_methods.py +0 -913
- odoo/addons/l10n_br_fiscal/models/document_mixin_fields.py +0 -473
- odoo/addons/l10n_br_fiscal/models/document_mixin_methods.py +0 -269
- odoo/addons/l10n_br_fiscal/models/document_move_mixin.py +0 -261
- odoo/addons/l10n_br_fiscal/models/subsequent_document.py +0 -203
- odoo/addons/l10n_br_fiscal/models/subsequent_operation.py +0 -54
- odoo/addons/l10n_br_fiscal/models/uom_uom_alternative.py +0 -22
- odoo/addons/l10n_br_fiscal/tests/test_subsequent_operation.py +0 -71
- odoo/addons/l10n_br_fiscal/tests/test_uom_uom.py +0 -22
- odoo/addons/l10n_br_fiscal/views/document_email_view.xml +0 -48
- odoo/addons/l10n_br_fiscal/views/subsequent_document_view.xml +0 -43
- odoo/addons/l10n_br_fiscal/views/subsequent_operation_view.xml +0 -21
- odoo_addon_l10n_br_fiscal-16.0.2.17.0.dist-info/RECORD +0 -205
- {odoo_addon_l10n_br_fiscal-16.0.2.17.0.dist-info → odoo_addon_l10n_br_fiscal-16.0.19.4.0.dist-info}/top_level.txt +0 -0
|
@@ -1,10 +1,745 @@
|
|
|
1
|
-
|
|
1
|
+
# Copyright (C) 2019 Renato Lima - Akretion <renato.lima@akretion.com.br>
|
|
2
|
+
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
|
3
|
+
|
|
4
|
+
from odoo import api, fields, models
|
|
5
|
+
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
|
|
6
|
+
|
|
7
|
+
from ..constants.fiscal import (
|
|
8
|
+
DOCUMENT_ISSUER,
|
|
9
|
+
DOCUMENT_ISSUER_COMPANY,
|
|
10
|
+
FINAL_CUSTOMER,
|
|
11
|
+
FISCAL_COMMENT_DOCUMENT,
|
|
12
|
+
NFE_IND_PRES,
|
|
13
|
+
NFE_IND_PRES_DEFAULT,
|
|
14
|
+
)
|
|
2
15
|
|
|
3
16
|
|
|
4
17
|
class FiscalDocumentMixin(models.AbstractModel):
|
|
18
|
+
"""
|
|
19
|
+
Provides a collection of reusable methods for Brazilian fiscal document logic.
|
|
20
|
+
|
|
21
|
+
This abstract model is intended to be inherited by other models or mixins
|
|
22
|
+
that require fiscal document functionalities, such as preparing fiscal data,
|
|
23
|
+
calculating fiscal amounts, managing document series, and handling comments.
|
|
24
|
+
|
|
25
|
+
It is inherited by sale.order, purchase.order, account.move and even stock.picking
|
|
26
|
+
in separate modules. Indeed these business documents need to take care of
|
|
27
|
+
some fiscal parameters before creating Fiscal Documents. And of course,
|
|
28
|
+
Fiscal Document themselves inherit from this mixin.
|
|
29
|
+
|
|
30
|
+
Key functionalities include:
|
|
31
|
+
- Computation of various fiscal amounts based on document lines.
|
|
32
|
+
- Inverse methods for distributing header-level costs (freight, insurance)
|
|
33
|
+
to lines.
|
|
34
|
+
- Hooks for customizing data retrieval (e.g., lines, fiscal partner).
|
|
35
|
+
|
|
36
|
+
Models using this mixin are often expected to also include fields defined
|
|
37
|
+
in `l10n_br_fiscal.document.mixin` for methods like
|
|
38
|
+
`_prepare_br_fiscal_dict` and `_get_amount_fields` to function
|
|
39
|
+
correctly. Line-based calculations typically rely on an overrideable
|
|
40
|
+
`_get_amount_lines` method.
|
|
41
|
+
"""
|
|
42
|
+
|
|
5
43
|
_name = "l10n_br_fiscal.document.mixin"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
44
|
+
_description = "Document Fiscal Mixin Fields"
|
|
45
|
+
|
|
46
|
+
def _date_server_format(self):
|
|
47
|
+
return fields.Datetime.now().strftime(DEFAULT_SERVER_DATETIME_FORMAT)
|
|
48
|
+
|
|
49
|
+
@api.model
|
|
50
|
+
def _operation_domain(self):
|
|
51
|
+
domain = (
|
|
52
|
+
"[('state', '=', 'approved'),"
|
|
53
|
+
"'|',"
|
|
54
|
+
f"('company_id', '=', {self.env.company.id}),"
|
|
55
|
+
"('company_id', '=', False),"
|
|
56
|
+
)
|
|
57
|
+
return domain
|
|
58
|
+
|
|
59
|
+
def _prepare_br_fiscal_dict(self, default=False):
|
|
60
|
+
self.ensure_one()
|
|
61
|
+
fields = self.env["l10n_br_fiscal.document.mixin"]._fields.keys()
|
|
62
|
+
|
|
63
|
+
# we now read the record fiscal fields except the m2m tax:
|
|
64
|
+
vals = self._convert_to_write(self.read(fields)[0])
|
|
65
|
+
|
|
66
|
+
# remove id field to avoid conflicts
|
|
67
|
+
vals.pop("id", None)
|
|
68
|
+
|
|
69
|
+
if default: # in case you want to use new rather than write later
|
|
70
|
+
return {f"default_{k}": vals[k] for k in vals.keys()}
|
|
71
|
+
return vals
|
|
72
|
+
|
|
73
|
+
@api.onchange("document_type_id")
|
|
74
|
+
def _onchange_document_type_id(self):
|
|
75
|
+
if self.document_type_id and self.issuer == DOCUMENT_ISSUER_COMPANY:
|
|
76
|
+
self.document_serie_id = self.document_type_id.get_document_serie(
|
|
77
|
+
self.company_id, self.fiscal_operation_id
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
@api.depends("fiscal_operation_id")
|
|
81
|
+
def _compute_document_type_id(self):
|
|
82
|
+
for doc in self.filtered(lambda doc: doc.fiscal_operation_id):
|
|
83
|
+
if doc.issuer == DOCUMENT_ISSUER_COMPANY and not doc.document_type_id:
|
|
84
|
+
doc.document_type_id = doc.company_id.document_type_id
|
|
85
|
+
|
|
86
|
+
def _get_amount_lines(self):
|
|
87
|
+
"""Get object lines instances used to compute fiscal fields"""
|
|
88
|
+
return self.mapped(self._get_fiscal_lines_field_name())
|
|
89
|
+
|
|
90
|
+
def _get_product_amount_lines(self):
|
|
91
|
+
fiscal_line_ids = self._get_amount_lines()
|
|
92
|
+
return fiscal_line_ids.filtered(lambda line: line.product_id.type != "service")
|
|
93
|
+
|
|
94
|
+
@api.model
|
|
95
|
+
def _get_amount_fields(self):
|
|
96
|
+
"""Get all fields with 'amount_' prefix"""
|
|
97
|
+
fields = self.env["l10n_br_fiscal.document.mixin"]._fields.keys()
|
|
98
|
+
prefixes = ("amount_", "fiscal_amount_")
|
|
99
|
+
amount_fields = [f for f in fields if f.startswith(prefixes)]
|
|
100
|
+
return amount_fields
|
|
101
|
+
|
|
102
|
+
@api.depends("document_serie_id", "issuer")
|
|
103
|
+
def _compute_document_serie(self):
|
|
104
|
+
for doc in self:
|
|
105
|
+
if doc.document_serie_id and doc.issuer == DOCUMENT_ISSUER_COMPANY:
|
|
106
|
+
doc.document_serie = doc.document_serie_id.code
|
|
107
|
+
elif doc.document_serie is None:
|
|
108
|
+
doc.document_serie = False
|
|
109
|
+
|
|
110
|
+
@api.depends("document_type_id", "issuer")
|
|
111
|
+
def _compute_document_serie_id(self):
|
|
112
|
+
for doc in self:
|
|
113
|
+
if (
|
|
114
|
+
not doc.document_serie_id
|
|
115
|
+
and doc.document_type_id
|
|
116
|
+
and doc.issuer == DOCUMENT_ISSUER_COMPANY
|
|
117
|
+
):
|
|
118
|
+
doc.document_serie_id = doc.document_type_id.get_document_serie(
|
|
119
|
+
doc.company_id, doc.fiscal_operation_id
|
|
120
|
+
)
|
|
121
|
+
elif doc.document_serie_id is None:
|
|
122
|
+
doc.document_serie_id = False
|
|
123
|
+
|
|
124
|
+
@api.model
|
|
125
|
+
def _get_fiscal_lines_field_name(self):
|
|
126
|
+
return "fiscal_line_ids"
|
|
127
|
+
|
|
128
|
+
def _get_fiscal_amount_field_dependencies(self):
|
|
129
|
+
"""
|
|
130
|
+
Dynamically get the list of field dependencies.
|
|
131
|
+
"""
|
|
132
|
+
if self._abstract:
|
|
133
|
+
return []
|
|
134
|
+
o2m_field_name = self._get_fiscal_lines_field_name()
|
|
135
|
+
target_fields = []
|
|
136
|
+
for field in self._get_amount_fields():
|
|
137
|
+
if (
|
|
138
|
+
field.replace("amount_", "")
|
|
139
|
+
in getattr(self, o2m_field_name)._fields.keys()
|
|
140
|
+
):
|
|
141
|
+
target_fields.append(field.replace("amount_", ""))
|
|
142
|
+
|
|
143
|
+
return [o2m_field_name] + [
|
|
144
|
+
f"{o2m_field_name}.{target_field}" for target_field in target_fields
|
|
145
|
+
]
|
|
146
|
+
|
|
147
|
+
@api.depends(lambda self: self._get_fiscal_amount_field_dependencies())
|
|
148
|
+
def _compute_fiscal_amount(self):
|
|
149
|
+
"""
|
|
150
|
+
Compute and sum various fiscal amounts from the document lines.
|
|
151
|
+
|
|
152
|
+
This method iterates over fields prefixed with 'amount_' (as determined
|
|
153
|
+
by `_get_amount_fields`) and sums corresponding values from the lines
|
|
154
|
+
retrieved by `_get_amount_lines`.
|
|
155
|
+
|
|
156
|
+
It handles cases where delivery costs (freight, insurance, other) are
|
|
157
|
+
defined at the document total level rather than per line.
|
|
158
|
+
"""
|
|
159
|
+
|
|
160
|
+
fields = self._get_amount_fields()
|
|
161
|
+
for doc in self.filtered(lambda m: m.fiscal_operation_id):
|
|
162
|
+
values = {key: 0.0 for key in fields}
|
|
163
|
+
for line in doc._get_amount_lines():
|
|
164
|
+
for field in fields:
|
|
165
|
+
if field in line._fields.keys():
|
|
166
|
+
values[field] += line[field]
|
|
167
|
+
if field.replace("amount_", "") in line._fields.keys():
|
|
168
|
+
# FIXME this field creates an error in invoice form
|
|
169
|
+
if field == "amount_financial_discount_value":
|
|
170
|
+
values["amount_financial_discount_value"] += (
|
|
171
|
+
0 # line.financial_discount_value
|
|
172
|
+
)
|
|
173
|
+
else:
|
|
174
|
+
values[field] += line[field.replace("amount_", "")]
|
|
175
|
+
|
|
176
|
+
# Valores definidos pelo Total e não pela Linha
|
|
177
|
+
if (
|
|
178
|
+
doc.company_id.delivery_costs == "total"
|
|
179
|
+
or doc.force_compute_delivery_costs_by_total
|
|
180
|
+
):
|
|
181
|
+
values["amount_freight_value"] = doc.amount_freight_value
|
|
182
|
+
values["amount_insurance_value"] = doc.amount_insurance_value
|
|
183
|
+
values["amount_other_value"] = doc.amount_other_value
|
|
184
|
+
|
|
185
|
+
doc.update(values)
|
|
186
|
+
|
|
187
|
+
def _get_fiscal_partner(self):
|
|
188
|
+
"""
|
|
189
|
+
Hook method to determine the fiscal partner for the document.
|
|
190
|
+
|
|
191
|
+
This method is designed to be overridden in implementing models if the
|
|
192
|
+
partner relevant for fiscal purposes (e.g., for tax calculations,
|
|
193
|
+
final consumer status) is different from the main `partner_id`
|
|
194
|
+
of the document record. For instance, an invoice might use a specific
|
|
195
|
+
invoicing contact derived from the main partner.
|
|
196
|
+
|
|
197
|
+
:return: A `res.partner` recordset representing the fiscal partner.
|
|
198
|
+
"""
|
|
199
|
+
|
|
200
|
+
self.ensure_one()
|
|
201
|
+
return self.partner_id
|
|
202
|
+
|
|
203
|
+
@api.depends("partner_id")
|
|
204
|
+
def _compute_ind_final(self):
|
|
205
|
+
for doc in self:
|
|
206
|
+
partner = doc._get_fiscal_partner()
|
|
207
|
+
if partner:
|
|
208
|
+
doc.ind_final = partner.ind_final
|
|
209
|
+
else:
|
|
210
|
+
# Default Value
|
|
211
|
+
doc.ind_final = "1" # Yes
|
|
212
|
+
|
|
213
|
+
@api.onchange("ind_final")
|
|
214
|
+
def _inverse_ind_final(self):
|
|
215
|
+
for doc in self:
|
|
216
|
+
for line in doc._get_amount_lines():
|
|
217
|
+
if line.ind_final != doc.ind_final:
|
|
218
|
+
line.ind_final = doc.ind_final
|
|
219
|
+
|
|
220
|
+
@api.depends("fiscal_operation_id")
|
|
221
|
+
def _compute_operation_name(self):
|
|
222
|
+
for doc in self:
|
|
223
|
+
if doc.fiscal_operation_id:
|
|
224
|
+
doc.operation_name = doc.fiscal_operation_id.name
|
|
225
|
+
else:
|
|
226
|
+
doc.operation_name = False
|
|
227
|
+
|
|
228
|
+
@api.depends("fiscal_operation_id")
|
|
229
|
+
def _compute_comment_ids(self):
|
|
230
|
+
for doc in self:
|
|
231
|
+
if doc.fiscal_operation_id:
|
|
232
|
+
doc.comment_ids = doc.fiscal_operation_id.comment_ids
|
|
233
|
+
elif doc.comment_ids is None:
|
|
234
|
+
doc.comment_ids = []
|
|
235
|
+
|
|
236
|
+
def _distribute_amount_to_lines(self, amount_field_name, line_field_name):
|
|
237
|
+
for record in self:
|
|
238
|
+
if not (
|
|
239
|
+
record.delivery_costs == "total"
|
|
240
|
+
or record.force_compute_delivery_costs_by_total
|
|
241
|
+
):
|
|
242
|
+
continue
|
|
243
|
+
lines = record._get_product_amount_lines()
|
|
244
|
+
if not lines:
|
|
245
|
+
continue
|
|
246
|
+
amount_to_distribute = record[amount_field_name]
|
|
247
|
+
total_gross = sum(lines.mapped("price_gross"))
|
|
248
|
+
if total_gross > 0:
|
|
249
|
+
distributed_amount = 0
|
|
250
|
+
for line in lines[:-1]:
|
|
251
|
+
proportional_amount = record.currency_id.round(
|
|
252
|
+
amount_to_distribute * (line.price_gross / total_gross)
|
|
253
|
+
)
|
|
254
|
+
line[line_field_name] = proportional_amount
|
|
255
|
+
distributed_amount += proportional_amount
|
|
256
|
+
lines[-1][line_field_name] = amount_to_distribute - distributed_amount
|
|
257
|
+
else:
|
|
258
|
+
lines.write({line_field_name: 0.0})
|
|
259
|
+
if lines:
|
|
260
|
+
lines[0][line_field_name] = amount_to_distribute
|
|
261
|
+
|
|
262
|
+
def _inverse_amount_freight(self):
|
|
263
|
+
self._distribute_amount_to_lines("amount_freight_value", "freight_value")
|
|
264
|
+
|
|
265
|
+
def _inverse_amount_insurance(self):
|
|
266
|
+
self._distribute_amount_to_lines("amount_insurance_value", "insurance_value")
|
|
267
|
+
|
|
268
|
+
def _inverse_amount_other(self):
|
|
269
|
+
self._distribute_amount_to_lines("amount_other_value", "other_value")
|
|
270
|
+
|
|
271
|
+
fiscal_operation_id = fields.Many2one(
|
|
272
|
+
comodel_name="l10n_br_fiscal.operation",
|
|
273
|
+
string="Operation",
|
|
274
|
+
domain=lambda self: self._operation_domain(),
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
operation_name = fields.Char(
|
|
278
|
+
copy=False,
|
|
279
|
+
compute="_compute_operation_name",
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
#
|
|
283
|
+
# Company and Partner are defined here to avoid warnings on runbot
|
|
284
|
+
#
|
|
285
|
+
company_id = fields.Many2one(
|
|
286
|
+
comodel_name="res.company",
|
|
287
|
+
string="Company",
|
|
288
|
+
)
|
|
289
|
+
|
|
290
|
+
partner_id = fields.Many2one(
|
|
291
|
+
comodel_name="res.partner",
|
|
292
|
+
index=True,
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
fiscal_operation_type = fields.Selection(
|
|
296
|
+
related="fiscal_operation_id.fiscal_operation_type",
|
|
297
|
+
)
|
|
298
|
+
|
|
299
|
+
ind_pres = fields.Selection(
|
|
300
|
+
selection=NFE_IND_PRES,
|
|
301
|
+
string="Buyer Presence",
|
|
302
|
+
default=NFE_IND_PRES_DEFAULT,
|
|
303
|
+
)
|
|
304
|
+
|
|
305
|
+
comment_ids = fields.Many2many(
|
|
306
|
+
comodel_name="l10n_br_fiscal.comment",
|
|
307
|
+
string="Comments",
|
|
308
|
+
domain=[("object", "=", FISCAL_COMMENT_DOCUMENT)],
|
|
309
|
+
compute="_compute_comment_ids",
|
|
310
|
+
store=True,
|
|
311
|
+
)
|
|
312
|
+
|
|
313
|
+
manual_fiscal_additional_data = fields.Text(
|
|
314
|
+
help="Fiscal Additional data manually entered by user",
|
|
315
|
+
)
|
|
316
|
+
|
|
317
|
+
manual_customer_additional_data = fields.Text(
|
|
318
|
+
help="Customer Additional data manually entered by user",
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
ind_final = fields.Selection(
|
|
322
|
+
selection=FINAL_CUSTOMER,
|
|
323
|
+
string="Final Consumption Operation",
|
|
324
|
+
compute="_compute_ind_final",
|
|
325
|
+
inverse="_inverse_ind_final",
|
|
326
|
+
store=True,
|
|
327
|
+
precompute=True,
|
|
328
|
+
readonly=False,
|
|
329
|
+
)
|
|
330
|
+
|
|
331
|
+
currency_id = fields.Many2one(
|
|
332
|
+
comodel_name="res.currency",
|
|
333
|
+
string="Currency",
|
|
334
|
+
)
|
|
335
|
+
|
|
336
|
+
amount_price_gross = fields.Monetary(
|
|
337
|
+
compute="_compute_fiscal_amount",
|
|
338
|
+
store=True,
|
|
339
|
+
string="Amount Gross",
|
|
340
|
+
help="Amount without discount.",
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
fiscal_amount_untaxed = fields.Monetary(
|
|
344
|
+
compute="_compute_fiscal_amount",
|
|
345
|
+
store=True,
|
|
346
|
+
)
|
|
347
|
+
|
|
348
|
+
amount_ibs_base = fields.Monetary(
|
|
349
|
+
string="IBS Base",
|
|
350
|
+
compute="_compute_fiscal_amount",
|
|
351
|
+
store=True,
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
amount_ibs_value = fields.Monetary(
|
|
355
|
+
string="IBS Value",
|
|
356
|
+
compute="_compute_fiscal_amount",
|
|
357
|
+
store=True,
|
|
358
|
+
)
|
|
359
|
+
|
|
360
|
+
amount_cbs_base = fields.Monetary(
|
|
361
|
+
string="CBS Base",
|
|
362
|
+
compute="_compute_fiscal_amount",
|
|
363
|
+
store=True,
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
amount_cbs_value = fields.Monetary(
|
|
367
|
+
string="CBS Value",
|
|
368
|
+
compute="_compute_fiscal_amount",
|
|
369
|
+
store=True,
|
|
370
|
+
)
|
|
371
|
+
|
|
372
|
+
amount_icms_base = fields.Monetary(
|
|
373
|
+
string="ICMS Base",
|
|
374
|
+
compute="_compute_fiscal_amount",
|
|
375
|
+
store=True,
|
|
376
|
+
)
|
|
377
|
+
|
|
378
|
+
amount_icms_value = fields.Monetary(
|
|
379
|
+
string="ICMS Value",
|
|
380
|
+
compute="_compute_fiscal_amount",
|
|
381
|
+
store=True,
|
|
382
|
+
)
|
|
383
|
+
|
|
384
|
+
amount_icmsst_base = fields.Monetary(
|
|
385
|
+
string="ICMS ST Base",
|
|
386
|
+
compute="_compute_fiscal_amount",
|
|
387
|
+
store=True,
|
|
388
|
+
)
|
|
389
|
+
|
|
390
|
+
amount_icmsst_value = fields.Monetary(
|
|
391
|
+
string="ICMS ST Value",
|
|
392
|
+
compute="_compute_fiscal_amount",
|
|
393
|
+
store=True,
|
|
394
|
+
)
|
|
395
|
+
|
|
396
|
+
amount_icmssn_credit_value = fields.Monetary(
|
|
397
|
+
string="ICMSSN Credit Value",
|
|
398
|
+
compute="_compute_fiscal_amount",
|
|
399
|
+
store=True,
|
|
400
|
+
)
|
|
401
|
+
|
|
402
|
+
amount_icmsfcp_base = fields.Monetary(
|
|
403
|
+
string="ICMS FCP Base",
|
|
404
|
+
compute="_compute_fiscal_amount",
|
|
405
|
+
store=True,
|
|
406
|
+
)
|
|
407
|
+
|
|
408
|
+
amount_icmsfcp_value = fields.Monetary(
|
|
409
|
+
string="ICMS FCP Value",
|
|
410
|
+
compute="_compute_fiscal_amount",
|
|
411
|
+
store=True,
|
|
412
|
+
)
|
|
413
|
+
|
|
414
|
+
amount_icmsfcpst_value = fields.Monetary(
|
|
415
|
+
string="ICMS FCP ST Value",
|
|
416
|
+
compute="_compute_fiscal_amount",
|
|
417
|
+
store=True,
|
|
418
|
+
)
|
|
419
|
+
|
|
420
|
+
amount_icms_destination_value = fields.Monetary(
|
|
421
|
+
string="ICMS Destination Value",
|
|
422
|
+
compute="_compute_fiscal_amount",
|
|
423
|
+
store=True,
|
|
424
|
+
)
|
|
425
|
+
|
|
426
|
+
amount_icms_origin_value = fields.Monetary(
|
|
427
|
+
string="ICMS Origin Value",
|
|
428
|
+
compute="_compute_fiscal_amount",
|
|
429
|
+
store=True,
|
|
430
|
+
)
|
|
431
|
+
|
|
432
|
+
amount_ipi_base = fields.Monetary(
|
|
433
|
+
string="IPI Base",
|
|
434
|
+
compute="_compute_fiscal_amount",
|
|
435
|
+
store=True,
|
|
436
|
+
)
|
|
437
|
+
|
|
438
|
+
amount_ipi_value = fields.Monetary(
|
|
439
|
+
string="IPI Value",
|
|
440
|
+
compute="_compute_fiscal_amount",
|
|
441
|
+
store=True,
|
|
442
|
+
)
|
|
443
|
+
|
|
444
|
+
amount_ii_base = fields.Monetary(
|
|
445
|
+
string="II Base",
|
|
446
|
+
compute="_compute_fiscal_amount",
|
|
447
|
+
store=True,
|
|
448
|
+
)
|
|
449
|
+
|
|
450
|
+
amount_ii_value = fields.Monetary(
|
|
451
|
+
string="II Value",
|
|
452
|
+
compute="_compute_fiscal_amount",
|
|
453
|
+
store=True,
|
|
454
|
+
)
|
|
455
|
+
|
|
456
|
+
amount_ii_customhouse_charges = fields.Monetary(
|
|
457
|
+
string="Customhouse Charges",
|
|
458
|
+
compute="_compute_fiscal_amount",
|
|
459
|
+
store=True,
|
|
460
|
+
)
|
|
461
|
+
|
|
462
|
+
amount_pis_base = fields.Monetary(
|
|
463
|
+
string="PIS Base",
|
|
464
|
+
compute="_compute_fiscal_amount",
|
|
465
|
+
store=True,
|
|
466
|
+
)
|
|
467
|
+
|
|
468
|
+
amount_pis_value = fields.Monetary(
|
|
469
|
+
string="PIS Value",
|
|
470
|
+
compute="_compute_fiscal_amount",
|
|
471
|
+
store=True,
|
|
472
|
+
)
|
|
473
|
+
|
|
474
|
+
amount_pisst_base = fields.Monetary(
|
|
475
|
+
string="PIS ST Base",
|
|
476
|
+
compute="_compute_fiscal_amount",
|
|
477
|
+
store=True,
|
|
478
|
+
)
|
|
479
|
+
|
|
480
|
+
amount_pisst_value = fields.Monetary(
|
|
481
|
+
string="PIS ST Value",
|
|
482
|
+
compute="_compute_fiscal_amount",
|
|
483
|
+
store=True,
|
|
484
|
+
)
|
|
485
|
+
|
|
486
|
+
amount_pis_wh_base = fields.Monetary(
|
|
487
|
+
string="PIS Ret Base",
|
|
488
|
+
compute="_compute_fiscal_amount",
|
|
489
|
+
store=True,
|
|
490
|
+
)
|
|
491
|
+
|
|
492
|
+
amount_pis_wh_value = fields.Monetary(
|
|
493
|
+
string="PIS Ret Value",
|
|
494
|
+
compute="_compute_fiscal_amount",
|
|
495
|
+
store=True,
|
|
496
|
+
)
|
|
497
|
+
|
|
498
|
+
amount_cofins_base = fields.Monetary(
|
|
499
|
+
string="COFINS Base",
|
|
500
|
+
compute="_compute_fiscal_amount",
|
|
501
|
+
store=True,
|
|
502
|
+
)
|
|
503
|
+
|
|
504
|
+
amount_cofins_value = fields.Monetary(
|
|
505
|
+
string="COFINS Value",
|
|
506
|
+
compute="_compute_fiscal_amount",
|
|
507
|
+
store=True,
|
|
508
|
+
)
|
|
509
|
+
|
|
510
|
+
amount_cofinsst_base = fields.Monetary(
|
|
511
|
+
string="COFINS ST Base",
|
|
512
|
+
compute="_compute_fiscal_amount",
|
|
513
|
+
store=True,
|
|
514
|
+
)
|
|
515
|
+
|
|
516
|
+
amount_cofinsst_value = fields.Monetary(
|
|
517
|
+
string="COFINS ST Value",
|
|
518
|
+
compute="_compute_fiscal_amount",
|
|
519
|
+
store=True,
|
|
520
|
+
)
|
|
521
|
+
|
|
522
|
+
amount_cofins_wh_base = fields.Monetary(
|
|
523
|
+
string="COFINS Ret Base",
|
|
524
|
+
compute="_compute_fiscal_amount",
|
|
525
|
+
store=True,
|
|
526
|
+
)
|
|
527
|
+
|
|
528
|
+
amount_cofins_wh_value = fields.Monetary(
|
|
529
|
+
string="COFINS Ret Value",
|
|
530
|
+
compute="_compute_fiscal_amount",
|
|
531
|
+
store=True,
|
|
532
|
+
)
|
|
533
|
+
|
|
534
|
+
amount_issqn_base = fields.Monetary(
|
|
535
|
+
string="ISSQN Base",
|
|
536
|
+
compute="_compute_fiscal_amount",
|
|
537
|
+
store=True,
|
|
538
|
+
)
|
|
539
|
+
|
|
540
|
+
amount_issqn_value = fields.Monetary(
|
|
541
|
+
string="ISSQN Value",
|
|
542
|
+
compute="_compute_fiscal_amount",
|
|
543
|
+
store=True,
|
|
544
|
+
)
|
|
545
|
+
|
|
546
|
+
amount_issqn_wh_base = fields.Monetary(
|
|
547
|
+
string="ISSQN Ret Base",
|
|
548
|
+
compute="_compute_fiscal_amount",
|
|
549
|
+
store=True,
|
|
550
|
+
)
|
|
551
|
+
|
|
552
|
+
amount_issqn_wh_value = fields.Monetary(
|
|
553
|
+
string="ISSQN Ret Value",
|
|
554
|
+
compute="_compute_fiscal_amount",
|
|
555
|
+
store=True,
|
|
556
|
+
)
|
|
557
|
+
|
|
558
|
+
amount_csll_base = fields.Monetary(
|
|
559
|
+
string="CSLL Base",
|
|
560
|
+
compute="_compute_fiscal_amount",
|
|
561
|
+
store=True,
|
|
562
|
+
)
|
|
563
|
+
|
|
564
|
+
amount_csll_value = fields.Monetary(
|
|
565
|
+
string="CSLL Value",
|
|
566
|
+
compute="_compute_fiscal_amount",
|
|
567
|
+
store=True,
|
|
568
|
+
)
|
|
569
|
+
|
|
570
|
+
amount_csll_wh_base = fields.Monetary(
|
|
571
|
+
string="CSLL Ret Base",
|
|
572
|
+
compute="_compute_fiscal_amount",
|
|
573
|
+
store=True,
|
|
574
|
+
)
|
|
575
|
+
|
|
576
|
+
amount_csll_wh_value = fields.Monetary(
|
|
577
|
+
string="CSLL Ret Value",
|
|
578
|
+
compute="_compute_fiscal_amount",
|
|
579
|
+
store=True,
|
|
580
|
+
)
|
|
581
|
+
|
|
582
|
+
amount_irpj_base = fields.Monetary(
|
|
583
|
+
string="IRPJ Base",
|
|
584
|
+
compute="_compute_fiscal_amount",
|
|
585
|
+
store=True,
|
|
586
|
+
)
|
|
587
|
+
|
|
588
|
+
amount_irpj_value = fields.Monetary(
|
|
589
|
+
string="IRPJ Value",
|
|
590
|
+
compute="_compute_fiscal_amount",
|
|
591
|
+
store=True,
|
|
592
|
+
)
|
|
593
|
+
|
|
594
|
+
amount_irpj_wh_base = fields.Monetary(
|
|
595
|
+
string="IRPJ Ret Base",
|
|
596
|
+
compute="_compute_fiscal_amount",
|
|
597
|
+
store=True,
|
|
598
|
+
)
|
|
599
|
+
|
|
600
|
+
amount_irpj_wh_value = fields.Monetary(
|
|
601
|
+
string="IRPJ Ret Value",
|
|
602
|
+
compute="_compute_fiscal_amount",
|
|
603
|
+
store=True,
|
|
604
|
+
)
|
|
605
|
+
|
|
606
|
+
amount_inss_base = fields.Monetary(
|
|
607
|
+
string="INSS Base",
|
|
608
|
+
compute="_compute_fiscal_amount",
|
|
609
|
+
store=True,
|
|
610
|
+
)
|
|
611
|
+
|
|
612
|
+
amount_inss_value = fields.Monetary(
|
|
613
|
+
string="INSS Value",
|
|
614
|
+
compute="_compute_fiscal_amount",
|
|
615
|
+
store=True,
|
|
616
|
+
)
|
|
617
|
+
|
|
618
|
+
amount_inss_wh_base = fields.Monetary(
|
|
619
|
+
string="INSS Ret Base",
|
|
620
|
+
compute="_compute_fiscal_amount",
|
|
621
|
+
store=True,
|
|
622
|
+
)
|
|
623
|
+
|
|
624
|
+
amount_inss_wh_value = fields.Monetary(
|
|
625
|
+
string="INSS Ret Value",
|
|
626
|
+
compute="_compute_fiscal_amount",
|
|
627
|
+
store=True,
|
|
628
|
+
)
|
|
629
|
+
|
|
630
|
+
amount_estimate_tax = fields.Monetary(
|
|
631
|
+
compute="_compute_fiscal_amount",
|
|
632
|
+
store=True,
|
|
633
|
+
)
|
|
634
|
+
|
|
635
|
+
fiscal_amount_tax = fields.Monetary(
|
|
636
|
+
compute="_compute_fiscal_amount",
|
|
637
|
+
store=True,
|
|
638
|
+
)
|
|
639
|
+
|
|
640
|
+
fiscal_amount_total = fields.Monetary(
|
|
641
|
+
compute="_compute_fiscal_amount",
|
|
642
|
+
store=True,
|
|
643
|
+
)
|
|
644
|
+
|
|
645
|
+
amount_tax_withholding = fields.Monetary(
|
|
646
|
+
string="Tax Withholding",
|
|
647
|
+
compute="_compute_fiscal_amount",
|
|
648
|
+
store=True,
|
|
649
|
+
)
|
|
650
|
+
|
|
651
|
+
amount_financial_total = fields.Monetary(
|
|
652
|
+
string="Amount Financial",
|
|
653
|
+
compute="_compute_fiscal_amount",
|
|
654
|
+
store=True,
|
|
655
|
+
)
|
|
656
|
+
|
|
657
|
+
amount_discount_value = fields.Monetary(
|
|
658
|
+
string="Amount Discount",
|
|
659
|
+
compute="_compute_fiscal_amount",
|
|
660
|
+
store=True,
|
|
661
|
+
)
|
|
662
|
+
|
|
663
|
+
amount_financial_total_gross = fields.Monetary(
|
|
664
|
+
string="Amount Financial Gross",
|
|
665
|
+
compute="_compute_fiscal_amount",
|
|
666
|
+
store=True,
|
|
667
|
+
)
|
|
668
|
+
|
|
669
|
+
amount_financial_discount_value = fields.Monetary(
|
|
670
|
+
string="Financial Discount Value",
|
|
671
|
+
compute="_compute_fiscal_amount",
|
|
672
|
+
store=True,
|
|
673
|
+
)
|
|
674
|
+
|
|
675
|
+
amount_insurance_value = fields.Monetary(
|
|
676
|
+
string="Insurance Value",
|
|
677
|
+
compute="_compute_fiscal_amount",
|
|
678
|
+
store=True,
|
|
679
|
+
inverse="_inverse_amount_insurance",
|
|
680
|
+
)
|
|
681
|
+
|
|
682
|
+
amount_other_value = fields.Monetary(
|
|
683
|
+
string="Other Costs",
|
|
684
|
+
compute="_compute_fiscal_amount",
|
|
685
|
+
store=True,
|
|
686
|
+
inverse="_inverse_amount_other",
|
|
687
|
+
)
|
|
688
|
+
|
|
689
|
+
amount_freight_value = fields.Monetary(
|
|
690
|
+
string="Freight Value",
|
|
691
|
+
compute="_compute_fiscal_amount",
|
|
692
|
+
store=True,
|
|
693
|
+
inverse="_inverse_amount_freight",
|
|
694
|
+
)
|
|
695
|
+
|
|
696
|
+
# Usado para tornar Somente Leitura os campos totais dos custos
|
|
697
|
+
# de entrega quando a definição for por Linha
|
|
698
|
+
delivery_costs = fields.Selection(
|
|
699
|
+
related="company_id.delivery_costs",
|
|
700
|
+
)
|
|
701
|
+
|
|
702
|
+
force_compute_delivery_costs_by_total = fields.Boolean(default=False)
|
|
703
|
+
|
|
704
|
+
issuer = fields.Selection(
|
|
705
|
+
selection=DOCUMENT_ISSUER,
|
|
706
|
+
default=DOCUMENT_ISSUER_COMPANY,
|
|
707
|
+
)
|
|
708
|
+
|
|
709
|
+
document_type_id = fields.Many2one(
|
|
710
|
+
comodel_name="l10n_br_fiscal.document.type",
|
|
711
|
+
compute="_compute_document_type_id",
|
|
712
|
+
store=True,
|
|
713
|
+
precompute=True,
|
|
714
|
+
readonly=False,
|
|
715
|
+
)
|
|
716
|
+
|
|
717
|
+
document_serie_id = fields.Many2one(
|
|
718
|
+
comodel_name="l10n_br_fiscal.document.serie",
|
|
719
|
+
domain="[('active', '=', True)," "('document_type_id', '=', document_type_id)]",
|
|
720
|
+
compute="_compute_document_serie_id",
|
|
721
|
+
store=True,
|
|
722
|
+
)
|
|
723
|
+
|
|
724
|
+
document_serie = fields.Char(
|
|
725
|
+
string="Serie Number",
|
|
726
|
+
compute="_compute_document_serie",
|
|
727
|
+
store=True,
|
|
728
|
+
)
|
|
729
|
+
|
|
730
|
+
document_number = fields.Char(
|
|
731
|
+
copy=False,
|
|
732
|
+
index=True,
|
|
733
|
+
unaccent=False,
|
|
734
|
+
)
|
|
735
|
+
|
|
736
|
+
document_key = fields.Char(
|
|
737
|
+
string="Key",
|
|
738
|
+
copy=False,
|
|
739
|
+
index=True,
|
|
740
|
+
unaccent=False,
|
|
741
|
+
)
|
|
742
|
+
|
|
743
|
+
key_random_code = fields.Char(string="Document Key Random Code")
|
|
744
|
+
key_check_digit = fields.Char(string="Document Key Check Digit")
|
|
745
|
+
total_weight = fields.Float()
|