odoo-addon-l10n-br-fiscal 16.0.2.21.2__py3-none-any.whl → 16.0.3.0.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.

Potentially problematic release.


This version of odoo-addon-l10n-br-fiscal might be problematic. Click here for more details.

@@ -4,9 +4,7 @@ from . import data_abstract
4
4
  from . import data_product_abstract
5
5
  from . import data_ncm_nbs_abstract
6
6
  from . import document_mixin_methods
7
- from . import document_mixin_fields
8
7
  from . import document_mixin
9
- from . import document_move_mixin
10
8
  from . import document_line_mixin_methods
11
9
  from . import document_line_mixin
12
10
  from . import invalidate_number
@@ -52,8 +52,7 @@ class Document(models.Model):
52
52
 
53
53
  _name = "l10n_br_fiscal.document"
54
54
  _inherit = [
55
- "l10n_br_fiscal.document.mixin.fields",
56
- "l10n_br_fiscal.document.move.mixin",
55
+ "l10n_br_fiscal.document.mixin",
57
56
  "mail.thread",
58
57
  ]
59
58
  _description = "Fiscal Document"
@@ -224,6 +223,205 @@ class Document(models.Model):
224
223
  string="Tomador do Serviço",
225
224
  )
226
225
 
226
+ # ----- Now some handy related fields:
227
+
228
+ partner_legal_name = fields.Char(
229
+ string="Legal Name",
230
+ related="partner_id.legal_name",
231
+ )
232
+
233
+ partner_name = fields.Char(
234
+ string="Partner Name",
235
+ related="partner_id.name",
236
+ )
237
+
238
+ partner_cnpj_cpf = fields.Char(
239
+ string="CNPJ",
240
+ related="partner_id.cnpj_cpf",
241
+ )
242
+
243
+ partner_inscr_est = fields.Char(
244
+ string="State Tax Number",
245
+ related="partner_id.inscr_est",
246
+ )
247
+
248
+ partner_ind_ie_dest = fields.Selection(
249
+ string="Contribuinte do ICMS",
250
+ related="partner_id.ind_ie_dest",
251
+ )
252
+
253
+ partner_inscr_mun = fields.Char(
254
+ string="Municipal Tax Number",
255
+ related="partner_id.inscr_mun",
256
+ )
257
+
258
+ partner_suframa = fields.Char(
259
+ string="Suframa",
260
+ related="partner_id.suframa",
261
+ )
262
+
263
+ partner_cnae_main_id = fields.Many2one(
264
+ comodel_name="l10n_br_fiscal.cnae",
265
+ string="Main CNAE",
266
+ related="partner_id.cnae_main_id",
267
+ )
268
+
269
+ partner_tax_framework = fields.Selection(
270
+ string="Tax Framework",
271
+ related="partner_id.tax_framework",
272
+ )
273
+
274
+ partner_street = fields.Char(
275
+ string="Partner Street",
276
+ related="partner_id.street",
277
+ )
278
+
279
+ partner_number = fields.Char(
280
+ string="Partner Number",
281
+ related="partner_id.street_number",
282
+ )
283
+
284
+ partner_street2 = fields.Char(
285
+ string="Partner Street2",
286
+ related="partner_id.street2",
287
+ )
288
+
289
+ partner_district = fields.Char(
290
+ string="Partner District",
291
+ related="partner_id.district",
292
+ )
293
+
294
+ partner_country_id = fields.Many2one(
295
+ comodel_name="res.country",
296
+ string="Partner Country",
297
+ related="partner_id.country_id",
298
+ )
299
+
300
+ partner_state_id = fields.Many2one(
301
+ comodel_name="res.country.state",
302
+ string="Partner State",
303
+ related="partner_id.state_id",
304
+ )
305
+
306
+ partner_city_id = fields.Many2one(
307
+ comodel_name="res.city",
308
+ string="Partner City",
309
+ related="partner_id.city_id",
310
+ )
311
+
312
+ partner_zip = fields.Char(
313
+ string="Partner Zip",
314
+ related="partner_id.zip",
315
+ )
316
+
317
+ partner_phone = fields.Char(
318
+ string="Partner Phone",
319
+ related="partner_id.phone",
320
+ )
321
+
322
+ partner_is_company = fields.Boolean(
323
+ string="Partner Is Company?",
324
+ related="partner_id.is_company",
325
+ )
326
+
327
+ processador_edoc = fields.Selection(
328
+ related="company_id.processador_edoc",
329
+ )
330
+
331
+ company_legal_name = fields.Char(
332
+ string="Company Legal Name",
333
+ related="company_id.legal_name",
334
+ )
335
+
336
+ company_name = fields.Char(
337
+ string="Company Name",
338
+ size=128,
339
+ related="company_id.name",
340
+ )
341
+
342
+ company_cnpj_cpf = fields.Char(
343
+ string="Company CNPJ",
344
+ related="company_id.cnpj_cpf",
345
+ )
346
+
347
+ company_inscr_est = fields.Char(
348
+ string="Company State Tax Number",
349
+ related="company_id.inscr_est",
350
+ )
351
+
352
+ company_inscr_est_st = fields.Char(
353
+ string="Company ST State Tax Number",
354
+ )
355
+
356
+ company_inscr_mun = fields.Char(
357
+ string="Company Municipal Tax Number",
358
+ related="company_id.inscr_mun",
359
+ )
360
+
361
+ company_suframa = fields.Char(
362
+ string="Company Suframa",
363
+ related="company_id.suframa",
364
+ )
365
+
366
+ company_cnae_main_id = fields.Many2one(
367
+ comodel_name="l10n_br_fiscal.cnae",
368
+ string="Company Main CNAE",
369
+ related="company_id.cnae_main_id",
370
+ )
371
+
372
+ company_tax_framework = fields.Selection(
373
+ string="Company Tax Framework",
374
+ related="company_id.tax_framework",
375
+ )
376
+
377
+ company_street = fields.Char(
378
+ string="Company Street",
379
+ related="company_id.street",
380
+ )
381
+
382
+ company_number = fields.Char(
383
+ string="Company Number",
384
+ related="company_id.street_number",
385
+ )
386
+
387
+ company_street2 = fields.Char(
388
+ string="Company Street2",
389
+ related="company_id.street2",
390
+ )
391
+
392
+ company_district = fields.Char(
393
+ string="Company District",
394
+ related="company_id.district",
395
+ )
396
+
397
+ company_country_id = fields.Many2one(
398
+ comodel_name="res.country",
399
+ string="Company Country",
400
+ related="company_id.country_id",
401
+ )
402
+
403
+ company_state_id = fields.Many2one(
404
+ comodel_name="res.country.state",
405
+ string="Company State",
406
+ related="company_id.state_id",
407
+ )
408
+
409
+ company_city_id = fields.Many2one(
410
+ comodel_name="res.city",
411
+ string="Company City",
412
+ related="company_id.city_id",
413
+ )
414
+
415
+ company_zip = fields.Char(
416
+ string="Company ZIP",
417
+ related="company_id.zip",
418
+ )
419
+
420
+ company_phone = fields.Char(
421
+ string="Company Phone",
422
+ related="company_id.phone",
423
+ )
424
+
227
425
  @api.constrains("document_key")
