odoo-addon-l10n-ro-stock-price-difference 15.0.5.2.0__py3-none-any.whl → 15.0.5.2.1__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_ro_stock_price_difference/__manifest__.py +1 -1
- odoo/addons/l10n_ro_stock_price_difference/i18n/l10n_ro_stock_price_difference.pot +0 -1
- odoo/addons/l10n_ro_stock_price_difference/models/account_move.py +13 -11
- odoo/addons/l10n_ro_stock_price_difference/models/account_move_line.py +13 -14
- odoo/addons/l10n_ro_stock_price_difference/tests/common.py +4 -1
- odoo/addons/l10n_ro_stock_price_difference/tests/test_purchase.py +5 -6
- odoo/addons/l10n_ro_stock_price_difference/tests/test_purchase_refund.py +4 -5
- odoo/addons/l10n_ro_stock_price_difference/tests/test_sale.py +1 -1
- {odoo_addon_l10n_ro_stock_price_difference-15.0.5.2.0.dist-info → odoo_addon_l10n_ro_stock_price_difference-15.0.5.2.1.dist-info}/METADATA +1 -1
- {odoo_addon_l10n_ro_stock_price_difference-15.0.5.2.0.dist-info → odoo_addon_l10n_ro_stock_price_difference-15.0.5.2.1.dist-info}/RECORD +12 -12
- {odoo_addon_l10n_ro_stock_price_difference-15.0.5.2.0.dist-info → odoo_addon_l10n_ro_stock_price_difference-15.0.5.2.1.dist-info}/WHEEL +1 -1
- {odoo_addon_l10n_ro_stock_price_difference-15.0.5.2.0.dist-info → odoo_addon_l10n_ro_stock_price_difference-15.0.5.2.1.dist-info}/top_level.txt +0 -0
@@ -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.2.
|
5
|
+
"version": "15.0.5.2.1",
|
6
6
|
"category": "Localization",
|
7
7
|
"summary": "Romania - Stock Accounting Price Difference",
|
8
8
|
"author": "NextERP Romania," "Dorin Hongu," "Odoo Community Association (OCA)",
|
@@ -55,7 +55,6 @@ msgid "Invoice"
|
|
55
55
|
msgstr ""
|
56
56
|
|
57
57
|
#. module: l10n_ro_stock_price_difference
|
58
|
-
#: model:ir.model.fields,field_description:l10n_ro_stock_price_difference.field_account_move__is_l10n_ro_record
|
59
58
|
#: model:ir.model.fields,field_description:l10n_ro_stock_price_difference.field_account_move_line__is_l10n_ro_record
|
60
59
|
msgid "Is Romanian Record"
|
61
60
|
msgstr ""
|
@@ -11,8 +11,7 @@ _logger = logging.getLogger(__name__)
|
|
11
11
|
|
12
12
|
|
13
13
|
class AccountMove(models.Model):
|
14
|
-
|
15
|
-
_inherit = ["account.move", "l10n.ro.mixin"]
|
14
|
+
_inherit = "account.move"
|
16
15
|
|
17
16
|
def action_post(self):
|
18
17
|
l10n_ro_records = self.filtered("is_l10n_ro_record")
|
@@ -22,13 +21,14 @@ class AccountMove(models.Model):
|
|
22
21
|
if (
|
23
22
|
len(self) == 1
|
24
23
|
and self.move_type in ["in_invoice", "in_refund"]
|
24
|
+
and self.company_id.l10n_ro_accounting
|
25
25
|
and not self.env.context.get("l10n_ro_approved_price_difference")
|
26
26
|
):
|
27
27
|
action = self._l10n_ro_get_price_difference_check_action()
|
28
28
|
if action:
|
29
29
|
return action
|
30
|
-
l10n_ro_records.l10n_ro_fix_price_difference_svl()
|
31
30
|
res = super().action_post()
|
31
|
+
l10n_ro_records.l10n_ro_fix_price_difference_svl()
|
32
32
|
return res
|
33
33
|
|
34
34
|
def _l10n_ro_get_price_difference_check_action(self):
|
@@ -113,7 +113,10 @@ class AccountMove(models.Model):
|
|
113
113
|
|
114
114
|
def l10n_ro_fix_price_difference_svl(self):
|
115
115
|
for invoice in self:
|
116
|
-
if invoice.move_type in [
|
116
|
+
if invoice.state == "posted" and invoice.move_type in [
|
117
|
+
"in_invoice",
|
118
|
+
"in_refund",
|
119
|
+
]:
|
117
120
|
invoice_lines = invoice.invoice_line_ids.filtered(
|
118
121
|
lambda l: not l.display_type and l.purchase_line_id
|
119
122
|
)
|
@@ -132,10 +135,9 @@ class AccountMove(models.Model):
|
|
132
135
|
line.l10n_ro_modify_stock_valuation(price_diff)
|
133
136
|
|
134
137
|
def _stock_account_prepare_anglo_saxon_in_lines_vals(self):
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
return lines_vals_list
|
138
|
+
l10n_ro_moves = self.filtered(lambda m: m.company_id.l10n_ro_accounting)
|
139
|
+
if l10n_ro_moves == self:
|
140
|
+
return []
|
141
|
+
return super(
|
142
|
+
AccountMove, self - l10n_ro_moves
|
143
|
+
)._stock_account_prepare_anglo_saxon_in_lines_vals()
|
@@ -32,13 +32,14 @@ class AccountMoveLine(models.Model):
|
|
32
32
|
valuation_total = 0
|
33
33
|
valuation_total_qty = 0
|
34
34
|
for val_stock_move in valuation_stock_moves:
|
35
|
-
# Take svl generated by price difference
|
36
|
-
# included upper since quantity is 0, even if we write
|
37
|
-
# 1e-50 on it.
|
35
|
+
# Take normal svl and svl generated by price difference.
|
38
36
|
svl = (
|
39
37
|
val_stock_move.sudo()
|
40
38
|
.mapped("stock_valuation_layer_ids")
|
41
|
-
.filtered(
|
39
|
+
.filtered(
|
40
|
+
lambda l: not l.stock_landed_cost_id
|
41
|
+
or l.stock_landed_cost_id.l10n_ro_cost_type == "price_diff"
|
42
|
+
)
|
42
43
|
)
|
43
44
|
layers_qty = sum(svl.mapped("quantity"))
|
44
45
|
layers_values = sum(svl.mapped("value"))
|
@@ -62,11 +63,12 @@ class AccountMoveLine(models.Model):
|
|
62
63
|
line.quantity, line.product_id.uom_id
|
63
64
|
)
|
64
65
|
inv_qty += (-1 if line.move_id.move_type == "in_refund" else 1) * line_qty
|
66
|
+
|
65
67
|
if inv_qty * valuation_total_qty:
|
66
68
|
accc_balance = sum(lines.mapped("balance")) / inv_qty * valuation_total_qty
|
67
69
|
else:
|
68
70
|
accc_balance = 0
|
69
|
-
diff = accc_balance - valuation_total
|
71
|
+
diff = abs(accc_balance) - valuation_total
|
70
72
|
currency = line.currency_id or self.env.company.currency_id
|
71
73
|
diff = currency.round(diff)
|
72
74
|
qty_diff = inv_qty - valuation_total_qty
|
@@ -89,7 +91,7 @@ class AccountMoveLine(models.Model):
|
|
89
91
|
# trebuie cantitate din factura in unitatea produsului si apoi
|
90
92
|
value = self.product_uom_id._compute_price(value, self.product_id.uom_id)
|
91
93
|
|
92
|
-
lc = self._l10n_ro_create_price_difference_landed_cost(value
|
94
|
+
lc = self._l10n_ro_create_price_difference_landed_cost(value)
|
93
95
|
lc.compute_landed_cost()
|
94
96
|
lc.with_context(
|
95
97
|
l10n_ro_price_difference_move_ids=valuation_stock_move
|
@@ -97,25 +99,22 @@ class AccountMoveLine(models.Model):
|
|
97
99
|
|
98
100
|
lc.stock_valuation_layer_ids.mapped("account_move_id")
|
99
101
|
|
100
|
-
# svl-ul creat trebuie sa aiba quantity diferit de 0,
|
101
|
-
# pentru a fi inclus data viitoare in get_stock_valuation_difference
|
102
102
|
lc.stock_valuation_layer_ids.filtered(
|
103
103
|
lambda svl: svl.value == lc.amount_total
|
104
104
|
).write(
|
105
105
|
{
|
106
|
-
"quantity":
|
106
|
+
"quantity": 0,
|
107
|
+
"remaining_qty": 0,
|
107
108
|
"description": "Price Difference",
|
108
|
-
"stock_landed_cost_id": None,
|
109
109
|
}
|
110
110
|
)
|
111
111
|
|
112
|
-
def l10n_ro_prepare_price_difference_landed_cost(self, value
|
112
|
+
def l10n_ro_prepare_price_difference_landed_cost(self, value):
|
113
113
|
price_diff_product = self._l10n_ro_get_or_create_price_difference_product()
|
114
114
|
stock_journal_id = self.product_id.categ_id.property_stock_journal or False
|
115
115
|
return dict(
|
116
116
|
account_journal_id=stock_journal_id and stock_journal_id.id,
|
117
117
|
l10n_ro_cost_type="price_diff",
|
118
|
-
vendor_bill_id=account_move.id,
|
119
118
|
cost_lines=[
|
120
119
|
(
|
121
120
|
0,
|
@@ -131,8 +130,8 @@ class AccountMoveLine(models.Model):
|
|
131
130
|
],
|
132
131
|
)
|
133
132
|
|
134
|
-
def _l10n_ro_create_price_difference_landed_cost(self, value
|
135
|
-
vals = self.l10n_ro_prepare_price_difference_landed_cost(value
|
133
|
+
def _l10n_ro_create_price_difference_landed_cost(self, value):
|
134
|
+
vals = self.l10n_ro_prepare_price_difference_landed_cost(value)
|
136
135
|
return self.env["stock.landed.cost"].sudo().create(vals)
|
137
136
|
|
138
137
|
def _l10n_ro_get_or_create_price_difference_product(self):
|
@@ -20,7 +20,9 @@ class TestStockCommonPriceDiff(TestStockCommon):
|
|
20
20
|
self.product_1.uom_po_id = self.env.ref("uom.product_uom_dozen")
|
21
21
|
self.qty_po_p1 = 1
|
22
22
|
self.price_p1 = 12
|
23
|
-
|
23
|
+
|
24
|
+
self.diff_p1 = 0
|
25
|
+
self.diff_p2 = 0
|
24
26
|
|
25
27
|
self.product_2.uom_po_id = self.env.ref("uom.product_uom_dozen")
|
26
28
|
self.qty_po_p2 = 1
|
@@ -28,5 +30,6 @@ class TestStockCommonPriceDiff(TestStockCommon):
|
|
28
30
|
|
29
31
|
self.val_p1_i = round(self.qty_po_p1 * self.price_p1, 2)
|
30
32
|
self.val_p2_i = round(self.qty_po_p2 * self.price_p2, 2)
|
33
|
+
|
31
34
|
self.val_p1_f = round(self.qty_po_p1 * (self.price_p1 + self.diff_p1), 2)
|
32
35
|
self.val_p2_f = round(self.qty_po_p2 * (self.price_p2 + self.diff_p2), 2)
|
@@ -26,7 +26,6 @@ class TestStockPurchase(TestStockCommonPriceDiff):
|
|
26
26
|
self.check_account_valuation(0, 0)
|
27
27
|
|
28
28
|
self.create_invoice(self.diff_p1, self.diff_p2)
|
29
|
-
|
30
29
|
# in stocul are valoarea cu diferenta de pret inregistrata
|
31
30
|
self.check_stock_valuation(self.val_p1_f, self.val_p2_f)
|
32
31
|
|
@@ -88,8 +87,8 @@ class TestStockPurchase(TestStockCommonPriceDiff):
|
|
88
87
|
location_dest_id = self.picking_type_transfer.default_location_dest_id.copy(
|
89
88
|
{"usage": "consume"}
|
90
89
|
)
|
91
|
-
self.
|
92
|
-
self.
|
90
|
+
self.transfer(location_id, location_dest_id, self.product_1)
|
91
|
+
self.transfer(location_id, location_dest_id, self.product_2)
|
93
92
|
|
94
93
|
# Validare factura pret 51 pt product1, 49 pt product2
|
95
94
|
self.create_invoice(self.diff_p1, self.diff_p2)
|
@@ -160,7 +159,7 @@ class TestStockPurchase(TestStockCommonPriceDiff):
|
|
160
159
|
self.create_po(partial=True)
|
161
160
|
|
162
161
|
# in stoc produsele sunt la valoarea de achizitie 0
|
163
|
-
self.check_stock_valuation(self.val_p1_i +
|
162
|
+
self.check_stock_valuation(self.val_p1_i + 5, self.val_p2_i - 5)
|
164
163
|
|
165
164
|
self.check_account_valuation(self.val_p1_f / 2, self.val_p2_f / 2)
|
166
165
|
|
@@ -187,7 +186,7 @@ class TestStockPurchase(TestStockCommonPriceDiff):
|
|
187
186
|
self.check_account_valuation(0, 0)
|
188
187
|
|
189
188
|
# Validare factura pret 51 pt product1, 49 pt product2
|
190
|
-
self.create_invoice(self.diff_p1, self.diff_p2,
|
189
|
+
self.create_invoice(self.diff_p1, self.diff_p2, 5, 5)
|
191
190
|
|
192
191
|
# in stoc produsele sunt la valoarea din factura
|
193
192
|
self.check_stock_valuation(self.val_p1_f / 2, self.val_p2_f / 2)
|
@@ -198,7 +197,7 @@ class TestStockPurchase(TestStockCommonPriceDiff):
|
|
198
197
|
self.create_po(partial=True)
|
199
198
|
|
200
199
|
# in stoc produsele sunt la valoarea din factura minus diferenta pe receptia partiala
|
201
|
-
self.check_stock_valuation(self.val_p1_f -
|
200
|
+
self.check_stock_valuation(self.val_p1_f - 5, self.val_p2_f + 5)
|
202
201
|
|
203
202
|
# in contabilitate stocul are valoarea din factura
|
204
203
|
self.check_account_valuation(self.val_p1_f, self.val_p2_f)
|
@@ -17,10 +17,9 @@ class TestStockPurchaseRefund(TestStockCommonPriceDiff):
|
|
17
17
|
self.create_invoice(auto_post=False)
|
18
18
|
|
19
19
|
pick = po.picking_ids
|
20
|
-
self.make_return(pick,
|
21
|
-
|
22
|
-
|
23
|
-
stock_value_final_p2 = self.val_p1_i - round(10 * self.price_p2, 2)
|
20
|
+
self.make_return(pick, 5)
|
21
|
+
stock_value_final_p1 = self.val_p1_i / 2
|
22
|
+
stock_value_final_p2 = self.val_p2_i / 2
|
24
23
|
self.check_stock_valuation(stock_value_final_p1, stock_value_final_p2)
|
25
24
|
|
26
25
|
self.check_account_valuation(0.0, 0.0)
|
@@ -51,7 +50,7 @@ class TestStockPurchaseRefund(TestStockCommonPriceDiff):
|
|
51
50
|
self.create_invoice()
|
52
51
|
|
53
52
|
pick = po.picking_ids
|
54
|
-
self.make_return(pick,
|
53
|
+
self.make_return(pick, 10)
|
55
54
|
|
56
55
|
self.check_stock_valuation(0.0, 0.0)
|
57
56
|
|
@@ -45,7 +45,7 @@ class TestStockSale(TestStockCommonPriceDiff):
|
|
45
45
|
|
46
46
|
self.create_sale_invoice()
|
47
47
|
|
48
|
-
_logger.info("
|
48
|
+
_logger.info("Verificare valoare ramas in stoc")
|
49
49
|
self.check_stock_valuation(val_stock_p1, val_stock_p2)
|
50
50
|
self.check_account_valuation(val_stock_p1, val_stock_p2)
|
51
51
|
|
@@ -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.2.
|
3
|
+
Version: 15.0.5.2.1
|
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)
|
@@ -1,10 +1,10 @@
|
|
1
1
|
odoo/addons/l10n_ro_stock_price_difference/README.rst,sha256=pIAl39y4wjNdRHWdO7PNqbztfQM9FqByOgYLIfPzIH4,3727
|
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=
|
4
|
-
odoo/addons/l10n_ro_stock_price_difference/i18n/l10n_ro_stock_price_difference.pot,sha256=
|
3
|
+
odoo/addons/l10n_ro_stock_price_difference/__manifest__.py,sha256=jy01inwOC42KA-qnB9HO7OfXK8L2B_CmUuavK04JQcQ,785
|
4
|
+
odoo/addons/l10n_ro_stock_price_difference/i18n/l10n_ro_stock_price_difference.pot,sha256=pZIb6pPdB-lFhOd16KwS4Jy0dLP8_l1JY1rL1Nbs-B0,4459
|
5
5
|
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=
|
7
|
-
odoo/addons/l10n_ro_stock_price_difference/models/account_move_line.py,sha256=
|
6
|
+
odoo/addons/l10n_ro_stock_price_difference/models/account_move.py,sha256=NZj8-PqZUV5xt04BQadfXJlYPFTvtDPjdaYGjVglHpg,5516
|
7
|
+
odoo/addons/l10n_ro_stock_price_difference/models/account_move_line.py,sha256=BqvBGhNtgL63c7J9-wr8CrWbqJuGOaAM0TlDUCbTOdg,6051
|
8
8
|
odoo/addons/l10n_ro_stock_price_difference/models/stock_landed_cost.py,sha256=4gRotUV448LZFO780umrFig8jjrIxnTn2vIJsUYd69c,599
|
9
9
|
odoo/addons/l10n_ro_stock_price_difference/readme/CONTRIBUTORS.rst,sha256=imooaJThv-eiLh7K10cko5NoFQKfEbaU4OcGDn9WKqM,301
|
10
10
|
odoo/addons/l10n_ro_stock_price_difference/readme/DESCRIPTION.rst,sha256=WREtcKsSvyty_YnHiOsXvzuFkD1DzE3pH0vZOmgdjzE,168
|
@@ -12,15 +12,15 @@ odoo/addons/l10n_ro_stock_price_difference/security/ir.model.access.csv,sha256=x
|
|
12
12
|
odoo/addons/l10n_ro_stock_price_difference/static/description/icon.png,sha256=MND3TYqrnM623pd0tf3WhoHU-3X5Ns6ho-Yz_HcYlTk,566
|
13
13
|
odoo/addons/l10n_ro_stock_price_difference/static/description/index.html,sha256=iIXRtHnpBHmBhb32nC-8qCmjY8xlnchi_aWkFYPi3xk,13122
|
14
14
|
odoo/addons/l10n_ro_stock_price_difference/tests/__init__.py,sha256=PcHbRHAWEYgzNHB4jfqDxzRCYr22mPq6ZOI621w2seE,121
|
15
|
-
odoo/addons/l10n_ro_stock_price_difference/tests/common.py,sha256=
|
16
|
-
odoo/addons/l10n_ro_stock_price_difference/tests/test_purchase.py,sha256=
|
15
|
+
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=sBJI4ntNIiOuObAgbfa4bxPT-uRRlpKBK4qHcbA_hWw,8094
|
17
17
|
odoo/addons/l10n_ro_stock_price_difference/tests/test_purchase_dozen.py,sha256=PP4E101pnw0BQJShvWRVN-46FMd9aAU-iRyQPtS_rJ8,2426
|
18
|
-
odoo/addons/l10n_ro_stock_price_difference/tests/test_purchase_refund.py,sha256=
|
19
|
-
odoo/addons/l10n_ro_stock_price_difference/tests/test_sale.py,sha256=
|
18
|
+
odoo/addons/l10n_ro_stock_price_difference/tests/test_purchase_refund.py,sha256=EDOf9_bFf5foD3bt39OhkgfT_Mdf8C7AQgwUcfTL1Uk,2324
|
19
|
+
odoo/addons/l10n_ro_stock_price_difference/tests/test_sale.py,sha256=GKl253rDrndcPsjEOWx98QSRz1p5UDJlrZooZksVfAs,2061
|
20
20
|
odoo/addons/l10n_ro_stock_price_difference/wizard/__init__.py,sha256=c6_T4TE-Z_2FeKUsIDsq8aRC2I9ITMIJ-4WTt9Kz9og,44
|
21
21
|
odoo/addons/l10n_ro_stock_price_difference/wizard/price_difference_confirmation.py,sha256=SZOkpnaB1QIorkGXM4LImwPt8as7hR1wT9HNtoaXfUE,575
|
22
22
|
odoo/addons/l10n_ro_stock_price_difference/wizard/price_difference_confirmation.xml,sha256=QjEABFMmvQsVDrqXM2J06VbDMCNUTO3_YptVcuAuRC8,1043
|
23
|
-
odoo_addon_l10n_ro_stock_price_difference-15.0.5.2.
|
24
|
-
odoo_addon_l10n_ro_stock_price_difference-15.0.5.2.
|
25
|
-
odoo_addon_l10n_ro_stock_price_difference-15.0.5.2.
|
26
|
-
odoo_addon_l10n_ro_stock_price_difference-15.0.5.2.
|
23
|
+
odoo_addon_l10n_ro_stock_price_difference-15.0.5.2.1.dist-info/METADATA,sha256=GFu7i9lFWD35ov4YwYMIgw-HuN9NILxjXLq1Pufx4lE,4434
|
24
|
+
odoo_addon_l10n_ro_stock_price_difference-15.0.5.2.1.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
25
|
+
odoo_addon_l10n_ro_stock_price_difference-15.0.5.2.1.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
|
26
|
+
odoo_addon_l10n_ro_stock_price_difference-15.0.5.2.1.dist-info/RECORD,,
|