odoo14-addon-l10n-br-purchase 14.0.3.3.0__py3-none-any.whl → 14.0.3.4.1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,7 @@ Brazilian Localization Purchase
7
7
  !! This file is generated by oca-gen-addon-readme !!
8
8
  !! changes will be overwritten. !!
9
9
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10
- !! source digest: sha256:3f650a03ac79f2cc07796bf2df715fe88ccd9c99c839a5568a485e361821fc98
10
+ !! source digest: sha256:b5694c1e1ec6a477458a3aab9601b27a7104b87a9b6762b489bb32db7de74032
11
11
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12
12
 
13
13
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -8,7 +8,7 @@
8
8
  "author": "Akretion, Odoo Community Association (OCA)",
9
9
  "maintainers": ["renatonlima", "rvalyi"],
10
10
  "website": "https://github.com/OCA/l10n-brazil",
11
- "version": "14.0.3.3.0",
11
+ "version": "14.0.3.4.1",
12
12
  "depends": ["purchase", "l10n_br_account"],
13
13
  "data": [
14
14
  # Security
@@ -36,14 +36,6 @@
36
36
  <value eval="[ref('main_pl_only_products_1_2')]" />
37
37
  </function>
38
38
 
39
- <function model="purchase.order.line" name="_onchange_fiscal_operation_id">
40
- <value eval="[ref('main_pl_only_products_1_2')]" />
41
- </function>
42
-
43
- <function model="purchase.order.line" name="_onchange_fiscal_operation_line_id">
44
- <value eval="[ref('main_pl_only_products_1_2')]" />
45
- </function>
46
-
47
39
  <record id="main_pl_only_products_2_2" model="purchase.order.line">
48
40
  <field name="order_id" ref="main_po_only_products" />
49
41
  <field name="name">Drawer Black</field>
@@ -63,14 +55,6 @@
63
55
  <value eval="[ref('main_pl_only_products_2_2')]" />
64
56
  </function>
65
57
 
66
- <function model="purchase.order.line" name="_onchange_fiscal_operation_id">
67
- <value eval="[ref('main_pl_only_products_2_2')]" />
68
- </function>
69
-
70
- <function model="purchase.order.line" name="_onchange_fiscal_operation_line_id">
71
- <value eval="[ref('main_pl_only_products_2_2')]" />
72
- </function>
73
-
74
58
  <!-- Empresa Lucro Presumido -->
75
59
  <!-- Purchase Order with only products test -->
76
60
  <record id="lp_po_only_products" model="purchase.order">
@@ -105,14 +89,6 @@
105
89
  <value eval="[ref('lp_pl_only_products_1_2')]" />
106
90
  </function>
107
91
 
108
- <function model="purchase.order.line" name="_onchange_fiscal_operation_id">
109
- <value eval="[ref('lp_pl_only_products_1_2')]" />
110
- </function>
111
-
112
- <function model="purchase.order.line" name="_onchange_fiscal_operation_line_id">
113
- <value eval="[ref('lp_pl_only_products_1_2')]" />
114
- </function>
115
-
116
92
  <record id="lp_pl_only_products_2_2" model="purchase.order.line">
117
93
  <field name="order_id" ref="lp_po_only_products" />
118
94
  <field name="name">Drawer Black</field>
@@ -132,14 +108,6 @@
132
108
  <value eval="[ref('lp_pl_only_products_2_2')]" />
133
109
  </function>
134
110
 
135
- <function model="purchase.order.line" name="_onchange_fiscal_operation_id">
136
- <value eval="[ref('lp_pl_only_products_2_2')]" />
137
- </function>
138
-
139
- <function model="purchase.order.line" name="_onchange_fiscal_operation_line_id">
140
- <value eval="[ref('lp_pl_only_products_2_2')]" />
141
- </function>
142
-
143
111
  <!-- Empresa Simples Nacional -->
144
112
  <!-- Purchase Order with only products test -->
145
113
  <record id="sn_po_only_products" model="purchase.order">
@@ -174,14 +142,6 @@
174
142
  <value eval="[ref('sn_pl_only_products_1_2')]" />
175
143
  </function>
176
144
 
177
- <function model="purchase.order.line" name="_onchange_fiscal_operation_id">
178
- <value eval="[ref('sn_pl_only_products_1_2')]" />
179
- </function>
180
-
181
- <function model="purchase.order.line" name="_onchange_fiscal_operation_line_id">
182
- <value eval="[ref('sn_pl_only_products_1_2')]" />
183
- </function>
184
-
185
145
  <record id="sn_pl_only_products_2_2" model="purchase.order.line">
186
146
  <field name="order_id" ref="sn_po_only_products" />
187
147
  <field name="name">Drawer Black</field>
@@ -201,14 +161,6 @@
201
161
  <value eval="[ref('sn_pl_only_products_2_2')]" />
202
162
  </function>
203
163
 
204
- <function model="purchase.order.line" name="_onchange_fiscal_operation_id">
205
- <value eval="[ref('sn_pl_only_products_2_2')]" />
206
- </function>
207
-
208
- <function model="purchase.order.line" name="_onchange_fiscal_operation_line_id">
209
- <value eval="[ref('sn_pl_only_products_2_2')]" />
210
- </function>
211
-
212
164
  <!-- Purchase Order with only Service -->
213
165
  <record id="main_po_only_service" model="purchase.order">
214
166
  <field name="name">Main l10n_br_purchase - Serviços</field>
@@ -241,11 +193,7 @@
241
193
  <field name="partner_order_line">001</field>
242
194
  </record>
243
195
 
244
- <function model="purchase.order.line" name="_onchange_fiscal_operation_id">
245
- <value eval="[ref('main_pl_only_service_1_1')]" />
246
- </function>
247
-
248
- <function model="purchase.order.line" name="_onchange_fiscal_operation_line_id">
196
+ <function model="purchase.order.line" name="_onchange_product_id_fiscal">
249
197
  <value eval="[ref('main_pl_only_service_1_1')]" />
250
198
  </function>
251
199
 
@@ -281,14 +229,10 @@
281
229
  <field name="partner_order_line">001</field>
282
230
  </record>
283
231
 
284
- <function model="purchase.order.line" name="_onchange_fiscal_operation_id">
232
+ <function model="purchase.order.line" name="_onchange_product_id_fiscal">
285
233
  <value eval="[ref('main_pl_only_service_1_1')]" />
286
234
  </function>
287
235
 
288
- <function model="purchase.order.line" name="_onchange_fiscal_operation_line_id">
289
- <value eval="[ref('main_pl_service_product_1_1')]" />
290
- </function>
291
-
292
236
  <record id="main_pl_service_product_2_2" model="purchase.order.line">
293
237
  <field name="order_id" ref="main_po_service_product" />
294
238
  <field name="name">Gaveta Preta</field>
@@ -310,11 +254,7 @@
310
254
  <field name="freight_value">10</field>
311
255
  </record>
312
256
 
313
- <function model="purchase.order.line" name="_onchange_fiscal_operation_id">
314
- <value eval="[ref('main_pl_service_product_2_2')]" />
315
- </function>
316
-
317
- <function model="purchase.order.line" name="_onchange_fiscal_operation_line_id">
257
+ <function model="purchase.order.line" name="_onchange_product_id_fiscal">
318
258
  <value eval="[ref('main_pl_service_product_2_2')]" />
319
259
  </function>
320
260
 
@@ -361,6 +361,7 @@ msgid "Companies"
361
361
  msgstr ""
362
362
 
363
363
  #. module: l10n_br_purchase
364
+ #: model:ir.model.fields,field_description:l10n_br_purchase.field_purchase_order__active_company_country_id
364
365
  #: model:ir.model.fields,field_description:l10n_br_purchase.field_purchase_order__company_id
365
366
  msgid "Company"
366
367
  msgstr ""
@@ -1061,6 +1062,11 @@ msgstr ""
1061
1062
  msgid "Insurance Value"
1062
1063
  msgstr ""
1063
1064
 
1065
+ #. module: l10n_br_purchase
1066
+ #: model_terms:ir.ui.view,arch_db:l10n_br_purchase.l10n_br_purchase_order_form
1067
+ msgid "Invoices and Incoming Shipments"
1068
+ msgstr ""
1069
+
1064
1070
  #. module: l10n_br_purchase
1065
1071
  #: model:ir.model,name:l10n_br_purchase.model_account_move
1066
1072
  msgid "Journal Entry"
@@ -1149,6 +1155,11 @@ msgstr ""
1149
1155
  msgid "National Simple Taxes without ICMS"
1150
1156
  msgstr ""
1151
1157
 
1158
+ #. module: l10n_br_purchase
1159
+ #: model_terms:ir.ui.view,arch_db:l10n_br_purchase.l10n_br_purchase_order_form
1160
+ msgid "Notes"
1161
+ msgstr ""
1162
+
1152
1163
  #. module: l10n_br_purchase
1153
1164
  #: model:ir.model.fields,field_description:l10n_br_purchase.field_purchase_order__fiscal_operation_id
1154
1165
  #: model:ir.model.fields,field_description:l10n_br_purchase.field_purchase_order_line__fiscal_operation_id
@@ -1160,6 +1171,11 @@ msgstr ""
1160
1171
  msgid "Operation Line"
1161
1172
  msgstr ""
1162
1173
 
1174
+ #. module: l10n_br_purchase
1175
+ #: model:ir.model.fields,field_description:l10n_br_purchase.field_purchase_order__operation_name
1176
+ msgid "Operation Name"
1177
+ msgstr ""
1178
+
1163
1179
  #. module: l10n_br_purchase
1164
1180
  #: model:ir.model.fields,field_description:l10n_br_purchase.field_purchase_order__amount_other_value
1165
1181
  #: model_terms:ir.ui.view,arch_db:l10n_br_purchase.report_purchaseorder_document_l10n_br_purchase
@@ -365,6 +365,7 @@ msgid "Companies"
365
365
  msgstr "Empresas"
366
366
 
367
367
  #. module: l10n_br_purchase
368
+ #: model:ir.model.fields,field_description:l10n_br_purchase.field_purchase_order__active_company_country_id
368
369
  #: model:ir.model.fields,field_description:l10n_br_purchase.field_purchase_order__company_id
369
370
  msgid "Company"
370
371
  msgstr "Empresa"
@@ -1067,6 +1068,11 @@ msgstr "Seguro"
1067
1068
  msgid "Insurance Value"
1068
1069
  msgstr "Valor do Seguro"
1069
1070
 
1071
+ #. module: l10n_br_purchase
1072
+ #: model_terms:ir.ui.view,arch_db:l10n_br_purchase.l10n_br_purchase_order_form
1073
+ msgid "Invoices and Incoming Shipments"
1074
+ msgstr "Faturas e Remessas Recebidas"
1075
+
1070
1076
  #. module: l10n_br_purchase
1071
1077
  #: model:ir.model,name:l10n_br_purchase.model_account_move
1072
1078
  msgid "Journal Entry"
@@ -1156,6 +1162,11 @@ msgstr "Impostos do Simples Nacional"
1156
1162
  msgid "National Simple Taxes without ICMS"
1157
1163
  msgstr "Impostos do Simples Nacional sem ICMS"
1158
1164
 
1165
+ #. module: l10n_br_purchase
1166
+ #: model_terms:ir.ui.view,arch_db:l10n_br_purchase.l10n_br_purchase_order_form
1167
+ msgid "Notes"
1168
+ msgstr "Observações"
1169
+
1159
1170
  #. module: l10n_br_purchase
1160
1171
  #: model:ir.model.fields,field_description:l10n_br_purchase.field_purchase_order__fiscal_operation_id
1161
1172
  #: model:ir.model.fields,field_description:l10n_br_purchase.field_purchase_order_line__fiscal_operation_id
@@ -1167,6 +1178,11 @@ msgstr "Operação"
1167
1178
  msgid "Operation Line"
1168
1179
  msgstr "Linha de Operação"
1169
1180
 
1181
+ #. module: l10n_br_purchase
1182
+ #: model:ir.model.fields,field_description:l10n_br_purchase.field_purchase_order__operation_name
1183
+ msgid "Operation Name"
1184
+ msgstr ""
1185
+
1170
1186
  #. module: l10n_br_purchase
1171
1187
  #: model:ir.model.fields,field_description:l10n_br_purchase.field_purchase_order__amount_other_value
1172
1188
  #: model_terms:ir.ui.view,arch_db:l10n_br_purchase.report_purchaseorder_document_l10n_br_purchase
@@ -2081,9 +2097,6 @@ msgstr ""
2081
2097
  #~ msgid "Invoice Line"
2082
2098
  #~ msgstr "Linha da Fatura"
2083
2099
 
2084
- #~ msgid "Invoices and Incoming Shipments"
2085
- #~ msgstr "Faturas e Remessas Recebidas"
2086
-
2087
2100
  #~ msgid "Invoicing"
2088
2101
  #~ msgstr "Faturamento"
2089
2102
 
@@ -2227,9 +2240,6 @@ msgstr ""
2227
2240
  #~ "Campo relacionado não armazenado para permitir que o usuário do portal "
2228
2241
  #~ "veja a imagem do produto que solicitou"
2229
2242
 
2230
- #~ msgid "Notes"
2231
- #~ msgstr "Observações"
2232
-
2233
2243
  #~ msgid "Nothing to Bill"
2234
2244
  #~ msgstr "Nada para faturar"
2235
2245
 
@@ -11,7 +11,10 @@ class AccountMove(models.Model):
11
11
  @api.onchange("purchase_vendor_bill_id", "purchase_id")
12
12
  def _onchange_purchase_auto_complete(self):
13
13
  if self.purchase_id:
14
- self.fiscal_operation_id = self.purchase_id.fiscal_operation_id
15
- if not self.document_type_id:
16
- self.document_type_id = self.company_id.document_type_id
14
+ if self.purchase_id.fiscal_operation_id:
15
+ self.fiscal_operation_id = self.purchase_id.fiscal_operation_id
16
+ if not self.document_type_id:
17
+ # Testes não passam por aqui, qual seria esse caso de uso?
18
+ # Porque se não houver o codigo pode ser removido
19
+ self.document_type_id = self.company_id.document_type_id
17
20
  return super()._onchange_purchase_auto_complete()
@@ -22,6 +22,12 @@ class PurchaseOrder(models.Model):
22
22
  ]
