From e197ecf527dfd5d5ebb4c332cd9806a2c1212534 Mon Sep 17 00:00:00 2001
From: sinergia <alejandro.ayala@onecluster.org>
Date: Sun, 19 Jun 2022 22:36:16 -0500
Subject: [PATCH] Create 'Equipment' in 'sale.subscription

---
 __init__.py         |  4 +++-
 equipment.py        | 10 ++++++++++
 measurements.py     |  3 ---
 party.py            |  1 +
 tryton.cfg          |  4 +++-
 view/party_form.xml |  4 ++++
 6 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/__init__.py b/__init__.py
index c62a1e5..04b234b 100644
--- a/__init__.py
+++ b/__init__.py
@@ -1,5 +1,5 @@
 from trytond.pool import Pool
-from . import party, product, purchase, sale, equipment
+from . import party, product, purchase, sale, equipment, subscription
 
 def register():
     Pool.register(
@@ -10,4 +10,6 @@ def register():
         purchase.Line,
         sale.SaleLine,
         equipment.OpticalEquipment,
+        subscription.Subscription,
+        subscription.SubscriptionEquipment,
         module='optical_equipment', type_='model')
diff --git a/equipment.py b/equipment.py
index 36b5166..9222ddf 100644
--- a/equipment.py
+++ b/equipment.py
@@ -8,6 +8,7 @@ class OpticalEquipment(ModelSQL, ModelView):
     company = fields.Many2One('company.company', "Company")
     location = fields.Many2One('stock.location', "Location")
     party = fields.Many2One('party.party', "Party")
+    #equipment_party = fields.Many2Many('optical.equipment-party.party', 'party', 'equipment', "Equipments")
     party_address = fields.Many2One('party.address', "Party Address") 
     #origin = fields.reference("Origin", selection='get_origin', select=True)
     product = fields.Many2One('product.product', "Product")
@@ -31,3 +32,12 @@ class OpticalEquipment(ModelSQL, ModelView):
     @staticmethod
     def get_origin():
         return None
+"""
+class OpticalEquipmentParty(ModelSQL):
+    'Optical Equipment - Party'
+    __name__ = 'optical.equipment-party.party'
+    _table = 'optical_equipment_party_party'
+    
+    party = fields.Many2One('party.party', 'Party', select=True)
+    equipment = fields.Many2One('optical.equipment', 'Equipment', select=True)
+"""
diff --git a/measurements.py b/measurements.py
index 7cef386..ae255e7 100644
--- a/measurements.py
+++ b/measurements.py
@@ -2,6 +2,3 @@ from trytond.pool import PoolMeta
 
 class Measurements(metaclass=PoolMeta):
     __name__ = 'product.measurements'
-
-    
-    
diff --git a/party.py b/party.py
index eb4b392..e0afa1f 100644
--- a/party.py
+++ b/party.py
@@ -1,5 +1,6 @@
 from trytond.pool import PoolMeta
 from trytond.model import ModelSQL, ModelView, fields
+from . import equipment
 
 _CLIENT_TYPE = [('ips', 'IPS'),
                 ('optica', 'Optica')]
diff --git a/tryton.cfg b/tryton.cfg
index 72c9d4d..fc4e932 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -9,10 +9,12 @@ depends:
     sale
     stock
     country
+    sale_subscription
 xml:
     party.xml
     product.xml
     equipment.xml
     sale.xml
     purchase.xml
-    uom.xml
\ No newline at end of file
+    uom.xml
+    subscription.xml
\ No newline at end of file
diff --git a/view/party_form.xml b/view/party_form.xml
index 32f8e2e..c5d6763 100644
--- a/view/party_form.xml
+++ b/view/party_form.xml
@@ -6,4 +6,8 @@ this repository contains the full copyright notices and license terms. -->
 	<label name="client_type"/>
 	<field name="client_type"/>
     </xpath>
+    <xpath expr="/form/notebook/page[@id='general']" position="after">
+	<page string="Equipments Party" id="equipments_party">
+	</page>
+    </xpath>
 </data>