odoo-addon-contract 18.0.2.0.7.2__py3-none-any.whl → 18.0.2.0.9__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/contract/README.rst +1 -1
- odoo/addons/contract/__manifest__.py +1 -1
- odoo/addons/contract/models/contract.py +29 -0
- odoo/addons/contract/models/contract_template_line.py +3 -2
- odoo/addons/contract/static/description/index.html +1 -1
- odoo/addons/contract/tests/test_contract.py +71 -0
- {odoo_addon_contract-18.0.2.0.7.2.dist-info → odoo_addon_contract-18.0.2.0.9.dist-info}/METADATA +2 -2
- {odoo_addon_contract-18.0.2.0.7.2.dist-info → odoo_addon_contract-18.0.2.0.9.dist-info}/RECORD +10 -10
- {odoo_addon_contract-18.0.2.0.7.2.dist-info → odoo_addon_contract-18.0.2.0.9.dist-info}/WHEEL +0 -0
- {odoo_addon_contract-18.0.2.0.7.2.dist-info → odoo_addon_contract-18.0.2.0.9.dist-info}/top_level.txt +0 -0
odoo/addons/contract/README.rst
CHANGED
|
@@ -11,7 +11,7 @@ Recurring - Contracts Management
|
|
|
11
11
|
!! This file is generated by oca-gen-addon-readme !!
|
|
12
12
|
!! changes will be overwritten. !!
|
|
13
13
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
14
|
-
!! source digest: sha256:
|
|
14
|
+
!! source digest: sha256:8a544b9c5d9b81d8b16bb90b20b33e03d5433bc0df25b9fc788f2f9fa652c1d3
|
|
15
15
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
16
16
|
|
|
17
17
|
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
|
|
@@ -42,6 +42,9 @@ class ContractContract(models.Model):
|
|
|
42
42
|
group_id = fields.Many2one(
|
|
43
43
|
string="Group",
|
|
44
44
|
comodel_name="account.analytic.account",
|
|
45
|
+
compute="_compute_group_id",
|
|
46
|
+
store=True,
|
|
47
|
+
readonly=False,
|
|
45
48
|
ondelete="restrict",
|
|
46
49
|
)
|
|
47
50
|
tag_ids = fields.Many2many(comodel_name="contract.tag", string="Tags")
|
|
@@ -215,6 +218,32 @@ class ContractContract(models.Model):
|
|
|
215
218
|
"invoice"
|
|
216
219
|
]
|
|
217
220
|
|
|
221
|
+
@api.depends(
|
|
222
|
+
"contract_line_ids",
|
|
223
|
+
"contract_line_ids.analytic_distribution",
|
|
224
|
+
"contract_line_fixed_ids",
|
|
225
|
+
"contract_line_fixed_ids.analytic_distribution",
|
|
226
|
+
)
|
|
227
|
+
def _compute_group_id(self):
|
|
228
|
+
"""Compute the group_id based on the analytic_distribution
|
|
229
|
+
in the contract lines.
|
|
230
|
+
If all contract lines have the same analytic account, set it as group_id.
|
|
231
|
+
Otherwise, set group_id to False.
|
|
232
|
+
"""
|
|
233
|
+
for record in self:
|
|
234
|
+
record.group_id = False
|
|
235
|
+
all_analytic_accounts = []
|
|
236
|
+
contract_lines = record.contract_line_ids | record.contract_line_fixed_ids
|
|
237
|
+
for line in contract_lines:
|
|
238
|
+
if line.analytic_distribution:
|
|
239
|
+
all_analytic_accounts.extend(
|
|
240
|
+
int(acc_id)
|
|
241
|
+
for account_ids in line.analytic_distribution.keys()
|
|
242
|
+
for acc_id in account_ids.split(",")
|
|
243
|
+
)
|
|
244
|
+
if len(set(all_analytic_accounts)) == 1:
|
|
245
|
+
record.group_id = all_analytic_accounts[0]
|
|
246
|
+
|
|
218
247
|
# === Onchange Methods ===
|
|
219
248
|
|
|
220
249
|
@api.onchange("contract_template_id")
|
|
@@ -194,8 +194,9 @@ class ContractTemplateLine(models.Model):
|
|
|
194
194
|
line.contract_id.company_id
|
|
195
195
|
).property_product_pricelist
|
|
196
196
|
)
|
|
197
|
+
qty = line.env.context.get("contract_line_qty", line.quantity)
|
|
197
198
|
product = line.product_id.with_context(
|
|
198
|
-
quantity=
|
|
199
|
+
quantity=qty,
|
|
199
200
|
pricelist=pricelist.id,
|
|
200
201
|
partner=line.contract_id.partner_id.id,
|
|
201
202
|
uom=line.uom_id.id,
|
|
@@ -203,7 +204,7 @@ class ContractTemplateLine(models.Model):
|
|
|
203
204
|
"old_date", fields.Date.context_today(line)
|
|
204
205
|
),
|
|
205
206
|
)
|
|
206
|
-
line.price_unit = pricelist._get_product_price(product, quantity=
|
|
207
|
+
line.price_unit = pricelist._get_product_price(product, quantity=qty)
|
|
207
208
|
else:
|
|
208
209
|
line.price_unit = line.specific_price
|
|
209
210
|
|
|
@@ -372,7 +372,7 @@ ul.auto-toc {
|
|
|
372
372
|
!! This file is generated by oca-gen-addon-readme !!
|
|
373
373
|
!! changes will be overwritten. !!
|
|
374
374
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
375
|
-
!! source digest: sha256:
|
|
375
|
+
!! source digest: sha256:8a544b9c5d9b81d8b16bb90b20b33e03d5433bc0df25b9fc788f2f9fa652c1d3
|
|
376
376
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
|
377
377
|
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.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/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/contract/tree/18.0/contract"><img alt="OCA/contract" src="https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/contract-18-0/contract-18-0-contract"><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/contract&target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
|
378
378
|
<p>This module enables contracts management with recurring invoicing
|
|
@@ -74,6 +74,24 @@ class TestContractBase(common.TransactionCase):
|
|
|
74
74
|
"base": "list_price",
|
|
75
75
|
}
|
|
76
76
|
)
|
|
77
|
+
cls.env["product.pricelist.item"].create(
|
|
78
|
+
{
|
|
79
|
+
"pricelist_id": cls.partner.property_product_pricelist.id,
|
|
80
|
+
"product_id": cls.product_2.id,
|
|
81
|
+
"compute_price": "fixed",
|
|
82
|
+
"fixed_price": 100,
|
|
83
|
+
"min_quantity": 1,
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
cls.env["product.pricelist.item"].create(
|
|
87
|
+
{
|
|
88
|
+
"pricelist_id": cls.partner.property_product_pricelist.id,
|
|
89
|
+
"product_id": cls.product_2.id,
|
|
90
|
+
"compute_price": "fixed",
|
|
91
|
+
"fixed_price": 50,
|
|
92
|
+
"min_quantity": 10,
|
|
93
|
+
}
|
|
94
|
+
)
|
|
77
95
|
cls.contract = cls.env["contract.contract"].create(
|
|
78
96
|
{
|
|
79
97
|
"name": "Test Contract",
|
|
@@ -244,6 +262,23 @@ class TestContract(TestContractBase):
|
|
|
244
262
|
self.acct_line.invalidate_model()
|
|
245
263
|
self.assertEqual(self.acct_line.price_unit, 10)
|
|
246
264
|
|
|
265
|
+
def test_automatic_price_min_quantity(self):
|
|
266
|
+
"""Test that automatic pricing respects pricelist quantity-based rules."""
|
|
267
|
+
self.acct_line.product_id = self.product_2.id
|
|
268
|
+
self.acct_line.automatic_price = True
|
|
269
|
+
self.acct_line.quantity = 1
|
|
270
|
+
self.assertEqual(
|
|
271
|
+
self.acct_line.price_unit,
|
|
272
|
+
100,
|
|
273
|
+
"Price should be 100 for quantity 1 based on pricelist rule",
|
|
274
|
+
)
|
|
275
|
+
self.acct_line.quantity = 10
|
|
276
|
+
self.assertEqual(
|
|
277
|
+
self.acct_line.price_unit,
|
|
278
|
+
50,
|
|
279
|
+
"Price should be 50 for quantity 10 based on pricelist rule",
|
|
280
|
+
)
|
|
281
|
+
|
|
247
282
|
def test_automatic_price_change(self):
|
|
248
283
|
self.acct_line.automatic_price = True
|
|
249
284
|
self.product_1.list_price = 1100
|
|
@@ -1522,3 +1557,39 @@ class TestContract(TestContractBase):
|
|
|
1522
1557
|
self.contract3.contract_line_ids.recurring_next_date = fields.Date.today()
|
|
1523
1558
|
invoice_id = self.contract3.recurring_create_invoice()
|
|
1524
1559
|
self.assertEqual(invoice_id.invoice_line_ids[0].name, "Header for May Services")
|
|
1560
|
+
|
|
1561
|
+
def test_analytic_account(self):
|
|
1562
|
+
"""Tests the automatic setting of the analytic account on the contract
|
|
1563
|
+
depending on the analytic accounts set on the contract lines.
|
|
1564
|
+
# Case 1: only one contract line with one analytic account
|
|
1565
|
+
=> the analytic account is set on the contract
|
|
1566
|
+
# Case 2: only one contract line with two analytic accounts
|
|
1567
|
+
=> the analytic account is not set on the contract
|
|
1568
|
+
# Case 3: two contract lines, with the same analytic account
|
|
1569
|
+
=> the analytic account is set on the contract
|
|
1570
|
+
# Case 4: two contract lines, each one with one analytic account
|
|
1571
|
+
=> the analytic account is not set on the contract
|
|
1572
|
+
"""
|
|
1573
|
+
plan = self.env["account.analytic.plan"].create({"name": "Test plan contract"})
|
|
1574
|
+
self.analytic_account_1 = self.env["account.analytic.account"].create(
|
|
1575
|
+
{"name": "Test account contract 1", "plan_id": plan.id}
|
|
1576
|
+
)
|
|
1577
|
+
self.analytic_account_2 = self.env["account.analytic.account"].create(
|
|
1578
|
+
{"name": "Test account contract 2", "plan_id": plan.id}
|
|
1579
|
+
)
|
|
1580
|
+
# Case 1: only one contract line with one analytic account
|
|
1581
|
+
self.acct_line.analytic_distribution = {self.analytic_account_1.id: 100}
|
|
1582
|
+
self.assertEqual(self.contract.group_id, self.analytic_account_1)
|
|
1583
|
+
# Case 2: only one contract line with two analytic accounts
|
|
1584
|
+
self.acct_line.analytic_distribution = {
|
|
1585
|
+
self.analytic_account_1.id: 50,
|
|
1586
|
+
self.analytic_account_2.id: 50,
|
|
1587
|
+
}
|
|
1588
|
+
self.assertFalse(self.contract.group_id)
|
|
1589
|
+
# Case 3: two contract lines, with the same analytic account
|
|
1590
|
+
self.acct_line.analytic_distribution = {self.analytic_account_1.id: 100}
|
|
1591
|
+
new_contract_line = self.acct_line.copy()
|
|
1592
|
+
self.assertEqual(self.contract.group_id, self.analytic_account_1)
|
|
1593
|
+
# Case 4: two contract lines, each one with one analytic account
|
|
1594
|
+
new_contract_line.analytic_distribution = {self.analytic_account_2.id: 100}
|
|
1595
|
+
self.assertFalse(self.contract.group_id)
|
{odoo_addon_contract-18.0.2.0.7.2.dist-info → odoo_addon_contract-18.0.2.0.9.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: odoo-addon-contract
|
|
3
|
-
Version: 18.0.2.0.
|
|
3
|
+
Version: 18.0.2.0.9
|
|
4
4
|
Requires-Python: >=3.10
|
|
5
5
|
Requires-Dist: odoo==18.0.*
|
|
6
6
|
Summary: Recurring - Contracts Management
|
|
@@ -28,7 +28,7 @@ Recurring - Contracts Management
|
|
|
28
28
|
!! This file is generated by oca-gen-addon-readme !!
|
|
29
29
|
!! changes will be overwritten. !!
|
|
30
30
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
31
|
-
!! source digest: sha256:
|
|
31
|
+
!! source digest: sha256:8a544b9c5d9b81d8b16bb90b20b33e03d5433bc0df25b9fc788f2f9fa652c1d3
|
|
32
32
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
33
33
|
|
|
34
34
|
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
|
{odoo_addon_contract-18.0.2.0.7.2.dist-info → odoo_addon_contract-18.0.2.0.9.dist-info}/RECORD
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
odoo/addons/contract/README.rst,sha256=
|
|
1
|
+
odoo/addons/contract/README.rst,sha256=5b3lv51W4eQ5HQkBFcOFlfY6whnb_nPeA1WCNaEE5YA,6176
|
|
2
2
|
odoo/addons/contract/__init__.py,sha256=dnUeA_K1torbiMNF3tt2dtECdk-FkWm01DByr9MBMIA,69
|
|
3
|
-
odoo/addons/contract/__manifest__.py,sha256=
|
|
3
|
+
odoo/addons/contract/__manifest__.py,sha256=y5lXplIdy4JCbs9MFAqUU-m4z0HgvcSNNwQ0IZHb1Ok,1777
|
|
4
4
|
odoo/addons/contract/controllers/__init__.py,sha256=ZAYSY9pxyJjumL2QVLuxqtBzjLwKPiQsVXMBAWvNGGY,85
|
|
5
5
|
odoo/addons/contract/controllers/main.py,sha256=5C-WzZ6zPWeea-Kb0U01a1yNCtcn29iZeoc9hjkODa4,3676
|
|
6
6
|
odoo/addons/contract/data/contract_cron.xml,sha256=yYTdn4fmIU5zsfFEgx-H_55M9nwc0WfJ3Q6ufxQKPt8,549
|
|
@@ -84,13 +84,13 @@ odoo/addons/contract/migrations/18.0.2.0.0/pre-migrate.py,sha256=ywaZcxy-bxj2MRi
|
|
|
84
84
|
odoo/addons/contract/models/__init__.py,sha256=n3UpKXb_Oi-2ebHho6pWrd6kw_cMK6GG1E3fl7ey_zc,372
|
|
85
85
|
odoo/addons/contract/models/account_move.py,sha256=QdSF_E5cifIgOiPiZ1PKXxuA5y9y4PC-kkUurDdGKo4,387
|
|
86
86
|
odoo/addons/contract/models/account_move_line.py,sha256=X-GJ66Q_6BySwImRLMpFxgIqfhsOaEUb6xLSQveB0uc,396
|
|
87
|
-
odoo/addons/contract/models/contract.py,sha256=
|
|
87
|
+
odoo/addons/contract/models/contract.py,sha256=8hDXkCn5cakR9qPIcfTaJl2j4Kb12M1nATUfSfIvnnU,26826
|
|
88
88
|
odoo/addons/contract/models/contract_line.py,sha256=0vuK44zs8jByFnYFI0nZ9IYz8lsbv7nPdhaDLpYIYIA,10298
|
|
89
89
|
odoo/addons/contract/models/contract_modification.py,sha256=d0tv2Zn6_WrR633pmzwAavzC2I3sLYmGokOKtMn7AYY,1147
|
|
90
90
|
odoo/addons/contract/models/contract_recurring_mixin.py,sha256=KE4sMLd241v1RgTtdPGHbak-RD2sJmSLYsKNPWaQ8Mg,9278
|
|
91
91
|
odoo/addons/contract/models/contract_tag.py,sha256=h5Up3F6ijIhQbYSB6xCqZVVUtyLYxfj4MsAIKv2Q5-Q,434
|
|
92
92
|
odoo/addons/contract/models/contract_template.py,sha256=DuodrlWnoKy2jPU3fVQ7z3PGXYRTkOrL5Ulbiv7FbAs,3268
|
|
93
|
-
odoo/addons/contract/models/contract_template_line.py,sha256=
|
|
93
|
+
odoo/addons/contract/models/contract_template_line.py,sha256=yOlOWDiTd8k2jN7bYJXSKuV_BVJ__RuenvCNQB4BTlg,9173
|
|
94
94
|
odoo/addons/contract/models/res_partner.py,sha256=qH2zSQZAjUE1Cb9GSC89SUpQab7_SvOPTCTh5ghkHX4,2651
|
|
95
95
|
odoo/addons/contract/readme/CONFIGURE.md,sha256=k6bzmZn2MY5pmFRj9OZq5GH5MwheH9wJwC3unMZGv0M,223
|
|
96
96
|
odoo/addons/contract/readme/CONTRIBUTORS.md,sha256=s68TU6AKQzW9bx6qflxjQa635SBQGzfnL-R3FRLuduQ,620
|
|
@@ -103,7 +103,7 @@ odoo/addons/contract/security/contract_security.xml,sha256=HZuxPZMX-EMf8QtXdwbnL
|
|
|
103
103
|
odoo/addons/contract/security/contract_tag.xml,sha256=cetorNv2M6tHKHcnfwUeX85EZyT3tpoBLF8W-XZ7sK8,890
|
|
104
104
|
odoo/addons/contract/security/ir.model.access.csv,sha256=icelaOGF35WgUrxB2l18IVfcUNlPuJnzy4LG676_zt0,1569
|
|
105
105
|
odoo/addons/contract/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
|
|
106
|
-
odoo/addons/contract/static/description/index.html,sha256=
|
|
106
|
+
odoo/addons/contract/static/description/index.html,sha256=EL7N10r4BYTfz0oK7xCk2d3dNDUor5bU1T07F0j0Iis,17445
|
|
107
107
|
odoo/addons/contract/static/src/img/contract_icon.svg,sha256=2IFs70Oy9WtE9of2SO4Vj08mwzcw-I5s_LL3UvtKlus,9643
|
|
108
108
|
odoo/addons/contract/static/src/js/contract_portal_tour.esm.js,sha256=ULRzpiiKOhvKx0P-SBoMVBJzGtOQfi70yf2-1djxFuk,589
|
|
109
109
|
odoo/addons/contract/static/src/screenshots/portal-detail.png,sha256=8pMCU4nqwnSM-rbWZd3iJxXdYLBiYzuWNvT_NKslcoo,113399
|
|
@@ -111,7 +111,7 @@ odoo/addons/contract/static/src/screenshots/portal-list.png,sha256=gWSW4rlncFZem
|
|
|
111
111
|
odoo/addons/contract/static/src/screenshots/portal-my.png,sha256=YrtvTDjoc839Eka5zSZ8FQhtzoMEeW4FrXGrYAwAkS4,22985
|
|
112
112
|
odoo/addons/contract/static/src/scss/frontend.scss,sha256=LilfXNOwW8D2eXOMY0ZgrEv8hU5Vn1u9inCEIJp8D0g,1863
|
|
113
113
|
odoo/addons/contract/tests/__init__.py,sha256=iive8lH1QtzKmbhBBzzU4AQgSAgWxdJF1mMLEFOiA4c,138
|
|
114
|
-
odoo/addons/contract/tests/test_contract.py,sha256=
|
|
114
|
+
odoo/addons/contract/tests/test_contract.py,sha256=SbfNbmuVT6mSL8avthQLUsqWdz1JVtKlyMMB62TR9vM,68620
|
|
115
115
|
odoo/addons/contract/tests/test_contract_manually_create_invoice.py,sha256=GfA-hDaI4mSztE-2zQgFE_bQM-nsKzFhQRybi8EGeLo,2541
|
|
116
116
|
odoo/addons/contract/tests/test_multicompany.py,sha256=0CPfv0-JSFsXRInazugzzYrogSZFa6lrdNwuBLbaTX8,4552
|
|
117
117
|
odoo/addons/contract/tests/test_portal.py,sha256=pyhXyzB5o-jdzJW6x10tF7pRuIUQWLQXTSUsB7nUB2k,1298
|
|
@@ -126,7 +126,7 @@ odoo/addons/contract/views/res_partner_view.xml,sha256=v7RAxXm0japPQeOsf2zLgieZH
|
|
|
126
126
|
odoo/addons/contract/wizards/__init__.py,sha256=ZSirPz2XSS6FGPESnPJHqIJamHdHrdL7j2oYu_kglTs,47
|
|
127
127
|
odoo/addons/contract/wizards/contract_manually_create_invoice.py,sha256=LIOStLcchRqOeRbHCPnEmrEj1c9_8BSW6HixsBmU57Y,2986
|
|
128
128
|
odoo/addons/contract/wizards/contract_manually_create_invoice.xml,sha256=JPgtH9mDP74PhTgsJ0lZ1zmn8P3WWRRKp9QUWn38W-4,3730
|
|
129
|
-
odoo_addon_contract-18.0.2.0.
|
|
130
|
-
odoo_addon_contract-18.0.2.0.
|
|
131
|
-
odoo_addon_contract-18.0.2.0.
|
|
132
|
-
odoo_addon_contract-18.0.2.0.
|
|
129
|
+
odoo_addon_contract-18.0.2.0.9.dist-info/METADATA,sha256=AS0MNTd7eyAiB9JfJEaXTqB8hG7W0DERCIE1A2rTP20,6785
|
|
130
|
+
odoo_addon_contract-18.0.2.0.9.dist-info/WHEEL,sha256=ZhOvUsYhy81Dx67gN3TV0RchQWBIIzutDZaJODDg2Vo,81
|
|
131
|
+
odoo_addon_contract-18.0.2.0.9.dist-info/top_level.txt,sha256=QE6RBQ0QX5f4eFuUcGgU5Kbq1A_qJcDs-e_vpr6pmfU,4
|
|
132
|
+
odoo_addon_contract-18.0.2.0.9.dist-info/RECORD,,
|
{odoo_addon_contract-18.0.2.0.7.2.dist-info → odoo_addon_contract-18.0.2.0.9.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|