228
426
  def _check_key(self):
229
427
  for record in self:
@@ -1,10 +1,481 @@
1
- from odoo import models
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
+ FINAL_CUSTOMER,
9
+ FINAL_CUSTOMER_YES,
10
+ FISCAL_COMMENT_DOCUMENT,
11
+ NFE_IND_PRES,
12
+ NFE_IND_PRES_DEFAULT,
13
+ )
2
14
 
3
15
 
4
16
  class FiscalDocumentMixin(models.AbstractModel):
5
17
  _name = "l10n_br_fiscal.document.mixin"
6
- _inherit = [
7
- "l10n_br_fiscal.document.mixin.fields",
8
- "l10n_br_fiscal.document.mixin.methods",
9
- ]
10
- _description = "Document Fiscal Mixin"
18
+ _inherit = "l10n_br_fiscal.document.mixin.methods"
19
+ _description = "Document Fiscal Mixin Fields"
20
+
21
+ def _date_server_format(self):
22
+ return fields.Datetime.now().strftime(DEFAULT_SERVER_DATETIME_FORMAT)
23
+
24
+ @api.model
25
+ def _default_operation(self):
26
+ return False
27
+
28
+ @api.model
29
+ def _operation_domain(self):
30
+ domain = (
31
+ "[('state', '=', 'approved'),"
32
+ "'|',"
33
+ f"('company_id', '=', {self.env.company.id}),"
34
+ "('company_id', '=', False),"
35
+ )
36
+ return domain
37
+
38
+ fiscal_operation_id = fields.Many2one(
39
+ comodel_name="l10n_br_fiscal.operation",
40
+ string="Operation",
41
+ domain=lambda self: self._operation_domain(),
42
+ default=_default_operation,
43
+ )
44
+
45
+ operation_name = fields.Char(
46
+ copy=False,
47
+ compute="_compute_operation_name",
48
+ )
49
+
50
+ #
51
+ # Company and Partner are defined here to avoid warnings on runbot
52
+ #
53
+ company_id = fields.Many2one(
54
+ comodel_name="res.company",
55
+ string="Company",
56
+ )
57
+
58
+ partner_id = fields.Many2one(
59
+ comodel_name="res.partner",
60
+ index=True,
61
+ )
62
+
63
+ fiscal_operation_type = fields.Selection(
64
+ related="fiscal_operation_id.fiscal_operation_type",
65
+ readonly=True,
66
+ )
67
+
68
+ ind_pres = fields.Selection(
69
+ selection=NFE_IND_PRES,
70
+ string="Buyer Presence",
71
+ default=NFE_IND_PRES_DEFAULT,
72
+ )
73
+
74
+ comment_ids = fields.Many2many(
75
+ comodel_name="l10n_br_fiscal.comment",
76
+ relation="l10n_br_fiscal_document_mixin_comment_rel",
77
+ column1="document_mixin_id",
78
+ column2="comment_id",
79
+ string="Comments",
80
+ domain=[("object", "=", FISCAL_COMMENT_DOCUMENT)],
81
+ compute="_compute_comment_ids",
82
+ store=True,
83
+ )
84
+
85
+ fiscal_additional_data = fields.Text()
86
+
87
+ manual_fiscal_additional_data = fields.Text(
88
+ help="Fiscal Additional data manually entered by user",
89
+ )
90
+
91
+ customer_additional_data = fields.Text()
92
+
93
+ manual_customer_additional_data = fields.Text(
94
+ help="Customer Additional data manually entered by user",
95
+ )
96
+
97
+ ind_final = fields.Selection(
98
+ selection=FINAL_CUSTOMER,
99
+ string="Final Consumption Operation",
100
+ default=FINAL_CUSTOMER_YES,
101
+ )
102
+
103
+ currency_id = fields.Many2one(
104
+ comodel_name="res.currency",
105
+ string="Currency",
106
+ default=lambda self: self.env.company.currency_id,
107
+ )
108
+
109
+ amount_price_gross = fields.Monetary(
110
+ compute="_compute_fiscal_amount",
111
+ store=True,
112
+ string="Amount Gross",
113
+ help="Amount without discount.",
114
+ )
115
+
116
+ amount_untaxed = fields.Monetary(
117
+ compute="_compute_fiscal_amount",
118
+ store=True,
119
+ )
120
+
121
+ amount_icms_base = fields.Monetary(
122
+ string="ICMS Base",
123
+ compute="_compute_fiscal_amount",
124
+ store=True,
125
+ )
126
+
127
+ amount_icms_value = fields.Monetary(
128
+ string="ICMS Value",
129
+ compute="_compute_fiscal_amount",
130
+ store=True,
131
+ )
132
+
133
+ amount_icmsst_base = fields.Monetary(
134
+ string="ICMS ST Base",
135
+ compute="_compute_fiscal_amount",
136
+ store=True,
137
+ )
138
+
139
+ amount_icmsst_value = fields.Monetary(
140
+ string="ICMS ST Value",
141
+ compute="_compute_fiscal_amount",
142
+ store=True,
143
+ )
144
+
145
+ amount_icmssn_credit_value = fields.Monetary(
146
+ string="ICMSSN Credit Value",
147
+ compute="_compute_fiscal_amount",
148
+ store=True,
149
+ )
150
+
151
+ amount_icmsfcp_base = fields.Monetary(
152
+ string="ICMS FCP Base",
153
+ compute="_compute_fiscal_amount",
154
+ store=True,
155
+ )
156
+
157
+ amount_icmsfcp_value = fields.Monetary(
158
+ string="ICMS FCP Value",
159
+ compute="_compute_fiscal_amount",
160
+ store=True,
161
+ )
162
+
163
+ amount_icmsfcpst_value = fields.Monetary(
164
+ string="ICMS FCP ST Value",
165
+ compute="_compute_fiscal_amount",
166
+ store=True,
167
+ )
168
+
169
+ amount_icms_destination_value = fields.Monetary(
170
+ string="ICMS Destination Value",
171
+ compute="_compute_fiscal_amount",
172
+ store=True,
173
+ )
174
+
175
+ amount_icms_origin_value = fields.Monetary(
176
+ string="ICMS Origin Value",
177
+ compute="_compute_fiscal_amount",
178
+ store=True,
179
+ )
180
+
181
+ amount_ipi_base = fields.Monetary(
182
+ string="IPI Base",
183
+ compute="_compute_fiscal_amount",
184
+ store=True,
185
+ )
186
+
187
+ amount_ipi_value = fields.Monetary(
188
+ string="IPI Value",
189
+ compute="_compute_fiscal_amount",
190
+ store=True,
191
+ )
192
+
193
+ amount_ii_base = fields.Monetary(
194
+ string="II Base",
195
+ compute="_compute_fiscal_amount",
196
+ store=True,
197
+ )
198
+
199
+ amount_ii_value = fields.Monetary(
200
+ string="II Value",
201
+ compute="_compute_fiscal_amount",
202
+ store=True,
203
+ )
204
+
205
+ amount_ii_customhouse_charges = fields.Monetary(
206
+ string="Customhouse Charges",
207
+ compute="_compute_fiscal_amount",
208
+ store=True,
209
+ )
210
+
211
+ amount_pis_base = fields.Monetary(
212
+ string="PIS Base",
213
+ compute="_compute_fiscal_amount",
214
+ store=True,
215
+ )
216
+
217
+ amount_pis_value = fields.Monetary(
218
+ string="PIS Value",
219
+ compute="_compute_fiscal_amount",
220
+ store=True,
221
+ )
222
+
223
+ amount_pisst_base = fields.Monetary(
224
+ string="PIS ST Base",
225
+ compute="_compute_fiscal_amount",
226
+ store=True,
227
+ )
228
+
229
+ amount_pisst_value = fields.Monetary(
230
+ string="PIS ST Value",
231
+ compute="_compute_fiscal_amount",
232
+ store=True,
233
+ )
234
+
235
+ amount_pis_wh_base = fields.Monetary(
236
+ string="PIS Ret Base",
237
+ compute="_compute_fiscal_amount",
238
+ store=True,
239
+ )
240
+
241
+ amount_pis_wh_value = fields.Monetary(
242
+ string="PIS Ret Value",
243
+ compute="_compute_fiscal_amount",
244
+ store=True,
245
+ )
246
+
247
+ amount_cofins_base = fields.Monetary(
248
+ string="COFINS Base",
249
+ compute="_compute_fiscal_amount",
250
+ store=True,
251
+ )
252
+
253
+ amount_cofins_value = fields.Monetary(
254
+ string="COFINS Value",
255
+ compute="_compute_fiscal_amount",
256
+ store=True,
257
+ )
258
+
259
+ amount_cofinsst_base = fields.Monetary(
260
+ string="COFINS ST Base",
261
+ compute="_compute_fiscal_amount",
262
+ store=True,
263
+ )
264
+
265
+ amount_cofinsst_value = fields.Monetary(
266
+ string="COFINS ST Value",
267
+ compute="_compute_fiscal_amount",
268
+ store=True,
269
+ )
270
+
271
+ amount_cofins_wh_base = fields.Monetary(
272
+ string="COFINS Ret Base",
273
+ compute="_compute_fiscal_amount",
274
+ store=True,
275
+ )
276
+
277
+ amount_cofins_wh_value = fields.Monetary(
278
+ string="COFINS Ret Value",
279
+ compute="_compute_fiscal_amount",
280
+ store=True,
281
+ )
282
+
283
+ amount_issqn_base = fields.Monetary(
284
+ string="ISSQN Base",
285
+ compute="_compute_fiscal_amount",
286
+ store=True,
287
+ )
288
+
289
+ amount_issqn_value = fields.Monetary(
290
+ string="ISSQN Value",
291
+ compute="_compute_fiscal_amount",
292
+ store=True,
293
+ )
294
+
295
+ amount_issqn_wh_base = fields.Monetary(
296
+ string="ISSQN Ret Base",
297
+ compute="_compute_fiscal_amount",
298
+ store=True,
299
+ )
300
+
301
+ amount_issqn_wh_value = fields.Monetary(
302
+ string="ISSQN Ret Value",
303
+ compute="_compute_fiscal_amount",
304
+ store=True,
305
+ )
306
+
307
+ amount_csll_base = fields.Monetary(
308
+ string="CSLL Base",
309
+ compute="_compute_fiscal_amount",
310
+ store=True,
311
+ )
312
+
313
+ amount_csll_value = fields.Monetary(
314
+ string="CSLL Value",
315
+ compute="_compute_fiscal_amount",
316
+ store=True,
317
+ )
318
+
319
+ amount_csll_wh_base = fields.Monetary(
320
+ string="CSLL Ret Base",
321
+ compute="_compute_fiscal_amount",
322
+ store=True,
323
+ )
324
+
325
+ amount_csll_wh_value = fields.Monetary(
326
+ string="CSLL Ret Value",
327
+ compute="_compute_fiscal_amount",
328
+ store=True,
329
+ )
330
+
331
+ amount_irpj_base = fields.Monetary(
332
+ string="IRPJ Base",
333
+ compute="_compute_fiscal_amount",
334
+ store=True,
335
+ )
336
+
337
+ amount_irpj_value = fields.Monetary(
338
+ string="IRPJ Value",
339
+ compute="_compute_fiscal_amount",
340
+ store=True,
341
+ )
342
+
343
+ amount_irpj_wh_base = fields.Monetary(
344
+ string="IRPJ Ret Base",
345
+ compute="_compute_fiscal_amount",
346
+ store=True,
347
+ )
348
+
349
+ amount_irpj_wh_value = fields.Monetary(
350
+ string="IRPJ Ret Value",
351
+ compute="_compute_fiscal_amount",
352
+ store=True,
353
+ )
354
+
355
+ amount_inss_base = fields.Monetary(
356
+ string="INSS Base",
357
+ compute="_compute_fiscal_amount",
358
+ store=True,
359
+ )
360
+
361
+ amount_inss_value = fields.Monetary(
362
+ string="INSS Value",
363
+ compute="_compute_fiscal_amount",
364
+ store=True,
365
+ )
366
+
367
+ amount_inss_wh_base = fields.Monetary(
368
+ string="INSS Ret Base",
369
+ compute="_compute_fiscal_amount",
370
+ store=True,
371
+ )
372
+
373
+ amount_inss_wh_value = fields.Monetary(
374
+ string="INSS Ret Value",
375
+ compute="_compute_fiscal_amount",
376
+ store=True,
377
+ )
378
+
379
+ amount_estimate_tax = fields.Monetary(
380
+ compute="_compute_fiscal_amount",
381
+ store=True,
382
+ )
383
+
384
+ amount_tax = fields.Monetary(
385
+ compute="_compute_fiscal_amount",
386
+ store=True,
387
+ )
388
+
389
+ amount_total = fields.Monetary(
390
+ compute="_compute_fiscal_amount",
391
+ store=True,
392
+ )
393
+
394
+ amount_tax_withholding = fields.Monetary(
395
+ string="Tax Withholding",
396
+ compute="_compute_fiscal_amount",
397
+ store=True,
398
+ )
399
+
400
+ amount_financial_total = fields.Monetary(
401
+ string="Amount Financial",
402
+ compute="_compute_fiscal_amount",
403
+ store=True,
404
+ )
405
+
406
+ amount_discount_value = fields.Monetary(
407
+ string="Amount Discount",
408
+ compute="_compute_fiscal_amount",
409
+ store=True,
410
+ )
411
+
412
+ amount_financial_total_gross = fields.Monetary(
413
+ string="Amount Financial Gross",
414
+ compute="_compute_fiscal_amount",
415
+ store=True,
416
+ )
417
+
418
+ amount_financial_discount_value = fields.Monetary(
419
+ string="Financial Discount Value",
420
+ compute="_compute_fiscal_amount",
421
+ store=True,
422
+ )
423
+
424
+ amount_insurance_value = fields.Monetary(
425
+ string="Insurance Value",
426
+ compute="_compute_fiscal_amount",
427
+ store=True,
428
+ inverse="_inverse_amount_insurance",
429
+ )
430
+
431
+ amount_other_value = fields.Monetary(
432
+ string="Other Costs",
433
+ compute="_compute_fiscal_amount",
434
+ store=True,
435
+ inverse="_inverse_amount_other",
436
+ )
437
+
438
+ amount_freight_value = fields.Monetary(
439
+ string="Freight Value",
440
+ compute="_compute_fiscal_amount",
441
+ store=True,
442
+ inverse="_inverse_amount_freight",
443
+ )
444
+
445
+ # Usado para tornar Somente Leitura os campos totais dos custos
446
+ # de entrega quando a definição for por Linha
447
+ delivery_costs = fields.Selection(
448
+ related="company_id.delivery_costs",
449
+ )
450
+
451
+ force_compute_delivery_costs_by_total = fields.Boolean(default=False)
452
+
453
+ document_type_id = fields.Many2one(
454
+ comodel_name="l10n_br_fiscal.document.type",
455
+ )
456
+
457
+ document_serie_id = fields.Many2one(
458
+ comodel_name="l10n_br_fiscal.document.serie",
459
+ domain="[('active', '=', True)," "('document_type_id', '=', document_type_id)]",
460
+ )
461
+
462
+ document_serie = fields.Char(
463
+ string="Serie Number",
464
+ )
465
+
466
+ document_number = fields.Char(
467
+ copy=False,
468
+ index=True,
469
+ unaccent=False,
470
+ )
471
+
472
+ document_key = fields.Char(
473
+ string="Key",
474
+ copy=False,
475
+ index=True,
476
+ unaccent=False,
477
+ )
478
+
479
+ key_random_code = fields.Char(string="Document Key Random Code")
480
+ key_check_digit = fields.Char(string="Document Key Check Digit")
481
+ total_weight = fields.Float()