Commit d7bfd46d authored by Jérome Perrin's avatar Jérome Perrin

trade/accounting: fix "Trade Condition" column on accounting module

Rename this column from "Sale Trade Condition" to "Trade Condition", so
that it can be used also for purchase and internal trade conditions.
parent 66670bd2
...@@ -208,7 +208,7 @@ ...@@ -208,7 +208,7 @@
</tuple> </tuple>
<tuple> <tuple>
<string>specialise_trade_condition_title</string> <string>specialise_trade_condition_title</string>
<string>Sale Trade Condition</string> <string>Trade Condition</string>
</tuple> </tuple>
<tuple> <tuple>
<string>source_title</string> <string>source_title</string>
...@@ -460,7 +460,7 @@ ...@@ -460,7 +460,7 @@
</tuple> </tuple>
<tuple> <tuple>
<string>specialise_trade_condition_title</string> <string>specialise_trade_condition_title</string>
<string>Sale Trade Condition</string> <string>Trade Condition</string>
</tuple> </tuple>
<tuple> <tuple>
<string>source_title</string> <string>source_title</string>
......
...@@ -43,10 +43,12 @@ from erp5.component.test.testPackingList import TestPackingListMixin ...@@ -43,10 +43,12 @@ from erp5.component.test.testPackingList import TestPackingListMixin
from Products.ERP5.tests.utils import newSimulationExpectedFailure from Products.ERP5.tests.utils import newSimulationExpectedFailure
from erp5.component.module.TestInvoiceMixin import TestInvoiceMixin, TestSaleInvoiceMixin from erp5.component.module.TestInvoiceMixin import TestInvoiceMixin, TestSaleInvoiceMixin
class TestInvoice(TestInvoiceMixin): class TestInvoice(TestInvoiceMixin):
"""Test methods for sale and purchase invoice. """Test methods for sale and purchase invoice.
Subclasses must defines portal types to use. Subclasses must defines portal types to use.
""" """
trade_condition_portal_type = 'Sale Trade Condition'
quiet = 1 quiet = 1
def test_invoice_transaction_line_resource(self): def test_invoice_transaction_line_resource(self):
""" """
...@@ -1462,8 +1464,8 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( ...@@ -1462,8 +1464,8 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent(
self._testSubContentReindexing(invoice, [invoice_line, transaction_line, self._testSubContentReindexing(invoice, [invoice_line, transaction_line,
invoice_cell]) invoice_cell])
def test_AccountingTransactionModuleListboxSaleTradeConditionColumn(self): def test_AccountingTransactionModuleListboxTradeConditionColumn(self):
"""Check listbox Sale Trade Condition column displays the trade condition """Check listbox Trade Condition column displays the trade condition
when there are multiple documents related by specialise category. when there are multiple documents related by specialise category.
""" """
# test init # test init
...@@ -1471,10 +1473,10 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( ...@@ -1471,10 +1473,10 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent(
whatever_object = accounting_module.newContent( whatever_object = accounting_module.newContent(
portal_type=self.invoice_portal_type, portal_type=self.invoice_portal_type,
) )
sale_trade_condition_title = "Sale Trade Condition from test_AccountingTransactionModuleListboxSaleTradeConditionColumn" trade_condition_title = "Trade Condition from %s" % self.id()
sale_trade_condition = self.portal.sale_trade_condition_module.newContent( trade_condition = self.portal.getDefaultModule(self.trade_condition_portal_type).newContent(
portal_type="Sale Trade Condition", portal_type=self.trade_condition_portal_type,
title=sale_trade_condition_title, title=trade_condition_title,
) )
sale_invoice = accounting_module.newContent( sale_invoice = accounting_module.newContent(
portal_type=self.invoice_portal_type, portal_type=self.invoice_portal_type,
...@@ -1484,15 +1486,15 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( ...@@ -1484,15 +1486,15 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent(
# Check listbox Sale Trade Condition column displays the trade condition # Check listbox Sale Trade Condition column displays the trade condition
# when there are multiple documents related by specialise category. # when there are multiple documents related by specialise category.
accounting_listbox = accounting_module.AccountingTransactionModule_viewAccountingTransactionList.listbox accounting_listbox = accounting_module.AccountingTransactionModule_viewAccountingTransactionList.listbox
self.assertIn(("specialise_trade_condition_title", "Sale Trade Condition"), accounting_listbox.get_value("columns") + accounting_listbox.get_value("all_columns")) self.assertIn(("specialise_trade_condition_title", "Trade Condition"), accounting_listbox.get_value("columns") + accounting_listbox.get_value("all_columns"))
sale_invoice.setSpecialiseValueList([whatever_object]) sale_invoice.setSpecialiseValueList([whatever_object])
self.tic() self.tic()
sale_invoice_brain, = self.portal.portal_catalog(uid=sale_invoice.getUid(), select_list=["specialise_trade_condition_title"], limit=1) sale_invoice_brain, = self.portal.portal_catalog(uid=sale_invoice.getUid(), select_list=["specialise_trade_condition_title"], limit=1)
self.assertEqual(sale_invoice_brain.specialise_trade_condition_title, None) self.assertEqual(sale_invoice_brain.specialise_trade_condition_title, None)
sale_invoice.setSpecialiseValueList([whatever_object, sale_trade_condition]) sale_invoice.setSpecialiseValueList([whatever_object, trade_condition])
self.tic() self.tic()
sale_invoice_brain, = self.portal.portal_catalog(uid=sale_invoice.getUid(), select_list=["specialise_trade_condition_title"], limit=1) sale_invoice_brain, = self.portal.portal_catalog(uid=sale_invoice.getUid(), select_list=["specialise_trade_condition_title"], limit=1)
self.assertEqual(sale_invoice_brain.specialise_trade_condition_title, sale_trade_condition_title) self.assertEqual(sale_invoice_brain.specialise_trade_condition_title, trade_condition_title)
class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase): class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
"""Tests for sale invoice. """Tests for sale invoice.
...@@ -2580,6 +2582,7 @@ class TestPurchaseInvoice(TestInvoice, ERP5TypeTestCase): ...@@ -2580,6 +2582,7 @@ class TestPurchaseInvoice(TestInvoice, ERP5TypeTestCase):
invoice_transaction_line_portal_type = 'Purchase Invoice Transaction Line' invoice_transaction_line_portal_type = 'Purchase Invoice Transaction Line'
invoice_line_portal_type = 'Invoice Line' invoice_line_portal_type = 'Invoice Line'
invoice_cell_portal_type = 'Invoice Cell' invoice_cell_portal_type = 'Invoice Cell'
trade_condition_portal_type = 'Purchase Trade Condition'
# default sequence for one line of not varianted resource. # default sequence for one line of not varianted resource.
PACKING_LIST_DEFAULT_SEQUENCE = """ PACKING_LIST_DEFAULT_SEQUENCE = """
......
<dtml-var table_1>.uid = <dtml-var table_0>.category_uid <dtml-var table_1>.uid = <dtml-var table_0>.category_uid
AND <dtml-var table_0>.base_category_uid = <dtml-var "portal_categories.specialise.getUid()"> AND <dtml-var table_0>.base_category_uid = <dtml-var "portal_categories.specialise.getUid()">
AND <dtml-var table_1>.portal_type = 'Sale Trade Condition' AND <dtml-var table_1>.portal_type in ('Sale Trade Condition', 'Purchase Trade Condition', 'Internal Trade Condition')
<dtml-var RELATED_QUERY_SEPARATOR> <dtml-var RELATED_QUERY_SEPARATOR>
<dtml-var table_0>.uid = <dtml-var query_table>.uid <dtml-var table_0>.uid = <dtml-var query_table>.uid
\ No newline at end of file
...@@ -2,21 +2,19 @@ ...@@ -2,21 +2,19 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<global name="SQL" module="Products.ZSQLMethods.SQL"/> <global name="SQL Method" module="erp5.portal_type"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>allow_simple_one_argument_traversal</string> </key> <key> <string>allow_simple_one_argument_traversal</string> </key>
<value> <value> <int>0</int> </value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>arguments_src</string> </key> <key> <string>arguments_src</string> </key>
<value> <string>table_0\r\n <value> <string>table_0\n
table_1\r\n table_1\n
RELATED_QUERY_SEPARATOR=" AND "\r\n RELATED_QUERY_SEPARATOR=" AND "\n
query_table="catalog"</string> </value> query_table="catalog"</string> </value>
</item> </item>
<item> <item>
...@@ -25,11 +23,15 @@ query_table="catalog"</string> </value> ...@@ -25,11 +23,15 @@ query_table="catalog"</string> </value>
</item> </item>
<item> <item>
<key> <string>class_file_</string> </key> <key> <string>class_file_</string> </key>
<value> <string></string> </value> <value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>class_name_</string> </key> <key> <string>class_name_</string> </key>
<value> <string></string> </value> <value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>connection_hook</string> </key> <key> <string>connection_hook</string> </key>
...@@ -53,9 +55,13 @@ query_table="catalog"</string> </value> ...@@ -53,9 +55,13 @@ query_table="catalog"</string> </value>
<key> <string>max_rows_</string> </key> <key> <string>max_rows_</string> </key>
<value> <int>1000</int> </value> <value> <int>1000</int> </value>
</item> </item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>SQL Method</string> </value>
</item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string></string> </value> <value> <string>z_related_specialise_trade_condition</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment