diff --git a/__init__.py b/__init__.py
index 7e0719c06b..563fd3eae0 100644
--- a/__init__.py
+++ b/__init__.py
@@ -25,4 +25,3 @@
##############################################################################
from purchase import *
-from party import *
diff --git a/__tryton__.py b/__tryton__.py
index 1d1e59bea8..1f9f290a64 100644
--- a/__tryton__.py
+++ b/__tryton__.py
@@ -20,6 +20,5 @@
],
'xml': [
'purchase.xml',
- 'party.xml',
],
}
diff --git a/party.py b/party.py
deleted file mode 100644
index 164e8cd990..0000000000
--- a/party.py
+++ /dev/null
@@ -1,40 +0,0 @@
-from trytond.wizard import Wizard
-
-class OpenSupplier(Wizard):
- 'Open Suppliers'
- _name = 'relationship.party.open_supplier'
- states = {
- 'init': {
- 'result': {
- 'type': 'action',
- 'action': '_action_open',
- 'state': 'end',
- },
- },
- }
-
- def _action_open(self, cursor, user, datas, context=None):
- model_data_obj = self.pool.get('ir.model.data')
- act_window_obj = self.pool.get('ir.action.act_window')
-
- model_data_ids = model_data_obj.search(cursor, user, [
- ('fs_id', '=', 'act_party_form'),
- ('module', '=', 'relationship'),
- ], limit=1, context=context)
- model_data = model_data_obj.browse(cursor, user, model_data_ids[0],
- context=context)
- res = act_window_obj.read(cursor, user, model_data.db_id,
- context=context)
- cursor.execute(
- "SELECT party, max(purchase_date) FROM purchase_purchase "\
- "GROUP BY party "\
- "ORDER BY max(purchase_date) DESC"
- )
- suppliers = [line[0] for line in cursor.fetchall()]
-
- domain = eval( res.get('domain') or "[]" )
- domain.append(('id', 'in', suppliers))
- res['domain'] = str(domain)
- return res
-
-OpenSupplier()
diff --git a/party.xml b/party.xml
deleted file mode 100644
index f766763b00..0000000000
--- a/party.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
- Active Suppliers
- relationship.party.open_supplier
-
-
-
- form_action
- relationship.party,0
-
-
-
-
diff --git a/purchase.py b/purchase.py
index 2acdd3f182..6621221f8a 100644
--- a/purchase.py
+++ b/purchase.py
@@ -5,6 +5,7 @@ from decimal import Decimal
import datetime
from trytond.netsvc import LocalService
from trytond.report import CompanyReport
+from trytond.wizard import Wizard
_STATES = {
'readonly': "state != 'draft'",
@@ -917,3 +918,48 @@ class Move(OSV):
return res
Move()
+
+
+class OpenSupplier(Wizard):
+ 'Open Suppliers'
+ _name = 'purchase.open_supplier'
+ states = {
+ 'init': {
+ 'result': {
+ 'type': 'action',
+ 'action': '_action_open',
+ 'state': 'end',
+ },
+ },
+ }
+
+ def _action_open(self, cursor, user, datas, context=None):
+ model_data_obj = self.pool.get('ir.model.data')
+ act_window_obj = self.pool.get('ir.action.act_window')
+ wizard_obj = self.pool.get('ir.action.wizard')
+
+ model_data_ids = model_data_obj.search(cursor, user, [
+ ('fs_id', '=', 'act_party_form'),
+ ('module', '=', 'relationship'),
+ ], limit=1, context=context)
+ model_data = model_data_obj.browse(cursor, user, model_data_ids[0],
+ context=context)
+ res = act_window_obj.read(cursor, user, model_data.db_id,
+ context=context)
+ cursor.execute("SELECT DISTINCT(party) FROM purchase_purchase")
+ supplier_ids = [line[0] for line in cursor.fetchall()]
+ res['domain'] = str([('id', 'in', supplier_ids)])
+
+ model_data_ids = model_data_obj.search(cursor, user, [
+ ('fs_id', '=', 'act_open_supplier'),
+ ('module', '=', 'purchase'),
+ ], limit=1, context=context)
+ model_data = model_data_obj.browse(cursor, user, model_data_ids[0],
+ context=context)
+ wizard = wizard_obj.browse(cursor, user, model_data.db_id,
+ context=context)
+
+ res['name'] = wizard.name
+ return res
+
+OpenSupplier()
diff --git a/purchase.xml b/purchase.xml
index ad277a6e1f..bd6a994a79 100644
--- a/purchase.xml
+++ b/purchase.xml
@@ -728,5 +728,16 @@
]]>
+
+
+ Suppliers
+ purchase.open_supplier
+
+