odoo-addon-l10n-ro-stock-price-difference 15.0.5.4.0__py3-none-any.whl → 15.0.5.6.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.
@@ -7,7 +7,7 @@ Romania - Stock Accounting Price Difference
7
7
  !! This file is generated by oca-gen-addon-readme !!
8
8
  !! changes will be overwritten. !!
9
9
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10
- !! source digest: sha256:3b765febea73b1eb801a08a5c821304eaf6696e2860881e575538375fd154ca6
10
+ !! source digest: sha256:8ec919f3bf54fea45359e6a18ca48caf036b939d08af6036ad107dbd16e98048
11
11
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12
12
 
13
13
  .. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
@@ -2,7 +2,7 @@
2
2
  # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3
3
  {
4
4
  "name": "Romania - Stock Accounting Price Difference",
5
- "version": "15.0.5.4.0",
5
+ "version": "15.0.5.6.0",
6
6
  "category": "Localization",
7
7
  "summary": "Romania - Stock Accounting Price Difference",
8
8
  "author": "NextERP Romania," "Dorin Hongu," "Odoo Community Association (OCA)",
@@ -0,0 +1,21 @@
1
+ # Copyright (C) 2023 NextERP Romania
2
+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3
+ from openupgradelib import openupgrade
4
+
5
+
6
+ def migrate(cr, version):
7
+ if not version:
8
+ return
9
+
10
+ openupgrade.logged_query(
11
+ cr,
12
+ """
13
+ UPDATE stock_valuation_layer svl set
14
+ l10n_ro_invoice_id = lsvl.l10n_ro_invoice_id,
15
+ l10n_ro_invoice_line_id = lsvl.l10n_ro_invoice_line_id
16
+ FROM stock_valuation_layer lsvl
17
+ WHERE
18
+ svl.stock_valuation_layer_id = lsvl.id and
19
+ svl.description like '%Price Difference%'
20
+ """,
21
+ )
@@ -48,22 +48,23 @@ class AccountMove(models.Model):
48
48
 
49
49
  # se reevalueaza stocul
50
50
  price_diff, qty_diff = line.l10n_ro_get_stock_valuation_difference()
51
- if price_diff:
52
- valuation_stock_moves = (
53
- line._l10n_ro_get_valuation_stock_moves()
54
- )
51
+ if not price_diff:
52
+ continue
53
+
54
+ valuation_stock_moves = line._l10n_ro_get_valuation_stock_moves()
55
+ # de regula e o singura inregistrare
56
+ move_count = len(valuation_stock_moves)
57
+ for stock_move in valuation_stock_moves:
55
58
  price_diffs.append(
56
59
  {
57
60
  "invoice_id": self.id,
58
- "product_id": valuation_stock_moves.mapped(
59
- "product_id"
60
- ).id,
61
- "picking_id": valuation_stock_moves.mapped(
62
- "picking_id"
63
- ).id,
64
- "amount_difference": line.currency_id.round(price_diff),
61
+ "product_id": stock_move.product_id.id,
62
+ "picking_id": valuation_stock_moves.picking_id.id,
63
+ "amount_difference": line.currency_id.round(
64
+ price_diff / move_count
65
+ ),
65
66
  "quantity_difference": float_round(
66
- qty_diff,
67
+ qty_diff / move_count,
67
68
  precision_rounding=line.product_uom_id.rounding,
68
69
  ),
69
70
  }
@@ -110,7 +111,7 @@ class AccountMove(models.Model):
110
111
  _qty_diff,
111
112
  ) = line.l10n_ro_get_stock_valuation_difference()
112
113
  if diff:
113
- line.l10n_ro_modify_stock_valuation(diff)
114
+ line.l10n_ro_modify_stock_valuation(diff, line)
114
115
 
115
116
  def _stock_account_prepare_anglo_saxon_in_lines_vals(self):
116
117
  l10n_ro_moves = self.filtered(lambda m: m.company_id.l10n_ro_accounting)
@@ -75,7 +75,7 @@ class AccountMoveLine(models.Model):
75
75
  qty_diff = inv_qty - valuation_total_qty
76
76
  return diff, qty_diff
77
77
 
78
- def l10n_ro_modify_stock_valuation(self, val_dif):
78
+ def l10n_ro_modify_stock_valuation(self, val_dif, invoice_line=None):
79
79
  # se adauga la evaluarea miscarii de stoc
80
80
  if not self.purchase_line_id:
81
81
  return 0.0
@@ -109,6 +109,8 @@ class AccountMoveLine(models.Model):
109
109
  "quantity": 0,
110
110
  "remaining_qty": 0,
111
111
  "description": "Price Difference",
112
+ "l10n_ro_invoice_line_id": invoice_line and invoice_line.id or False,
113
+ "l10n_ro_invoice_id": invoice_line and invoice_line.move_id.id or False,
112
114
  }