23
23
  return domain
24
24
 
25
+ active_company_country_id = fields.Many2one(
26
+ comodel_name="res.country",
27
+ string="Company",
28
+ default=lambda self: self.env.company.country_id,
29
+ )
30
+
25
31
  fiscal_operation_id = fields.Many2one(
26
32
  comodel_name="l10n_br_fiscal.operation",
27
33
  readonly=True,
@@ -53,6 +59,10 @@ class PurchaseOrder(models.Model):
53
59
  string="Comments",
54
60
  )
55
61
 
62
+ operation_name = fields.Char(
63
+ copy=False,
64
+ )
65
+
56
66
  @api.model
57
67
  def fields_view_get(
58
68
  self, view_id=None, view_type="form", toolbar=False, submenu=False
@@ -81,7 +91,9 @@ class PurchaseOrder(models.Model):
81
91
 
82
92
  @api.onchange("fiscal_operation_id")
83
93
  def _onchange_fiscal_operation_id(self):
94
+ result = super()._onchange_fiscal_operation_id()
84
95
  self.fiscal_position_id = self.fiscal_operation_id.fiscal_position_id
96
+ return result
85
97
 
86
98
  def _get_amount_lines(self):
87
99
  """Get object lines instaces used to compute fields"""
@@ -98,11 +110,13 @@ class PurchaseOrder(models.Model):
98
110
  def _prepare_invoice(self):
99
111
  self.ensure_one()
100
112
  invoice_vals = super()._prepare_invoice()
101
- invoice_vals.update(
102
- {
103
- "ind_final": self.ind_final,
104
- "fiscal_operation_id": self.fiscal_operation_id.id,
105
- "document_type_id": self.company_id.document_type_id.id,
106
- }
107
- )
113
+ if self.fiscal_operation_id:
114
+ # O caso Brasil se caracteriza por ter a Operação Fiscal
115
+ invoice_vals.update(
116
+ {
117
+ "ind_final": self.ind_final,
118
+ "fiscal_operation_id": self.fiscal_operation_id.id,
119
+ "document_type_id": self.company_id.document_type_id.id,
120
+ }
121
+ )
108
122
  return invoice_vals
@@ -94,19 +94,20 @@ class PurchaseOrderLine(models.Model):
94
94
  """Compute the amounts of the PO line."""
95
95
  result = super()._compute_amount()
96
96
  for line in self:
97
- # Update taxes fields
98
- line._update_taxes()
99
- # Call mixin compute method
100
- line._compute_amounts()
101
- # Update record
102
- line.update(
103
- {
104
- "price_subtotal": line.amount_untaxed,
105
- "price_tax": line.amount_tax,
106
- "price_gross": line.amount_untaxed + line.discount_value,
107
- "price_total": line.amount_total,
108
- }
109
- )
97
+ if line.fiscal_operation_id:
98
+ # Update taxes fields
99
+ line._update_taxes()
100
+ # Call mixin compute method
101
+ line._compute_amounts()
102
+ # Update record
103
+ line.update(
104
+ {
105
+ "price_subtotal": line.amount_untaxed,
106
+ "price_tax": line.amount_tax,
107
+ "price_gross": line.amount_untaxed + line.discount_value,
108
+ "price_total": line.amount_total,
109
+ }
110
+ )
110
111
  return result
111
112
 
112
113
  @api.onchange("product_qty", "product_uom")
@@ -139,8 +140,10 @@ class PurchaseOrderLine(models.Model):
139
140
  line = self.env["purchase.order.line"].browse(
140
141
  values.get("purchase_line_id")
141
142
  )
142
- fiscal_values = line._prepare_br_fiscal_dict()
143
- fiscal_values.update(values)
144
- values.update(fiscal_values)
143
+ if line.fiscal_operation_id:
144
+ # O caso Brasil se caracteriza por ter a Operação Fiscal
145
+ fiscal_values = line._prepare_br_fiscal_dict()
146
+ fiscal_values.update(values)
147
+ values.update(fiscal_values)
145
148
 
146
149
  return values
@@ -1,4 +1,3 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
2
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
3
  <head>
@@ -367,7 +366,7 @@ ul.auto-toc {
367
366
  !! This file is generated by oca-gen-addon-readme !!
368
367
  !! changes will be overwritten. !!
369
368
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370
- !! source digest: sha256:3f650a03ac79f2cc07796bf2df715fe88ccd9c99c839a5568a485e361821fc98
369
+ !! source digest: sha256:b5694c1e1ec6a477458a3aab9601b27a7104b87a9b6762b489bb32db7de74032
371
370
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372
371
  <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-brazil/tree/14.0/l10n_br_purchase"><img alt="OCA/l10n-brazil" src="https://img.shields.io/badge/github-OCA%2Fl10n--brazil-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-brazil-14-0/l10n-brazil-14-0-l10n_br_purchase"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-brazil&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373
372
  <p>Este módulo integra a parte fiscal do módulo <tt class="docutils literal">l10n_br_fiscal</tt> com o módulo de compra purchase do Odoo. O módulo permite o cálculo dos impostos brasileiros já no pedido de compra e propaga a operação fiscal até a nota fiscal de compra, deixando ela com a tributação mais correta possível para seu financeiro (sendo que vocẽ poderia também&nbsp;importar o XML da nota depois).</p>
@@ -4,7 +4,7 @@
4
4
 
5
5
  from lxml import etree
6
6
 
7
- from odoo.tests import SavepointCase
7
+ from odoo.tests import Form, SavepointCase
8
8
 
9
9
  from odoo.addons.l10n_br_fiscal.constants.fiscal import (
10
10
  CFOP_DESTINATION_EXTERNAL,
@@ -173,15 +173,9 @@ class L10nBrPurchaseBaseTest(SavepointCase):
173
173
  }
174
174
 
175
175
  invoice_values.update(order._prepare_br_fiscal_dict())
176
- document_type_id = order._context.get("document_type_id")
177
176
 
178
- if document_type_id:
179
- document_type = self.env["l10n_br_fiscal.document.type"].browse(
180
- document_type_id
181
- )
182
- else:
183
- document_type = order.company_id.document_type_id
184
- document_type_id = order.company_id.document_type_id.id
177
+ document_type = order.company_id.document_type_id
178
+ document_type_id = order.company_id.document_type_id.id
185
179
 
186
180
  document_serie = document_type.get_document_serie(
187
181
  order.company_id, order.fiscal_operation_id
@@ -203,8 +197,8 @@ class L10nBrPurchaseBaseTest(SavepointCase):
203
197
  )
204
198
  invoice_lines += invoice_line
205
199
  self.invoice.invoice_line_ids += invoice_lines
206
- self.invoice._onchange_purchase_auto_complete()
207
200
  self.invoice.write({"purchase_id": order.id})
201
+ self.invoice._onchange_purchase_auto_complete()
208
202
 
209
203
  self.assertEqual(
210
204
  order.order_line.mapped("qty_invoiced"),
@@ -433,6 +427,30 @@ class L10nBrPurchaseBaseTest(SavepointCase):
433
427
 
434
428
  self._invoice_purchase_order(self.po_products)
435
429
 
430
+ def test_purchase_report(self):
431
+ """Test Purchase Report"""
432
+ self.env["purchase.report"].read_group(
433
+ [("product_id", "=", self.env.ref("product.product_product_12").id)],
434
+ ["qty_ordered", "price_average:avg"],
435
+ ["product_id"],
436
+ )
437
+ # TODO: Algo a ser validado?
438
+
439
+ def test_form_purchase(self):
440
+ """Test Purchase with Form"""
441
+
442
+ purchase_form = Form(self.env["purchase.order"])
443
+ purchase_form.partner_id = self.env.ref("l10n_br_base.res_partner_akretion")
444
+ purchase_form.fiscal_operation_id = self.env.ref("l10n_br_fiscal.fo_compras")
445
+ with purchase_form.order_line.new() as line:
446
+ line.name = self.env.ref("product.product_product_12").name
447
+ line.product_id = self.env.ref("product.product_product_12")
448
+ line.fiscal_operation_line_id = self.env.ref(
449
+ "l10n_br_fiscal.fo_compras_compras"
450
+ )
451
+
452
+ purchase_form.save()
453
+
436
454
  def test_fields_view_get(self):
437
455
  """Test Purchase Order fields_view_get."""
438
456
  view_arch = etree.fromstring(self.po_products.fields_view_get()["arch"])
@@ -570,3 +588,19 @@ class L10nBrPurchaseBaseTest(SavepointCase):
570
588
  invoice.fiscal_document_id,
571
589
  "Fiscal Document missing for Purchase with Service and Product.",
572
590
  )
591
+
592
+ def test_compatible_with_international_case(self):
593
+ """Test of compatible with international case, create Invoice but not for Brazil."""
594
+ po_international = self.env.ref("purchase.purchase_order_1")
595
+ self._run_purchase_order_onchanges(po_international)
596
+ for line in po_international.order_line:
597
+ line.product_id.purchase_method = "purchase"
598
+ self._run_purchase_line_onchanges(line)
599
+ po_international.with_context(tracking_disable=True).button_confirm()
600
+ po_international.action_create_invoice()
601
+ for invoice in po_international.invoice_ids:
602
+ # Caso Internacional não deve ter Documento Fiscal associado
603
+ self.assertFalse(
604
+ invoice.fiscal_document_id,
605
+ "International case should not has Fiscal Document.",
606
+ )
@@ -21,8 +21,15 @@
21
21
  <field name="priority">100</field>
22
22
  <field name="arch" type="xml">
23
23
  <xpath expr="//field[@name='partner_ref']" position="after">
24
- <field name="fiscal_operation_id" required="1" />
25
- <field name="ind_final" />
24
+ <field name="active_company_country_id" invisible="True" />
25
+ <field
26
+ name="fiscal_operation_id"
27
+ attrs="{'invisible': [('active_company_country_id', '!=', %(base.br)d)]}"
28
+ />
29
+ <field
30
+ name="ind_final"
31
+ attrs="{'invisible': [('fiscal_operation_id', '=', False)]}"
32
+ />
26
33
  </xpath>
27
34
  <xpath expr="//field[@name='order_line']" position="attributes">
28
35
  <attribute
@@ -37,13 +44,19 @@
37
44
  expr="//field[@name='order_line']/tree/field[@name='taxes_id']"
38
45
  position="attributes"
39
46
  >
40
- <attribute name="invisible">1</attribute>
47
+ <attribute
48
+ name="attrs"
49
+ >{'column_invisible': [('parent.fiscal_operation_id', '!=', False)]}</attribute>
41
50
  </xpath>
42
51
  <xpath
43
52
  expr="//field[@name='order_line']/tree/field[@name='taxes_id']"
44
53
  position="before"
45
54
  >
46
- <field name="fiscal_tax_ids" widget="many2many_tags" />
55
+ <field
56
+ name="fiscal_tax_ids"
57
+ attrs="{'column_invisible': [('parent.fiscal_operation_id', '=', False)]}"
58
+ widget="many2many_tags"
59
+ />
47
60
  </xpath>
48
61
  <!-- Edit order_line Form view -->
49
62
  <xpath expr="//field[@name='order_line']/form" position="inside">
@@ -77,63 +90,110 @@
77
90
  </xpath>
78
91
  <xpath
79
92
  expr="//field[@name='order_line']/form//field[@name='taxes_id']"
80
- position="replace"
93
+ position="attributes"
94
+ >
95
+ <attribute
96
+ name="attrs"
97
+ >{'invisible': [('fiscal_operation_id', '!=', False)]}</attribute>
98
+ </xpath>
99
+ <xpath
100
+ expr="//field[@name='order_line']/form//field[@name='taxes_id']"
101
+ position="after"
81
102
  >
82
103
  <field
83
104
  name="fiscal_operation_id"
84
- required="1"
85
105
  options="{'no_create': True}"
106
+ attrs="{'invisible': [('parent.fiscal_operation_id', '=', False)], 'required': [('parent.fiscal_operation_id', '!=', False)]}"
86
107
  />
87
108
  <field
88
109
  name="fiscal_operation_line_id"
89
- required="1"
90
110
  options="{'no_create': True}"
111
+ attrs="{'invisible': [('parent.fiscal_operation_id', '=', False)], 'required': [('fiscal_operation_id', '!=', False)]}"
91
112
  />
92
113
  <field
93
114
  name="cfop_id"
94
- attrs="{'invisible': [('tax_icms_or_issqn', '=', 'issqn')]}"
115
+ attrs="{'invisible': ['|', ('tax_icms_or_issqn', '=', 'issqn'), ('parent.fiscal_operation_id', '=', False)]}"
95
116
  options="{'no_create': True}"
96
117
  />
97
118
  <field
98
119
  name="service_type_id"
99
120
  options="{'no_create': True}"
100
- attrs="{'invisible': [('tax_icms_or_issqn', '=', 'icms')]}"
121
+ attrs="{'invisible': ['|', ('tax_icms_or_issqn', '=', 'icms'), ('parent.fiscal_operation_id', '=', False)]}"
101
122
  />
102
123
  </xpath>
103
124
  <xpath
104
- expr="//field[@name='order_line']/form//notebook/page[1]"
105
- position="before"
125
+ expr="//field[@name='order_line']/form//notebook"
126
+ position="attributes"
106
127
  >
107
- <page name="fiscal_taxes" string="Taxes" />
108
- <page name="fiscal_line_extra_info" string="Extra Info" />
109
- <page name="others" string="Outros Custos">
110
- <group>
111
- <field name="delivery_costs" invisible="1" />
112
- <field
113
- name="freight_value"
114
- attrs="{'readonly': [('delivery_costs', '=', 'total')]}"
115
- />
116
- <field
117
- name="insurance_value"
118
- attrs="{'readonly': [('delivery_costs', '=', 'total')]}"
119
- />
120
- <field
121
- name="other_value"
122
- attrs="{'readonly': [('delivery_costs', '=', 'total')]}"
123
- />
124
- </group>
125
- </page>
126
- <page name="accounting" string="Accounting">
127
- <group>
128
- <field
129
- name="taxes_id"
130
- widget="many2many_tags"
131
- options="{'no_create': True}"
132
- context="{'search_view_ref': 'account.account_tax_view_search'}"
133
- domain="[('type_tax_use','=','purchase'),('company_id','=',parent.company_id)]"
134
- />
135
- </group>
136
- </page>
128
+ <!-- necessario incluir porque o attrs não funciona na tag Page apenas na Notebook-->
129
+ <attribute
130
+ name="attrs"
131
+ >{'invisible': [('parent.fiscal_operation_id', '!=', False)]}</attribute>
132
+ </xpath>
133
+ <xpath
134
+ expr="//field[@name='order_line']/form/field[@name='name']"
135
+ position="after"
136
+ >
137
+ <notebook
138
+ attrs="{'invisible': [('parent.fiscal_operation_id', '=', False)]}"
139
+ >
140
+ <page
141
+ name="fiscal_taxes"
142
+ string="Taxes"
143
+ attrs="{'invisible': [('parent.fiscal_operation_id', '=', False)]}"
144
+ />
145
+ <page
146
+ name="fiscal_line_extra_info"
147
+ string="Extra Info"
148
+ attrs="{'invisible': [('parent.fiscal_operation_id', '=', False)]}"
149
+ />
150
+ <page
151
+ name="others"
152
+ string="Outros Custos"
153
+ attrs="{'invisible': [('parent.fiscal_operation_id', '=', False)]}"
154
+ >
155
+ <group>
156
+ <field name="delivery_costs" invisible="1" />
157
+ <field
158
+ name="freight_value"
159
+ attrs="{'readonly': [('delivery_costs', '=', 'total')]}"
160
+ />
161
+ <field
162
+ name="insurance_value"
163
+ attrs="{'readonly': [('delivery_costs', '=', 'total')]}"
164
+ />
165
+ <field
166
+ name="other_value"
167
+ attrs="{'readonly': [('delivery_costs', '=', 'total')]}"
168
+ />
169
+ </group>
170
+ </page>
171
+ <page
172
+ name="accounting"
173
+ string="Accounting"
174
+ attrs="{'invisible': [('parent.fiscal_operation_id', '=', False)]}"
175
+ >
176
+ <group>
177
+ <field
178
+ name="taxes_id"
179
+ widget="many2many_tags"
180
+ options="{'no_create': True}"
181
+ context="{'search_view_ref': 'account.account_tax_view_search'}"
182
+ domain="[('type_tax_use','=','purchase'),('company_id','=',parent.company_id)]"
183
+ />
184
+ </group>
185
+ </page>
186
+ <!-- necessario incluir porque o attrs não funciona na tag Page apenas na Notebook-->
187
+ <page string="Notes" name="notes">
188
+ <field name="name" />
189
+ </page>
190
+ <page
191
+ string="Invoices and Incoming Shipments"
192
+ name="invoices_incoming_shiptments"
193
+ >
194
+ <field name="invoice_lines" />
195
+ </page>
196
+ </notebook>
137
197
  </xpath>
138
198
  <xpath expr="//field[@name='amount_untaxed']" position="after">
139
199
  <field name="delivery_costs" invisible="1" />
@@ -141,19 +201,19 @@
141
201
  name="amount_freight_value"
142
202
  widget='monetary'
143
203
  options="{'currency_field': 'currency_id'}"
144
- attrs="{'readonly': [('delivery_costs', '=', 'line')]}"
204
+ attrs="{'readonly': [('delivery_costs', '=', 'line')], 'invisible': [('fiscal_operation_id', '=', False)]}"
145
205
  />
146
206
  <field
147
207
  name="amount_insurance_value"
148
208
  widget='monetary'
149
209
  options="{'currency_field': 'currency_id'}"
150
- attrs="{'readonly': [('delivery_costs', '=', 'line')]}"
210
+ attrs="{'readonly': [('delivery_costs', '=', 'line')], 'invisible': [('fiscal_operation_id', '=', False)]}"
151
211
  />
152
212
  <field
153
213
  name="amount_other_value"
154
214
  widget='monetary'
155
215
  options="{'currency_field': 'currency_id'}"
156
- attrs="{'readonly': [('delivery_costs', '=', 'line')]}"
216
+ attrs="{'readonly': [('delivery_costs', '=', 'line')], 'invisible': [('fiscal_operation_id', '=', False)]}"
157
217
  />
158
218
  </xpath>
159
219
  <xpath
@@ -187,10 +247,9 @@
187
247
  <field name="model">purchase.order.line</field>
188
248
  <field name="inherit_id" ref="purchase.purchase_order_line_form2" />
189
249
  <field name="arch" type="xml">
190
- <xpath expr="//form/sheet/group" position="after">
191
- <group id="l10n_br_fiscal">
192
- </group>
193
- </xpath>
250
+ <xpath expr="//form/sheet/group" position="after">
251
+ <group id="l10n_br_fiscal" />
252
+ </xpath>
194
253
  </field>
195
254
  </record>
196
255
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo14-addon-l10n-br-purchase
3
- Version: 14.0.3.3.0
3
+ Version: 14.0.3.4.1
4
4
  Summary: Brazilian Localization Purchase
5
5
  Home-page: https://github.com/OCA/l10n-brazil
6
6
  Author: Akretion, Odoo Community Association (OCA)
@@ -24,7 +24,7 @@ Brazilian Localization Purchase
24
24
  !! This file is generated by oca-gen-addon-readme !!
25
25
  !! changes will be overwritten. !!
26
26
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
27
- !! source digest: sha256:3f650a03ac79f2cc07796bf2df715fe88ccd9c99c839a5568a485e361821fc98
27
+ !! source digest: sha256:b5694c1e1ec6a477458a3aab9601b27a7104b87a9b6762b489bb32db7de74032
28
28
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
29
29
 
30
30
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -1,19 +1,19 @@
1
- odoo/addons/l10n_br_purchase/README.rst,sha256=KUJ0E4WPni2Pbq3_biOWEZMKkGNbYONfqHGBI1eGM_0,4661
1
+ odoo/addons/l10n_br_purchase/README.rst,sha256=AIadbbePK5i97gFAMxJ4uxnsdsnXFmg-waW3WKJqxN8,4661
2
2
  odoo/addons/l10n_br_purchase/__init__.py,sha256=otut1R_8C8Cn2BBP2RL7BuAOxh5lmp_IS7y3RRVaB9Q,189
3
- odoo/addons/l10n_br_purchase/__manifest__.py,sha256=OGHg_xLcRBX0Fy3fkk0ORaj3IZnvoWLZ-WyX-VAqxzk,983
3
+ odoo/addons/l10n_br_purchase/__manifest__.py,sha256=CpEpv-OAwYB2KvqYbdF841WRMipLVkq77KFWzGffkfU,983
4
4
  odoo/addons/l10n_br_purchase/hooks.py,sha256=3GN_Du26GiftKrN2hpHc9qLuaVieZiJ43KBgH4w-52I,2276
5
5
  odoo/addons/l10n_br_purchase/data/company.xml,sha256=VWD3A_MPASRZJDTRmXtEFQhg0_pZvGeSvhMdH4OCDz8,251
6
6
  odoo/addons/l10n_br_purchase/demo/company.xml,sha256=vsl1dse3q_o-T6BOF9xH8PhdAWsRosTvsNg_gPQuyoM,435
7
7
  odoo/addons/l10n_br_purchase/demo/fiscal_operation_generic.xml,sha256=u0wELeMZZhPg5L1mzajJgkC9UrY-zhA-45RusIqj1gA,2353
8
8
  odoo/addons/l10n_br_purchase/demo/fiscal_operation_simple.xml,sha256=_6TWFX2mjGQd-CYLUCJ4ut1yfdxN83Ytj6JRkyOe3yE,4478
9
- odoo/addons/l10n_br_purchase/demo/l10n_br_purchase.xml,sha256=bueYiUACjq3pfwdzPmpqWBmeSy6pVfGvCtrZJFNNxOg,14371
9
+ odoo/addons/l10n_br_purchase/demo/l10n_br_purchase.xml,sha256=VlXE4vbN2XWAQYZ17OGMmioYfDNkBbYe98mv8_oLt2U,11978
10
10
  odoo/addons/l10n_br_purchase/demo/product.xml,sha256=G3zWdPH2nD-T6-XnZs8lKLsxhvYmrEWcPe8eMBWkWcw,533
11
- odoo/addons/l10n_br_purchase/i18n/l10n_br_purchase.pot,sha256=AFQr2Yy77q3zPZuSmknrcPyBc7MBMPEiiot9WwDsyg4,55944
12
- odoo/addons/l10n_br_purchase/i18n/pt_BR.po,sha256=hma9YEyC7_eyvG9ar89GKXypqfv-UYcvkrFrQ0OfyGQ,96755
11
+ odoo/addons/l10n_br_purchase/i18n/l10n_br_purchase.pot,sha256=E8ZCeRVsmWRB7eGbajQlFwo7nrEv4j-Gt_RluUIfFfI,56501
12
+ odoo/addons/l10n_br_purchase/i18n/pt_BR.po,sha256=fVOI6NIydS8UKBKuxyb7yypqdJ1duFFNaZ61CR6fSQo,97224
13
13
  odoo/addons/l10n_br_purchase/models/__init__.py,sha256=85CiHJxY9R005w2ekoNraLzhQ08XZLfQE1LSts09xeU,227
14
- odoo/addons/l10n_br_purchase/models/account_move.py,sha256=cyYqp3HIXQ9LCMzQ33Ts4zF2pzphjiH_Ae4VVzpH6T8,637
15
- odoo/addons/l10n_br_purchase/models/purchase_order.py,sha256=B7_N2mAyQST1DJXKeEoEYUZWLhKkS6Td_n-dQsZkW1g,3212
16
- odoo/addons/l10n_br_purchase/models/purchase_order_line.py,sha256=uCdM0_wDrqk4fYr8ETfXO5kNOBjRB3yrjELcdV5j9rI,4735
14
+ odoo/addons/l10n_br_purchase/models/account_move.py,sha256=fYSjUp8X9mMRndBI_BhJ-9b6UJIRG9I_4WFJ3y1Ct5M,853
15
+ odoo/addons/l10n_br_purchase/models/purchase_order.py,sha256=yYrFOJs2sZ3khtfDXb8Yr7CYaCmtiGlWGEgG1lencLI,3664
16
+ odoo/addons/l10n_br_purchase/models/purchase_order_line.py,sha256=l04BQCI08zFYIFvGG1IKtdy95DPxbVzjgwyvAfjDh64,4956
17
17
  odoo/addons/l10n_br_purchase/models/res_company.py,sha256=FrngXbae8RCDyHWakEj5SGcIAizYLt2xDRRoRRfCgT4,446
18
18
  odoo/addons/l10n_br_purchase/readme/CONFIGURE.rst,sha256=WbTbr9WipjAVnsWCwzCAGIbIAv4uYO4GJWKUObG5djo,27
19
19
  odoo/addons/l10n_br_purchase/readme/CONTRIBUTORS.rst,sha256=noSnflerh0x89yVjgKWscvIPmCT_F5jym9l9BfQjseM,223
@@ -29,13 +29,13 @@ odoo/addons/l10n_br_purchase/reports/purchase_report.py,sha256=N-5DRxHXN7Un83G9-
29
29
  odoo/addons/l10n_br_purchase/reports/purchase_report_views.xml,sha256=ZgGZJWRHhKPR4MoGuhnXf1Abtay3QCV-kQygUZjKAjs,1988
30
30
  odoo/addons/l10n_br_purchase/security/ir.model.access.csv,sha256=bQTfw--GEMiRE1M1ix-VIydrBHN8Oz5XTJBezsJP57w,822
31
31
  odoo/addons/l10n_br_purchase/static/description/icon.png,sha256=b1uvDtIAslueuduSrxm6miLy_X1RYXmIayt7E1j8t6I,18092
32
- odoo/addons/l10n_br_purchase/static/description/index.html,sha256=VC6wNVPpBLiaJTJGPCAfFLmYTw5n8Dx0Hu25lnQx2iE,16012
32
+ odoo/addons/l10n_br_purchase/static/description/index.html,sha256=AZibd4LEOBXYs91PTJpN8q9XusethdfFG55Z7vsXu_A,15973
33
33
  odoo/addons/l10n_br_purchase/tests/__init__.py,sha256=b6lLV1OD86vong8P8jX13fhE0J1vF3uq95qVf6HdT28,145
34
- odoo/addons/l10n_br_purchase/tests/test_l10n_br_purchase.py,sha256=ruYuzeDmuoGiZ-LXETWuV671X6s8MEPiHxPDRKmwZIM,21963
34
+ odoo/addons/l10n_br_purchase/tests/test_l10n_br_purchase.py,sha256=NIRr2hchbj8ATM54_00lG8f7TwZ-Sc8P1RjVWFvsXZ8,23558
35
35
  odoo/addons/l10n_br_purchase/tests/test_l10n_br_purchase_sn.py,sha256=t4x-A1BHrRmlNIBkPzx6HAmXoPYU0GxC8qjQJ1BzadA,426
36
- odoo/addons/l10n_br_purchase/views/purchase_view.xml,sha256=F9WRSH_r61ImFQzqBoOBTjsqGcjft56cF9ieifvz9ks,8902
36
+ odoo/addons/l10n_br_purchase/views/purchase_view.xml,sha256=ksYiVb_j4UQbKVhpHPx_JxwZdrMJ6OGnIzlGFQpAAeA,12122
37
37
  odoo/addons/l10n_br_purchase/views/res_company_view.xml,sha256=3wDcVAq5jfYVyEYR8HK2CqTmiKCfcTnaS7ynMINA2NM,789
38
- odoo14_addon_l10n_br_purchase-14.0.3.3.0.dist-info/METADATA,sha256=sVN8N51FHNlmQcAse7A51e8GVOOLL5W73tUD6ihBDqE,5246
39
- odoo14_addon_l10n_br_purchase-14.0.3.3.0.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
40
- odoo14_addon_l10n_br_purchase-14.0.3.3.0.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
41
- odoo14_addon_l10n_br_purchase-14.0.3.3.0.dist-info/RECORD,,
38
+ odoo14_addon_l10n_br_purchase-14.0.3.4.1.dist-info/METADATA,sha256=dEHjgOCXDk2rReMu-WSvMd3FAJa7YrOtnWRP-BjaI8U,5246
39
+ odoo14_addon_l10n_br_purchase-14.0.3.4.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
40
+ odoo14_addon_l10n_br_purchase-14.0.3.4.1.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
41
+ odoo14_addon_l10n_br_purchase-14.0.3.4.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.3)
2
+ Generator: bdist_wheel (0.42.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5