Commit f5a70122 authored by Tristan Cavelier's avatar Tristan Cavelier

erp5_{accounting,trade}: fix inconsistent "Sale Trade Condition" column

in accounting_module and sale_order_module listbox.

The "Sale Trade Condition" column was showing first found specialise title
instead of the Sale Trade Condition one.

This adds z_related_specialise_trade_condition with related key specialise_trade_condition_title
and an accessor getSpecialiseTradeConditionTitle
parent 782b27f0
......@@ -207,7 +207,7 @@
<string>Source Trade</string>
</tuple>
<tuple>
<string>specialise_title</string>
<string>specialise_trade_condition_title</string>
<string>Sale Trade Condition</string>
</tuple>
<tuple>
......@@ -459,7 +459,7 @@
<string>Source Trade</string>
</tuple>
<tuple>
<string>specialise_title</string>
<string>specialise_trade_condition_title</string>
<string>Sale Trade Condition</string>
</tuple>
<tuple>
......
<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_1>.portal_type = 'Sale Trade Condition'
<dtml-var RELATED_QUERY_SEPARATOR>
<dtml-var table_0>.uid = <dtml-var query_table>.uid
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="SQL" module="Products.ZSQLMethods.SQL"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>allow_simple_one_argument_traversal</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string>table_0\r\n
table_1\r\n
RELATED_QUERY_SEPARATOR=" AND "\r\n
query_table="catalog"</string> </value>
</item>
<item>
<key> <string>cache_time_</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>class_file_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>class_name_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>connection_hook</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z_related_specialise_trade_condition</string> </value>
</item>
<item>
<key> <string>max_cache_</string> </key>
<value> <int>100</int> </value>
</item>
<item>
<key> <string>max_rows_</string> </key>
<value> <int>1000</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<key_list>
<key>child_resource_uid | catalog,category/category_uid/z_related_child_resource</key>
<key>specialise_trade_condition_title | category,catalog/title/z_related_specialise_trade_condition</key>
</key_list>
\ No newline at end of file
......@@ -109,7 +109,7 @@
<string>Modification Date</string>
</tuple>
<tuple>
<string>specialise_title</string>
<string>specialise_trade_condition_title</string>
<string>Sale Trade Condition</string>
</tuple>
</list>
......@@ -280,7 +280,7 @@
<string>Modification Date</string>
</tuple>
<tuple>
<string>specialise_title</string>
<string>specialise_trade_condition_title</string>
<string>Sale Trade Condition</string>
</tuple>
</list>
......@@ -351,7 +351,7 @@
<string>Modification Date</string>
</tuple>
<tuple>
<string>specialise_title</string>
<string>specialise_trade_condition_title</string>
<string>Sale Trade Condition</string>
</tuple>
</list>
......
erp5_mysql_innodb/z_related_child_resource
erp5_mysql_innodb/z_related_specialise_trade_condition
\ No newline at end of file
child_resource_uid | catalog,category/category_uid/z_related_child_resource
specialise_trade_condition_title | category,catalog/title/z_related_specialise_trade_condition
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Acquired Property" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>acquisition_accessor_id</string> </key>
<value> <string>getTitle</string> </value>
</item>
<item>
<key> <string>acquisition_base_category</string> </key>
<value>
<tuple>
<string>specialise</string>
</tuple>
</value>
</item>
<item>
<key> <string>acquisition_object_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>acquisition_portal_type</string> </key>
<value> <string>python: \'Sale Trade Condition\'</string> </value>
</item>
<item>
<key> <string>alt_accessor_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>elementary_type/string</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_acquired_property_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>content_translation_acquired_property_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>The title of the specialise trade condition</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>specialise_trade_condition_title_property</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Acquired Property</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -2488,6 +2488,38 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent(
self._testSubContentReindexing(invoice, [invoice_line, transaction_line,
invoice_cell])
def test_AccountingTransactionModuleListboxSaleTradeConditionColumn(self):
"""Check listbox Sale Trade Condition column displays the trade condition
when there are multiple documents related by specialise category.
"""
# test init
accounting_module = self.portal.accounting_module
whatever_object = accounting_module.newContent(
portal_type=self.invoice_portal_type,
)
sale_trade_condition_title = "Sale Trade Condition from test_AccountingTransactionModuleListboxSaleTradeConditionColumn"
sale_trade_condition = self.portal.sale_trade_condition_module.newContent(
portal_type="Sale Trade Condition",
title=sale_trade_condition_title,
)
sale_invoice = accounting_module.newContent(
portal_type=self.invoice_portal_type,
)
# actual test
# Check listbox Sale Trade Condition column displays the trade condition
# when there are multiple documents related by specialise category.
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"))
sale_invoice.setSpecialiseValueList([whatever_object])
self.tic()
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)
sale_invoice.setSpecialiseValueList([whatever_object, sale_trade_condition])
self.tic()
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)
class TestSaleInvoiceMixin(TestInvoiceMixin,
ERP5TypeTestCase):
"""Test sale invoice are created from orders then packing lists.
......
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