113
115
  )
114
116
 
@@ -367,7 +367,7 @@ ul.auto-toc {
367
367
  !! This file is generated by oca-gen-addon-readme !!
368
368
  !! changes will be overwritten. !!
369
369
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370
- !! source digest: sha256:3b765febea73b1eb801a08a5c821304eaf6696e2860881e575538375fd154ca6
370
+ !! source digest: sha256:8ec919f3bf54fea45359e6a18ca48caf036b939d08af6036ad107dbd16e98048
371
371
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372
372
  <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.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-romania/tree/15.0/l10n_ro_stock_price_difference"><img alt="OCA/l10n-romania" src="https://img.shields.io/badge/github-OCA%2Fl10n--romania-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-romania-15-0/l10n-romania-15-0-l10n_ro_stock_price_difference"><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-romania&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373
373
  <p>The module is managing price diferences between invoices and receptions. It will create a landed cost with a “Price Difference” product available in the configuration.</p>
@@ -1,7 +1,9 @@
1
1
  # Copyright (C) 2020 Terrabit
2
2
  # Copyright (C) 2022 NextERP Romania
3
3
  # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
4
- from odoo.tests import tagged
4
+
5
+ from odoo import fields
6
+ from odoo.tests import Form, tagged
5
7
 
6
8
  from .common import TestStockCommonPriceDiff
7
9
 
@@ -239,3 +241,71 @@ class TestStockPurchase(TestStockCommonPriceDiff):
239
241
 
240
242
  # in contabilitate stocul are valoarea din factura
241
243
  self.check_account_valuation(self.val_p1_f, self.val_p2_f)
244
+
245
+ def test_2_nir_and_1_invoice_with_price_diff(self):
246
+ "Doua receptii de pe doua comenzi de achzitie cu o singura factura cu diferenta de pret"
247
+ self.create_po_default(
248
+ {
249
+ "lines": [
250
+ {
251
+ "product": self.product_1,
252
+ "qty": 2,
253
+ "price": 5,
254
+ },
255
+ {
256
+ "product": self.product_2,
257
+ "qty": 2,
258
+ "price": 5,
259
+ },
260
+ ]
261
+ }
262
+ )
263
+ po1 = self.po
264
+ self.create_po_default(
265
+ {
266
+ "lines": [
267
+ {
268
+ "product": self.product_1,
269
+ "qty": 2,
270
+ "price": 5,
271
+ },
272
+ {
273
+ "product": self.product_2,
274
+ "qty": 2,
275
+ "price": 5,
276
+ },
277
+ ]
278
+ }
279
+ )
280
+ po2 = self.po
281
+
282
+ self.check_stock_valuation(20, 20)
283
+ self.check_account_valuation(0, 0)
284
+
285
+ invoice_form = Form(
286
+ self.env["account.move"].with_context(
287
+ default_move_type="in_invoice",
288
+ default_invoice_date=fields.Date.today(),
289
+ active_model="account.move",
290
+ )
291
+ )
292
+ invoice_form.partner_id = self.vendor
293
+ invoice_form.purchase_id = po1
294
+
295
+ invoice = invoice_form.save()
296
+
297
+ invoice_form = Form(invoice)
298
+ invoice_form.purchase_id = po2
299
+ invoice = invoice_form.save()
300
+
301
+ invoice_form = Form(invoice)
302
+ for line in range(0, 4):
303
+ with invoice_form.invoice_line_ids.edit(line) as line_form:
304
+ line_form.price_unit += 1
305
+
306
+ invoice = invoice_form.save()
307
+
308
+ invoice.with_context(l10n_ro_approved_price_difference=True).action_post()
309
+
310
+ self.check_stock_valuation(24, 24)
311
+ self.check_account_valuation(24, 24)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-l10n-ro-stock-price-difference
3
- Version: 15.0.5.4.0
3
+ Version: 15.0.5.6.0
4
4
  Summary: Romania - Stock Accounting Price Difference
5
5
  Home-page: https://github.com/OCA/l10n-romania
6
6
  Author: NextERP Romania,Dorin Hongu,Odoo Community Association (OCA)
@@ -25,7 +25,7 @@ Romania - Stock Accounting Price Difference
25
25
  !! This file is generated by oca-gen-addon-readme !!
26
26
  !! changes will be overwritten. !!
27
27
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
28
- !! source digest: sha256:3b765febea73b1eb801a08a5c821304eaf6696e2860881e575538375fd154ca6
28
+ !! source digest: sha256:8ec919f3bf54fea45359e6a18ca48caf036b939d08af6036ad107dbd16e98048
29
29
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
30
30
 
31
31
  .. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
@@ -1,26 +1,27 @@
1
- odoo/addons/l10n_ro_stock_price_difference/README.rst,sha256=h9WIWzi9ilwFboXXJQvcQ8aPo12xQiFOXQqXIzPt_v4,3914
1
+ odoo/addons/l10n_ro_stock_price_difference/README.rst,sha256=kdqjNsah72fGLZJTAvPkNJVdmNDrW33VEjKcChG2sVM,3914
2
2
  odoo/addons/l10n_ro_stock_price_difference/__init__.py,sha256=R3l5zcM1DHY7iqr3kt92069kmImpPafRbNSzv6p_hBE,42
3
- odoo/addons/l10n_ro_stock_price_difference/__manifest__.py,sha256=hSTqyI1okCcw1d2-UAsAzMUPuGVzrLvwOiXah1rn3mQ,785
3
+ odoo/addons/l10n_ro_stock_price_difference/__manifest__.py,sha256=_tpRTKWzGk8RTzTX0WQvM1RNZjieVQb-sXMb-rwN86E,785
4
4
  odoo/addons/l10n_ro_stock_price_difference/i18n/l10n_ro_stock_price_difference.pot,sha256=9NI5VZ-ktrW1lbzFvHTIuG2AVEAhwPBn03RK-DZdCGQ,6781
5
+ odoo/addons/l10n_ro_stock_price_difference/migrations/15.0.5.4.1/pre-migration.py,sha256=cXgeRsSdrg-EaHESj7jSF1S5Lq2vku5mdQZ51onsQeo,615
5
6
  odoo/addons/l10n_ro_stock_price_difference/models/__init__.py,sha256=IziDGW2M2uyUtaLJGSWQsaF6Zz4Qxrtvu9emLMLoEpI,91
6
- odoo/addons/l10n_ro_stock_price_difference/models/account_move.py,sha256=oIZfkYuBSamSZlWlD11NqCPdLl2ujdmG2nMMVG-DSMc,4764
7
- odoo/addons/l10n_ro_stock_price_difference/models/account_move_line.py,sha256=JXjj0vdHQrNsQrH9eviMGysTEXwLZSBP_lvRWEjs2hM,6060
7
+ odoo/addons/l10n_ro_stock_price_difference/models/account_move.py,sha256=myhnlCC539ZFwrabFF0flUiQgDBNfd5xj3jXuSCyiLw,4852
8
+ odoo/addons/l10n_ro_stock_price_difference/models/account_move_line.py,sha256=dQnXCgNMHdgRU31YAfXF3NOMjfquERfbzvcagHgTx2o,6254
8
9
  odoo/addons/l10n_ro_stock_price_difference/models/stock_landed_cost.py,sha256=4gRotUV448LZFO780umrFig8jjrIxnTn2vIJsUYd69c,599
9
10
  odoo/addons/l10n_ro_stock_price_difference/readme/CONTRIBUTORS.rst,sha256=imooaJThv-eiLh7K10cko5NoFQKfEbaU4OcGDn9WKqM,301
10
11
  odoo/addons/l10n_ro_stock_price_difference/readme/DESCRIPTION.rst,sha256=WREtcKsSvyty_YnHiOsXvzuFkD1DzE3pH0vZOmgdjzE,168
11
12
  odoo/addons/l10n_ro_stock_price_difference/security/ir.model.access.csv,sha256=ZW8flyD2rMqHfAn8i0rGfCne0MHB72OzTWPZ4D9nN5U,361
12
13
  odoo/addons/l10n_ro_stock_price_difference/static/description/icon.png,sha256=4CdJJFOkYuQjQGn_jXFOHNUE5NGjg6NQRW1lpQ7j4o4,3173
13
- odoo/addons/l10n_ro_stock_price_difference/static/description/index.html,sha256=6fT4qCrmf6MppVEcbfKBzMZwfr4pX2am2qQbdYXrpoM,13513
14
+ odoo/addons/l10n_ro_stock_price_difference/static/description/index.html,sha256=3P0QW40FPNLy6skh_utNBsa20rP_m12Kqadqi-6OQI4,13513
14
15
  odoo/addons/l10n_ro_stock_price_difference/tests/__init__.py,sha256=PcHbRHAWEYgzNHB4jfqDxzRCYr22mPq6ZOI621w2seE,121
15
16
  odoo/addons/l10n_ro_stock_price_difference/tests/common.py,sha256=Y-Sj9yqArm2n0pKqcIe4-d7YaJ7nMk4Hr8qLj3akpEc,1209
16
- odoo/addons/l10n_ro_stock_price_difference/tests/test_purchase.py,sha256=giC62n2zhyVa5iswWH4zWihY13en1j290NM8lebVvs0,9205
17
+ odoo/addons/l10n_ro_stock_price_difference/tests/test_purchase.py,sha256=RcIFEJOHJerGJDVRqVegRi7lwWc87J7fIDnxxzPprxY,11307
17
18
  odoo/addons/l10n_ro_stock_price_difference/tests/test_purchase_dozen.py,sha256=-NgiINXZREoD2FnsuwYVJVBjTsujEaBFhfhbGWR7xV4,3575
18
19
  odoo/addons/l10n_ro_stock_price_difference/tests/test_purchase_refund.py,sha256=EDOf9_bFf5foD3bt39OhkgfT_Mdf8C7AQgwUcfTL1Uk,2324
19
20
  odoo/addons/l10n_ro_stock_price_difference/tests/test_sale.py,sha256=GKl253rDrndcPsjEOWx98QSRz1p5UDJlrZooZksVfAs,2061
20
21
  odoo/addons/l10n_ro_stock_price_difference/wizard/__init__.py,sha256=c6_T4TE-Z_2FeKUsIDsq8aRC2I9ITMIJ-4WTt9Kz9og,44
21
22
  odoo/addons/l10n_ro_stock_price_difference/wizard/price_difference_confirmation.py,sha256=N8C1C-EbMQVLm3gHgkavhCV_1zl1vg5Lq4FNUxZG7VM,1301
22
23
  odoo/addons/l10n_ro_stock_price_difference/wizard/price_difference_confirmation.xml,sha256=GSszGCpYsLCJ6erqdS7oTF9EaIe25QP-QkKXopoLRig,1682
23
- odoo_addon_l10n_ro_stock_price_difference-15.0.5.4.0.dist-info/METADATA,sha256=CVLMLZi_H2HoadW4MVSyGAEEgmIPGe3OKU_oToi8P0U,4617
24
- odoo_addon_l10n_ro_stock_price_difference-15.0.5.4.0.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
25
- odoo_addon_l10n_ro_stock_price_difference-15.0.5.4.0.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
26
- odoo_addon_l10n_ro_stock_price_difference-15.0.5.4.0.dist-info/RECORD,,
24
+ odoo_addon_l10n_ro_stock_price_difference-15.0.5.6.0.dist-info/METADATA,sha256=rsVf9IlMerT-aHvFUHmjI6ngMmv5VTQqg8Ti6Pw5aZg,4617
25
+ odoo_addon_l10n_ro_stock_price_difference-15.0.5.6.0.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
26
+ odoo_addon_l10n_ro_stock_price_difference-15.0.5.6.0.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
27
+ odoo_addon_l10n_ro_stock_price_difference-15.0.5.6.0.dist-info/RECORD,,