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zjFD4W|Y9MIOpwOarCwJn~Q;tS6o<>5I>g#cBAqngi;E^9DxClyk
zy+%`EpT*4X&G_g^hoiydgl6J`q)Z0%^;sZ|iV-_s*_EoF!pj51@H_>W_t-^5!jq)l
zIH@KcI7hjCi4DD2w^V@>))c@oDxEUKHx*2ttMxiATz4l%#ulSg8$qkS3_)cGagjMe
zMY#Y~PCk|2%V6?c^8ia<$&j{yk|4eM2^e5{;9WfKAfzG`MI)Z!FMQfCPXz`XqCgI%
z?*h&3C7j79+p?bR~!Gtq|H&EY!0ST(6H8_VwOLkeSnlgioS-oQA}qt+B;g@JzL@;O!O!#kbt5Cu@>3
zS<+fqT3;rZR!J31OzTb&Zea)6D2~r0BDg2lL)Q8e{9r+D5n0lMoig^MPqjNE^@p$~
zA*EpQsO-|sm$$h-H_Mt#5ek~-3H)dAM(BPGo=xN;4yg!flKaQ@u9aDx3+q{^aUN|P
z(adDlAp^=S6kt`xZoZ+OJ^D6V+pS@*p;B*!1Qrt*G`%M}58wz5vH-@4Tto(AicN#)*iZ~mu;Cdk
z)Xj^Q)v@V!mIvEw^UyT!=aR5T`%b|WCdK#B+?GNKxxj+x`wdk$;^Nm1$4qMH8M-N^
zl0gBIt{&SlPM&0JodR0G5#~Ha{~TDLQlFVosJi|Qj(aSywHJT^&zJ||$;!Qu+1uQK
z@iH8ZotBskyO+;?2zG`Ek5i
zvg+&nlgn#KZ+$6E?+eZC%}qsz9U5e4ooq9$s&r_58NvK`17FFZmdPtYgbn#DvgT#>
z=cX7@Ln)9&hOY2*`>1yDC3zL)J=%Qst5nT^)&7
Date: Thu, 20 Feb 2020 17:26:51 +0000
Subject: [PATCH 08/14] agreement_legal_sale 12.0.1.1.1
[UPD] README.rst
[UPD] README.rst
---
agreement_legal_sale/__manifest__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/agreement_legal_sale/__manifest__.py b/agreement_legal_sale/__manifest__.py
index ac1bc5e19..665dc8736 100644
--- a/agreement_legal_sale/__manifest__.py
+++ b/agreement_legal_sale/__manifest__.py
@@ -4,7 +4,7 @@
{
'name': 'Agreement Legal Sale',
'summary': 'Create an agreement when the sale order is confirmed',
- 'version': '12.0.1.1.0',
+ 'version': '12.0.1.1.1',
'license': 'AGPL-3',
'author': 'Open Source Integrators, Odoo Community Association (OCA)',
'category': 'Agreement',
From 01a816bcfe173c6ed783342f46dc15e1a8d3b36f Mon Sep 17 00:00:00 2001
From: scampbell
Date: Fri, 3 Apr 2020 13:00:51 -0700
Subject: [PATCH 09/14] [IMP] Allow Multiple SP's From SO Line
[IMP] Simplify
[IMP] Product ID
[IMP] Indents
Indent
Update agreement_legal_sale/models/sale_order.py
Co-Authored-By: Daniel Reis
Update agreement_legal_sale/models/sale_order.py
Co-Authored-By: Daniel Reis
[IMP] Daniel Changes
---
agreement_legal_sale/__manifest__.py | 1 +
agreement_legal_sale/models/sale_order.py | 63 ++++++++++++++---------
2 files changed, 40 insertions(+), 24 deletions(-)
diff --git a/agreement_legal_sale/__manifest__.py b/agreement_legal_sale/__manifest__.py
index 665dc8736..85ebdd60d 100644
--- a/agreement_legal_sale/__manifest__.py
+++ b/agreement_legal_sale/__manifest__.py
@@ -12,6 +12,7 @@
'depends': [
'agreement_legal',
'agreement_sale',
+ 'agreement_serviceprofile'
],
'data': [
'views/agreement.xml',
diff --git a/agreement_legal_sale/models/sale_order.py b/agreement_legal_sale/models/sale_order.py
index 53967e2f9..635f3aaed 100644
--- a/agreement_legal_sale/models/sale_order.py
+++ b/agreement_legal_sale/models/sale_order.py
@@ -17,34 +17,49 @@ class SaleOrder(models.Model):
res = super(SaleOrder, self)._action_confirm()
for order in self:
if order.agreement_template_id:
- order.agreement_id = order.agreement_template_id.copy(default={
- 'name': order.name,
- 'code': order.name,
- 'is_template': False,
- 'sale_id': order.id,
- 'partner_id': order.partner_id.id,
- 'analytic_account_id': order.analytic_account_id and
- order.analytic_account_id.id or False,
- })
+ order.agreement_id = order.\
+ agreement_template_id.copy(default={
+ 'name': order.name,
+ 'code': order.name,
+ 'is_template': False,
+ 'sale_id': order.id,
+ 'partner_id': order.partner_id.id,
+ 'analytic_account_id': order.analytic_account_id and
+ order.analytic_account_id.id or False,
+ })
for line in order.order_line:
# Create agreement line
- self.env['agreement.line'].create({
- 'product_id': line.product_id.id,
- 'name': line.name,
- 'agreement_id': order.agreement_id.id,
- 'qty': line.product_uom_qty,
- 'sale_line_id': line.id,
- 'uom_id': line.product_uom.id
- })
- # If the product creates service profiles, create one
- if line.product_id.product_tmpl_id.is_serviceprofile:
- self.env['agreement.serviceprofile'].create({
- 'name': line.name,
- 'product_id': line.product_id.product_tmpl_id.id,
- 'agreement_id': order.agreement_id.id,
- })
+ self.env['agreement.line'].\
+ create(self._get_agreement_line_vals(line))
+ # Create SP's based on product_id config
+ if line.product_id.is_serviceprofile:
+ self.create_sp_qty(line, order)
return res
+ def create_sp_qty(self, line, order):
+ """ Create line.product_uom_qty SP's """
+ if line.product_id.product_tmpl_id.is_serviceprofile:
+ for i in range(1, int(line.product_uom_qty)+1):
+ sp = self.env['agreement.serviceprofile'].\
+ create(self._get_sp_vals(line, order, i))
+
+ def _get_agreement_line_vals(self, line):
+ return {
+ 'product_id': line.product_id.id,
+ 'name': line.name,
+ 'agreement_id': line.order_id.agreement_id.id,
+ 'qty': line.product_uom_qty,
+ 'sale_line_id': line.id,
+ 'uom_id': line.product_uom.id
+ }
+
+ def _get_sp_vals(self, line, order, i):
+ return {
+ 'name': line.name + ' ' + str(i),
+ 'product_id': line.product_id.product_tmpl_id.id,
+ 'agreement_id': order.agreement_id.id,
+ }
+
def action_confirm(self):
# If sale_timesheet is installed, the _action_confirm()
# may be setting an Analytic Account on the SO.
From 8208fe9406392aade5680e35c19f799232311965 Mon Sep 17 00:00:00 2001
From: Daniel Reis
Date: Thu, 9 Apr 2020 18:05:00 +0100
Subject: [PATCH 10/14] [REF] Fix lint (unused variable)
---
agreement_legal_sale/models/sale_order.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/agreement_legal_sale/models/sale_order.py b/agreement_legal_sale/models/sale_order.py
index 635f3aaed..76c48eec0 100644
--- a/agreement_legal_sale/models/sale_order.py
+++ b/agreement_legal_sale/models/sale_order.py
@@ -40,7 +40,7 @@ class SaleOrder(models.Model):
""" Create line.product_uom_qty SP's """
if line.product_id.product_tmpl_id.is_serviceprofile:
for i in range(1, int(line.product_uom_qty)+1):
- sp = self.env['agreement.serviceprofile'].\
+ self.env['agreement.serviceprofile'].\
create(self._get_sp_vals(line, order, i))
def _get_agreement_line_vals(self, line):
From 1b18d132a30e0bf73e8df3512f28d2af419f3aa4 Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Thu, 9 Apr 2020 18:50:56 +0000
Subject: [PATCH 11/14] agreement_legal_sale 12.0.2.0.0
Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8 of 8 strings)
Translation: contract-12.0/contract-12.0-agreement_legal_sale
Translate-URL: https://translation.odoo-community.org/projects/contract-12-0/contract-12-0-agreement_legal_sale/pt_BR/
Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8 of 8 strings)
Translation: contract-12.0/contract-12.0-agreement_legal_sale
Translate-URL: https://translation.odoo-community.org/projects/contract-12-0/contract-12-0-agreement_legal_sale/pt_BR/
Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8 of 8 strings)
Translation: contract-12.0/contract-12.0-agreement_legal_sale
Translate-URL: https://translation.odoo-community.org/projects/contract-12-0/contract-12-0-agreement_legal_sale/pt_BR/
Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8 of 8 strings)
Translation: contract-12.0/contract-12.0-agreement_legal_sale
Translate-URL: https://translation.odoo-community.org/projects/contract-12-0/contract-12-0-agreement_legal_sale/pt_BR/
---
agreement_legal_sale/__manifest__.py | 2 +-
agreement_legal_sale/i18n/pt_BR.po | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/agreement_legal_sale/__manifest__.py b/agreement_legal_sale/__manifest__.py
index 85ebdd60d..eb40ee121 100644
--- a/agreement_legal_sale/__manifest__.py
+++ b/agreement_legal_sale/__manifest__.py
@@ -4,7 +4,7 @@
{
'name': 'Agreement Legal Sale',
'summary': 'Create an agreement when the sale order is confirmed',
- 'version': '12.0.1.1.1',
+ 'version': '12.0.2.0.0',
'license': 'AGPL-3',
'author': 'Open Source Integrators, Odoo Community Association (OCA)',
'category': 'Agreement',
diff --git a/agreement_legal_sale/i18n/pt_BR.po b/agreement_legal_sale/i18n/pt_BR.po
index 28a4165f5..67ab1e597 100644
--- a/agreement_legal_sale/i18n/pt_BR.po
+++ b/agreement_legal_sale/i18n/pt_BR.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
-"PO-Revision-Date: 2020-02-12 05:03+0000\n"
-"Last-Translator: Marcel Savegnago \n"
+"PO-Revision-Date: 2020-11-06 08:08+0000\n"
+"Last-Translator: Eder Brito \n"
"Language-Team: none\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
@@ -24,7 +24,7 @@ msgstr "Acordo"
#. module: agreement_legal_sale
#: model:ir.model,name:agreement_legal_sale.model_agreement_line
msgid "Agreement Lines"
-msgstr "Linhas do Acordo"
+msgstr "Linhas de Acordo"
#. module: agreement_legal_sale
#: model:ir.model.fields,field_description:agreement_legal_sale.field_sale_order__agreement_template_id
@@ -39,7 +39,7 @@ msgstr "Conta Analítica"
#. module: agreement_legal_sale
#: model:ir.model,name:agreement_legal_sale.model_sale_order
msgid "Sale Order"
-msgstr "Ordem de Venda"
+msgstr "Pedido de Venda"
#. module: agreement_legal_sale
#: model_terms:ir.ui.view,arch_db:agreement_legal_sale.agreement_sale_form_view
@@ -49,9 +49,9 @@ msgstr "Vendas"
#. module: agreement_legal_sale
#: model:ir.model.fields,field_description:agreement_legal_sale.field_agreement__sale_id
msgid "Sales Order"
-msgstr "Ordenss de Venda"
+msgstr "Pedido de Vendas"
#. module: agreement_legal_sale
#: model:ir.model.fields,field_description:agreement_legal_sale.field_agreement_line__sale_line_id
msgid "Sales Order Line"
-msgstr "Linha de Ordens de Venda"
+msgstr "Linha do Pedido de Venda"
From 3c56a7777ca0d1d2cbe55990ebc3366793af6559 Mon Sep 17 00:00:00 2001
From: Patrick Wilson <36892066+patrickrwilson@users.noreply.github.com>
Date: Mon, 10 May 2021 15:45:18 -0600
Subject: [PATCH 12/14] [14.0][MIG] agreement_legal_sale (Version 12.0 to 14.0)
[MIG] Prettier
[MIG] Tests
Pre-Commit
---
agreement_legal_sale/README.rst | 8 +--
agreement_legal_sale/__manifest__.py | 36 +++++-----
agreement_legal_sale/models/agreement.py | 12 ++--
agreement_legal_sale/models/sale_order.py | 71 ++++++++++---------
.../static/description/index.html | 6 +-
agreement_legal_sale/tests/__init__.py | 1 +
agreement_legal_sale/tests/test_sale_order.py | 52 ++++++++++++++
agreement_legal_sale/views/agreement.xml | 20 +++---
agreement_legal_sale/views/sale_order.xml | 15 ++--
9 files changed, 138 insertions(+), 83 deletions(-)
create mode 100644 agreement_legal_sale/tests/__init__.py
create mode 100644 agreement_legal_sale/tests/test_sale_order.py
diff --git a/agreement_legal_sale/README.rst b/agreement_legal_sale/README.rst
index fadda0cd3..702c1e024 100644
--- a/agreement_legal_sale/README.rst
+++ b/agreement_legal_sale/README.rst
@@ -14,13 +14,13 @@ Agreement Legal Sale
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github
- :target: https://github.com/OCA/contract/tree/12.0/agreement_legal_sale
+ :target: https://github.com/OCA/contract/tree/14.0/agreement_legal_sale
:alt: OCA/contract
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/contract-12-0/contract-12-0-agreement_legal_sale
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/110/12.0
+ :target: https://runbot.odoo-community.org/runbot/110/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -75,7 +75,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -126,6 +126,6 @@ Current `maintainers `__:
|maintainer-osi-scampbell| |maintainer-max3903|
-This module is part of the `OCA/contract `_ project on GitHub.
+This module is part of the `OCA/contract `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/agreement_legal_sale/__manifest__.py b/agreement_legal_sale/__manifest__.py
index eb40ee121..0f00767d0 100644
--- a/agreement_legal_sale/__manifest__.py
+++ b/agreement_legal_sale/__manifest__.py
@@ -2,26 +2,22 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
- 'name': 'Agreement Legal Sale',
- 'summary': 'Create an agreement when the sale order is confirmed',
- 'version': '12.0.2.0.0',
- 'license': 'AGPL-3',
- 'author': 'Open Source Integrators, Odoo Community Association (OCA)',
- 'category': 'Agreement',
- 'website': 'https://github.com/OCA/contract',
- 'depends': [
- 'agreement_legal',
- 'agreement_sale',
- 'agreement_serviceprofile'
+ "name": "Agreement Legal Sale",
+ "summary": "Create an agreement when the sale order is confirmed",
+ "version": "14.0.1.0.0",
+ "license": "AGPL-3",
+ "author": "Open Source Integrators, Odoo Community Association (OCA)",
+ "category": "Agreement",
+ "website": "https://github.com/OCA/contract",
+ "depends": ["agreement_legal", "agreement_sale", "agreement_serviceprofile"],
+ "data": [
+ "views/agreement.xml",
+ "views/sale_order.xml",
],
- 'data': [
- 'views/agreement.xml',
- 'views/sale_order.xml',
- ],
- 'installable': True,
- 'development_status': 'Beta',
- 'maintainers': [
- 'osi-scampbell',
- 'max3903',
+ "installable": True,
+ "development_status": "Beta",
+ "maintainers": [
+ "osi-scampbell",
+ "max3903",
],
}
diff --git a/agreement_legal_sale/models/agreement.py b/agreement_legal_sale/models/agreement.py
index 47ba502eb..456c03d12 100644
--- a/agreement_legal_sale/models/agreement.py
+++ b/agreement_legal_sale/models/agreement.py
@@ -5,17 +5,15 @@ from odoo import fields, models
class Agreement(models.Model):
- _inherit = 'agreement'
+ _inherit = "agreement"
- sale_id = fields.Many2one('sale.order', string='Sales Order')
+ sale_id = fields.Many2one("sale.order", string="Sales Order")
analytic_account_id = fields.Many2one(
- 'account.analytic.account',
- 'Analytic Account',
- copy=False)
+ "account.analytic.account", "Analytic Account", copy=False
+ )
class AgreementLine(models.Model):
_inherit = "agreement.line"
- sale_line_id = fields.Many2one('sale.order.line',
- string='Sales Order Line')
+ sale_line_id = fields.Many2one("sale.order.line", string="Sales Order Line")
diff --git a/agreement_legal_sale/models/sale_order.py b/agreement_legal_sale/models/sale_order.py
index 76c48eec0..8a3e308bd 100644
--- a/agreement_legal_sale/models/sale_order.py
+++ b/agreement_legal_sale/models/sale_order.py
@@ -1,63 +1,65 @@
# Copyright (C) 2019 - TODAY, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-from odoo import api, fields, models
+from odoo import fields, models
class SaleOrder(models.Model):
- _inherit = 'sale.order'
+ _inherit = "sale.order"
agreement_template_id = fields.Many2one(
- 'agreement',
- string="Agreement Template",
- domain="[('is_template', '=', True)]")
+ "agreement", string="Agreement Template", domain="[('is_template', '=', True)]"
+ )
- @api.multi
def _action_confirm(self):
res = super(SaleOrder, self)._action_confirm()
for order in self:
if order.agreement_template_id:
- order.agreement_id = order.\
- agreement_template_id.copy(default={
- 'name': order.name,
- 'code': order.name,
- 'is_template': False,
- 'sale_id': order.id,
- 'partner_id': order.partner_id.id,
- 'analytic_account_id': order.analytic_account_id and
- order.analytic_account_id.id or False,
- })
+ order.agreement_id = order.agreement_template_id.copy(
+ default={
+ "name": order.name,
+ "code": order.name,
+ "is_template": False,
+ "sale_id": order.id,
+ "partner_id": order.partner_id.id,
+ "analytic_account_id": order.analytic_account_id
+ and order.analytic_account_id.id
+ or False,
+ }
+ )
for line in order.order_line:
# Create agreement line
- self.env['agreement.line'].\
- create(self._get_agreement_line_vals(line))
+ self.env["agreement.line"].create(
+ self._get_agreement_line_vals(line)
+ )
# Create SP's based on product_id config
if line.product_id.is_serviceprofile:
self.create_sp_qty(line, order)
return res
def create_sp_qty(self, line, order):
- """ Create line.product_uom_qty SP's """
+ """Create line.product_uom_qty SP's"""
if line.product_id.product_tmpl_id.is_serviceprofile:
- for i in range(1, int(line.product_uom_qty)+1):
- self.env['agreement.serviceprofile'].\
- create(self._get_sp_vals(line, order, i))
+ for i in range(1, int(line.product_uom_qty) + 1):
+ self.env["agreement.serviceprofile"].create(
+ self._get_sp_vals(line, order, i)
+ )
def _get_agreement_line_vals(self, line):
return {
- 'product_id': line.product_id.id,
- 'name': line.name,
- 'agreement_id': line.order_id.agreement_id.id,
- 'qty': line.product_uom_qty,
- 'sale_line_id': line.id,
- 'uom_id': line.product_uom.id
+ "product_id": line.product_id.id,
+ "name": line.name,
+ "agreement_id": line.order_id.agreement_id.id,
+ "qty": line.product_uom_qty,
+ "sale_line_id": line.id,
+ "uom_id": line.product_uom.id,
}
def _get_sp_vals(self, line, order, i):
return {
- 'name': line.name + ' ' + str(i),
- 'product_id': line.product_id.product_tmpl_id.id,
- 'agreement_id': order.agreement_id.id,
+ "name": line.name + " " + str(i),
+ "product_id": line.product_id.product_tmpl_id.id,
+ "agreement_id": order.agreement_id.id,
}
def action_confirm(self):
@@ -70,7 +72,10 @@ class SaleOrder(models.Model):
res = super(SaleOrder, self).action_confirm()
for order in self:
agreement = order.agreement_id
- if (order.analytic_account_id and agreement and
- not agreement.analytic_account_id):
+ if (
+ order.analytic_account_id
+ and agreement
+ and not agreement.analytic_account_id
+ ):
agreement.analytic_account_id = order.analytic_account_id
return res
diff --git a/agreement_legal_sale/static/description/index.html b/agreement_legal_sale/static/description/index.html
index 1aa0ee8a5..e47063650 100644
--- a/agreement_legal_sale/static/description/index.html
+++ b/agreement_legal_sale/static/description/index.html
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

+

Odoo Sales App does not support the management of legal content for agreements
and contracts. It’s also not integrated with the Agreement App.
This module is for companies that needs their customer to sign an agreement
@@ -426,7 +426,7 @@ sections, clauses, recitals and appendices
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback.
+feedback.
Do not contact contributors directly about support or help with technical issues.
diff --git a/agreement_legal_sale/tests/__init__.py b/agreement_legal_sale/tests/__init__.py
new file mode 100644
index 000000000..6f699d0d8
--- /dev/null
+++ b/agreement_legal_sale/tests/__init__.py
@@ -0,0 +1 @@
+from . import test_sale_order
diff --git a/agreement_legal_sale/tests/test_sale_order.py b/agreement_legal_sale/tests/test_sale_order.py
new file mode 100644
index 000000000..0727c12c4
--- /dev/null
+++ b/agreement_legal_sale/tests/test_sale_order.py
@@ -0,0 +1,52 @@
+# Copyright 2021 Ecosoft Co., Ltd (http://ecosoft.co.th)
+# Copyright 2021 Sergio Teruel - Tecnativa
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
+
+from datetime import timedelta
+
+from odoo import fields
+from odoo.tests.common import TransactionCase
+
+
+class TestSaleOrder(TransactionCase):
+ def setUp(self):
+ super().setUp()
+ self.test_customer = self.env["res.partner"].create({"name": "TestCustomer"})
+ self.agreement_type = self.env["agreement.type"].create(
+ {
+ "name": "Test Agreement Type",
+ "domain": "sale",
+ }
+ )
+ self.test_agreement_template = self.env["agreement"].create(
+ {
+ "name": "TestAgreementTemplate",
+ "description": "Test Template",
+ "special_terms": "Test Template",
+ "is_template": True,
+ "partner_id": self.test_customer.id,
+ "start_date": fields.Date.today(),
+ "end_date": fields.Date.today() + timedelta(days=365),
+ }
+ )
+ self.test_product = self.env["product.product"].create({"name": "TestProduct"})
+ self.test_sale_order = self.env["sale.order"].create(
+ {
+ "partner_id": self.test_customer.id,
+ "agreement_template_id": self.test_agreement_template.id,
+ "date_order": fields.Date.today(),
+ "order_line": [
+ (0, 0, {"product_id": self.test_product.id, "product_uom_qty": 1.0})
+ ],
+ }
+ )
+
+ # TEST 01: Test _action_confirm method
+ def test_action_confirm(self):
+ sale_order = self.test_sale_order
+ sale_order._action_confirm()
+ agreement = self.env["agreement"].search([("sale_id", "=", sale_order.id)])
+ self.assertEqual(
+ agreement.sale_id.id,
+ sale_order.id,
+ )
diff --git a/agreement_legal_sale/views/agreement.xml b/agreement_legal_sale/views/agreement.xml
index dffaee978..8c4be1ef0 100644
--- a/agreement_legal_sale/views/agreement.xml
+++ b/agreement_legal_sale/views/agreement.xml
@@ -1,29 +1,31 @@
-
+
-
agreement.form.view
agreement
-
+
-
-
+
+
-
+
-
+
diff --git a/agreement_legal_sale/views/sale_order.xml b/agreement_legal_sale/views/sale_order.xml
index 8a077c3db..c6bc21c2c 100644
--- a/agreement_legal_sale/views/sale_order.xml
+++ b/agreement_legal_sale/views/sale_order.xml
@@ -1,20 +1,21 @@
-
+
-
sale.order.agreement.form.view
sale.order
-
+
-
- {'invisible': [('agreement_id', '=', False)]}
+
+ {'invisible': [('agreement_id', '=', False)]}
-
+
From ffaa36d0b1aad1d53de0bff57511f08232697be7 Mon Sep 17 00:00:00 2001
From: HemanginiPatel
Date: Mon, 16 Aug 2021 16:08:14 +0530
Subject: [PATCH 13/14] [IMP]Improved the UT.
---
agreement_legal_sale/tests/test_sale_order.py | 55 +++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/agreement_legal_sale/tests/test_sale_order.py b/agreement_legal_sale/tests/test_sale_order.py
index 0727c12c4..87696a9e1 100644
--- a/agreement_legal_sale/tests/test_sale_order.py
+++ b/agreement_legal_sale/tests/test_sale_order.py
@@ -18,6 +18,9 @@ class TestSaleOrder(TransactionCase):
"domain": "sale",
}
)
+ self.test_account_analytic_account = self.env[
+ "account.analytic.account"
+ ].create({"name": "Test Analytic Account"})
self.test_agreement_template = self.env["agreement"].create(
{
"name": "TestAgreementTemplate",
@@ -27,6 +30,20 @@ class TestSaleOrder(TransactionCase):
"partner_id": self.test_customer.id,
"start_date": fields.Date.today(),
"end_date": fields.Date.today() + timedelta(days=365),
+ "analytic_account_id": self.test_account_analytic_account.id,
+ }
+ )
+ self.test_agreement_template_no_analytic_account_id = self.env[
+ "agreement"
+ ].create(
+ {
+ "name": "TestAgreementTemplate A",
+ "description": "Test Template",
+ "special_terms": "Test Template",
+ "is_template": True,
+ "partner_id": self.test_customer.id,
+ "start_date": fields.Date.today(),
+ "end_date": fields.Date.today() + timedelta(days=365),
}
)
self.test_product = self.env["product.product"].create({"name": "TestProduct"})
@@ -40,6 +57,33 @@ class TestSaleOrder(TransactionCase):
],
}
)
+ self.test_product_templ_is_serviceprofile = self.env["product.template"].create(
+ {"name": "TestProductA", "is_serviceprofile": True}
+ )
+ self.test_product_is_serviceprofile = self.env["product.product"].create(
+ {
+ "name": "TestProductA",
+ "is_serviceprofile": True,
+ "product_tmpl_id": self.test_product_templ_is_serviceprofile.id,
+ }
+ )
+ self.test_sale_order_is_serviceprofile = self.env["sale.order"].create(
+ {
+ "partner_id": self.test_customer.id,
+ "agreement_template_id": self.test_agreement_template.id,
+ "date_order": fields.Date.today(),
+ "order_line": [
+ (
+ 0,
+ 0,
+ {
+ "product_id": self.test_product_is_serviceprofile.id,
+ "product_uom_qty": 1.0,
+ },
+ )
+ ],
+ }
+ )
# TEST 01: Test _action_confirm method
def test_action_confirm(self):
@@ -50,3 +94,14 @@ class TestSaleOrder(TransactionCase):
agreement.sale_id.id,
sale_order.id,
)
+
+ # Test 02: is_serviceprofile Product
+ is_serviceprofile_so = self.test_sale_order_is_serviceprofile
+ is_serviceprofile_so._action_confirm()
+ agreement = self.env["agreement"].search(
+ [("sale_id", "=", is_serviceprofile_so.id)]
+ )
+ self.assertEqual(
+ agreement.sale_id.id,
+ is_serviceprofile_so.id,
+ )
From 058ed4b4a3cad728ecab4164b456f307a78851bd Mon Sep 17 00:00:00 2001
From: HemanginiPatel
Date: Tue, 17 Aug 2021 12:26:45 +0530
Subject: [PATCH 14/14] [IMP]Improved the codecov.
---
agreement_legal_sale/models/sale_order.py | 3 +--
agreement_legal_sale/tests/test_sale_order.py | 25 +++++++++++++++++++
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/agreement_legal_sale/models/sale_order.py b/agreement_legal_sale/models/sale_order.py
index 8a3e308bd..dd07f6e83 100644
--- a/agreement_legal_sale/models/sale_order.py
+++ b/agreement_legal_sale/models/sale_order.py
@@ -69,7 +69,6 @@ class SaleOrder(models.Model):
# we create the Agreement.
# To work around that, we check if that is the case,
# and make sure the SO Analytic Account is copied to the Agreement.
- res = super(SaleOrder, self).action_confirm()
for order in self:
agreement = order.agreement_id
if (
@@ -78,4 +77,4 @@ class SaleOrder(models.Model):
and not agreement.analytic_account_id
):
agreement.analytic_account_id = order.analytic_account_id
- return res
+ return super(SaleOrder, self).action_confirm()
diff --git a/agreement_legal_sale/tests/test_sale_order.py b/agreement_legal_sale/tests/test_sale_order.py
index 87696a9e1..46da72808 100644
--- a/agreement_legal_sale/tests/test_sale_order.py
+++ b/agreement_legal_sale/tests/test_sale_order.py
@@ -84,6 +84,26 @@ class TestSaleOrder(TransactionCase):
],
}
)
+ self.test_agreement = self.env["agreement"].create(
+ {
+ "name": "TestAgreement A",
+ "description": "Test Agreement A",
+ "special_terms": "TestAgreement A",
+ "start_date": fields.Date.today(),
+ "end_date": fields.Date.today() + timedelta(days=365),
+ }
+ )
+ self.test_sale_order_account_analytic_account = self.env["sale.order"].create(
+ {
+ "partner_id": self.test_customer.id,
+ "agreement_template_id": self.test_agreement_template_no_analytic_account_id.id,
+ "date_order": fields.Date.today(),
+ "agreement_id": self.test_agreement.id,
+ "order_line": [
+ (0, 0, {"product_id": self.test_product.id, "product_uom_qty": 1.0})
+ ],
+ }
+ )
# TEST 01: Test _action_confirm method
def test_action_confirm(self):
@@ -105,3 +125,8 @@ class TestSaleOrder(TransactionCase):
agreement.sale_id.id,
is_serviceprofile_so.id,
)
+ # Test 03: Test action_confirm method
+ self.test_sale_order_account_analytic_account.write(
+ {"analytic_account_id": self.test_account_analytic_account.id}
+ )
+ self.test_sale_order_account_analytic_account.action_confirm()