Commit cb9334d4 authored by Rafael Monnerat's avatar Rafael Monnerat

Change default Invoice List view

See merge request nexedi/slapos.core!445
parents 0173ec07 a402c1f3
portal = context.getPortalObject()
portal_membership=portal.portal_membership
user = portal_membership.getAuthenticatedMember().getUserValue()
def wrapWithShadow():
return [i.getCausalityValue(portal_type="Sale Invoice Transaction") for i in context.getPortalObject().portal_catalog(
portal_type="Payment Transaction",
simulation_state="started",
destination_section_uid=user.getUid(),
default_causality_portal_type="Sale Invoice Transaction",
default_causality_simulation_state=("stopped", "delivered"),
)]
return user.Person_restrictMethodAsShadowUser(
shadow_document=user,
callable_object=wrapWithShadow,
argument_list=[])
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>AccountingTransactionModule_getUnpaidInvoiceList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -79,6 +79,8 @@ url_list = [
"gadget_slapos_annotated_helper.js",
"gadget_slapos_annotated_helper.html",
"gadget_slapos_annotated_helper.css",
"gadget_erp5_page_slap_all_invoice_list.html",
"gadget_erp5_page_slap_all_invoice_list.js",
"gadget_erp5_page_slap_invoice_list.html",
"gadget_erp5_page_slap_invoice_list.js",
"gadget_erp5_page_slap_load_schema.html",
......
<!DOCTYPE html>
<html>
<!--
data-i18n=Date
data-i18n=Price
data-i18n=Currency
data-i18n=Payment
data-i18n=Download
data-i18n=Invoices
-->
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>Site List</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_slapos_utils.js" type="text/javascript"></script>
<script src="gadget_erp5_page_slap_all_invoice_list.js" type="text/javascript"></script>
</head>
<body>
<div data-gadget-url="gadget_erp5_pt_form_list.html" data-gadget-scope="form_list"></div>
</body>
</html>
/*global window, rJS, RSVP */
/*jslint nomen: true, indent: 2, maxerr: 3*/
(function (window, rJS, RSVP) {
"use strict";
rJS(window)
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("updatePanel", "updatePanel")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("reload", "reload")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("getTranslationList", "getTranslationList")
.allowPublicAcquisition("jio_allDocs", function (param_list) {
var gadget = this;
return gadget.jio_allDocs(param_list[0])
.push(function (result) {
var i, value, len = result.data.total_rows;
for (i = 0; i < len; i += 1) {
if (result.data.rows[i].value.hasOwnProperty("start_date")) {
value = new Date(result.data.rows[i].value.start_date);
result.data.rows[i].value.start_date = {
"field_gadget_param": {
allow_empty_time: 0,
ampm_time_style: 0,
css_class: "date_field",
date_only: true,
description: "The Date",
editable: 0,
hidden: 0,
hidden_day_is_last_day: 0,
"default": value.toUTCString(),
key: "date",
required: 0,
timezone_style: 0,
title: "Date",
type: "DateTimeField"
}
};
}
if (result.data.rows[i].value.hasOwnProperty("total_price")) {
value = window.parseFloat(result.data.rows[i].value.total_price);
// The field seemms not set precision to display
value = value.toFixed(2); // round on this case for 2 digits as
// float field is bugged.
result.data.rows[i].value.total_price = value;
}
if (1 || (result.data.rows[i].hasOwnProperty("id"))) {
value = result.data.rows[i].value.AccountingTransaction_getPaymentStateAsHateoas;
result.data.rows[i].value.AccountingTransaction_getPaymentStateAsHateoas = {
field_gadget_param : {
css_class: "",
description: "Payment State",
hidden: 0,
"default": value,
key: "translated_simulation_state_title",
url: "gadget_slapos_invoice_state.html",
title: "Payment State",
type: "GadgetField"
}
};
result.data.rows[i].value.download = {
field_gadget_param : {
css_class: "",
description: "Download Invoice",
hidden: 0,
"default": {jio_key: result.data.rows[i].id},
key: "download",
url: "gadget_slapos_invoice_printout.html",
title: "Download",
type: "GadgetField"
}
};
result.data.rows[i].value["listbox_uid:list"] = {
key: "listbox_uid:list",
value: 2713
};
}
}
return result;
});
})
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("triggerSubmit", function () {
var argument_list = arguments;
return this.getDeclaredGadget('form_list')
.push(function (gadget) {
return gadget.triggerSubmit.apply(gadget, argument_list);
});
})
.declareMethod("render", function () {
var gadget = this,
lines_limit,
invoices_translation,
translation_list = [
"Date",
"Price",
"Currency",
"Payment",
"Download",
"Invoices",
"Reference"
];
return new RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.getDeclaredGadget('form_list'),
gadget.getSetting("listbox_lines_limit", 20),
gadget.getTranslationList(translation_list)
]);
})
.push(function (result) {
var column_list = [
['reference', result[2][6]],
['start_date', result[2][0]],
['total_price', result[2][1]],
['resource_reference', result[2][2]],
['AccountingTransaction_getPaymentStateAsHateoas', result[2][3]],
['download', result[2][4]]
],
form_list = result[0];
lines_limit = result[1];
invoices_translation = result[2][5];
return form_list.render({
erp5_document: {
"_embedded": {"_view": {
"listbox": {
"column_list": column_list,
"show_anchor": 0,
"default_params": {},
"editable": 0,
"editable_column_list": [],
"key": "slap_invoice_listbox",
"lines": lines_limit,
"list_method": "portal_catalog",
// XXX FIX ME: Missing default_destination_section_uid=person.getUid()
"query": "urn:jio:allDocs?query=(NOT%20title%3A%22Reversal%20Transaction%20for%20%25%22)%20AND%20(portal_type%3A%20%22Sale%20Invoice%20Transaction%22)",
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
"sort": [["creation_date", "descending"]],
"title": invoices_translation,
"type": "ListBox"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}
},
form_definition: {
group_list: [[
"bottom",
[["listbox"]]
]]
}
});
})
.push(function () {
return RSVP.all([
gadget.getSetting("hateoas_url"),
window.getSettingMe(gadget)
]);
})
.push(function (url_list) {
return RSVP.all([
gadget.jio_getAttachment("contract_relative_url",
url_list[0] + url_list[1] + "/Person_getCloudContractRelated?return_json=True"),
gadget.updatePanel({jio_key: "accounting_module"}),
gadget.getSetting('frontpage_gadget')
]);
})
.push(function (result) {
var promise_list = [
gadget.getUrlFor({command: "change", options: {"page": result[2]}}),
gadget.getUrlFor({command: "change", options: {"page": "slap_rss_ticket",
"jio_key": "accounting_module"}}),
gadget.getUrlFor({command: "change", options: {"page": 'slap_invoice_list'}})
];
if (result[0]) {
promise_list.push(
gadget.getUrlFor({command: "change", options: {"jio_key": result[0],
"page": "slap_controller"}})
);
}
return RSVP.all(promise_list);
})
.push(function (result) {
var header_dict = {
page_title: invoices_translation,
selection_url: result[0],
tab_url: result[2],
rss_url: result[1],
filter_action: true
};
if (result[3]) {
header_dict.contract_url = result[3];
}
return gadget.updateHeader(header_dict);
});
});
}(window, rJS, RSVP));
......@@ -52,13 +52,13 @@
result.data.rows[i].value.total_price = value;
}
if (1 || (result.data.rows[i].hasOwnProperty("id"))) {
value = result.data.rows[i].id;
result.data.rows[i].value.translated_simulation_state_title = {
value = result.data.rows[i].value.AccountingTransaction_getPaymentStateAsHateoas;
result.data.rows[i].value.AccountingTransaction_getPaymentStateAsHateoas = {
field_gadget_param : {
css_class: "",
description: "Payment State",
hidden: 0,
"default": {jio_key: value},
"default": value,
key: "translated_simulation_state_title",
url: "gadget_slapos_invoice_state.html",
title: "Payment State",
......@@ -70,7 +70,7 @@
css_class: "",
description: "Download Invoice",
hidden: 0,
"default": {jio_key: value},
"default": {jio_key: result.data.rows[i].id},
key: "download",
url: "gadget_slapos_invoice_printout.html",
title: "Download",
......@@ -116,7 +116,8 @@
return RSVP.all([
gadget.getDeclaredGadget('form_list'),
gadget.getSetting("listbox_lines_limit", 20),
gadget.getTranslationList(translation_list)
gadget.getTranslationList(translation_list),
gadget.getSetting('hateoas_url')
]);
})
.push(function (result) {
......@@ -125,7 +126,7 @@
['start_date', result[2][0]],
['total_price', result[2][1]],
['resource_reference', result[2][2]],
['translated_simulation_state_title', result[2][3]],
['AccountingTransaction_getPaymentStateAsHateoas', result[2][3]],
['download', result[2][4]]
],
form_list = result[0];
......@@ -142,9 +143,11 @@
"editable_column_list": [],
"key": "slap_invoice_listbox",
"lines": lines_limit,
"list_method": "portal_catalog",
// XXX FIX ME: Missing default_destination_section_uid=person.getUid()
"query": "urn:jio:allDocs?query=(NOT%20title%3A%22Reversal%20Transaction%20for%20%25%22)%20AND%20(portal_type%3A%20%22Sale%20Invoice%20Transaction%22)",
"list_method": "AccountingTransactionModule_getUnpaidInvoiceList",
"list_method_template": result[3] + "ERP5Document_getHateoas?mode=search&" +
"list_method=AccountingTransactionModule_getUnpaidInvoiceList" +
"&relative_url=accounting_module{&query,select_list*,limit*,sort_on*,local_roles*}",
"query": "urn:jio:allDocs?query=",
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
......@@ -186,7 +189,8 @@
var promise_list = [
gadget.getUrlFor({command: "change", options: {"page": result[2]}}),
gadget.getUrlFor({command: "change", options: {"page": "slap_rss_ticket",
"jio_key": "accounting_module"}})
"jio_key": "accounting_module"}}),
gadget.getUrlFor({command: "change", options: {"page": 'slap_all_invoice_list'}})
];
if (result[0]) {
promise_list.push(
......@@ -200,13 +204,14 @@
var header_dict = {
page_title: invoices_translation,
selection_url: result[0],
list_all_url: result[2],
rss_url: result[1],
filter_action: true
};
if (result[2]) {
header_dict.contract_url = result[2];
if (result[3]) {
header_dict.contract_url = result[3];
}
return gadget.updateHeader(header_dict);
});
});
}(window, rJS, RSVP));
\ No newline at end of file
}(window, rJS, RSVP));
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1001.59414.5078.17476</string> </value>
<value> <string>1004.6631.33059.11776</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1659068942.39</float>
<float>1667930581.61</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -158,7 +158,10 @@
"my_payment_state": {
"description": "",
"title": result[1][5],
"default": {jio_key: gadget.state.jio_key},
"default": {
state: gadget.state.doc.payment_state,
payment_transaction: gadget.state.doc.payment_transaction
},
"css_class": "",
"required": 1,
"editable": 0,
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>992.11149.35424.21572</string> </value>
<value> <string>999.2068.62564.17</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1621448974.82</float>
<float>1667919626.06</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -56,7 +56,8 @@
['transfer_url', 'Transfer', 'exchange'],
['accept_url', 'Accept', 'check-circle'],
['reject_url', 'Reject', 'ban'],
['contract_url', 'Contract', 'usd']
['contract_url', 'Contract', 'usd'],
['list_all_url', 'Show all', 'eye']
],
header_button_template = function (data) {
// <form><button name='{{name}}' data-i18n="{{title}}" type='submit' class='ui-icon-{{icon}} ui-btn-icon-left {{class}}'>{{title}}</button></form>
......@@ -428,4 +429,4 @@
throw new Error("Unsupported button " + name);
});
}(window, rJS, document, RSVP));
\ No newline at end of file
}(window, rJS, document, RSVP));
/*globals console, window, rJS, RSVP, domsugar */
/*globals console, window, rJS, domsugar */
/*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, rJS, domsugar) {
"use strict";
rJS(window)
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("getTranslationDict", "getTranslationDict")
.declareMethod("getContent", function () {
......@@ -16,42 +14,37 @@
link;
return gadget.getTranslationDict(['Pay Now'])
.push(function (translation_dict) {
if (gadget.state.payment_transaction !== null) {
if ((gadget.state.payment_transaction !== null) &&
(gadget.state.payment_transaction !== undefined)) {
link = domsugar("li", {},
[
domsugar("a", {
class: "ui-btn ui-first-child ui-btn-icon-center",
// XXX Translation
text: translation_dict["Pay Now"],
href: gadget.state.hateoas_url + gadget.state.payment_transaction +
href: gadget.state.hateoas_url +
gadget.state.payment_transaction +
"/PaymentTransaction_redirectToManualSlapOSPayment"
})
]);
} else {
link = domsugar("li", {"text": gadget.state.payment_transaction});
link = domsugar("li", {"text": gadget.state.payment_state});
}
domsugar(gadget.element, {}, [
domsugar("ul", {"class": "grid-items"}, [link])
]);
return translation_dict;
})
});
})
.declareMethod("render", function (options) {
var gadget = this;
return gadget.getSetting("hateoas_url")
.push(function (hateoas_url) {
// XXX RAFAEL this should comes from the options and not from a query like this.
return gadget.jio_getAttachment(options.value.jio_key,
hateoas_url + options.value.jio_key +
"/AccountingTransaction_getPaymentStateAsHateoas")
.push(function (state) {
return gadget.changeState({
payment_transaction: state.payment_transaction,
payment_state: state.state,
hateoas_url: hateoas_url
});
});
return gadget.changeState({
payment_transaction: options.value.payment_transaction,
payment_state: options.value.state,
hateoas_url: hateoas_url
});
});
});
}(window, rJS, domsugar));
\ No newline at end of file
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1000.58215.43208.28603</string> </value>
<value> <string>1004.12353.6622.1501</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1655125229.22</float>
<float>1667929052.34</float>
<string>UTC</string>
</tuple>
</state>
......
import json
state = context.AccountingTransaction_getPaymentState()
payment_transaction = None
payment_mode = None
......@@ -8,6 +6,6 @@ if state == "Pay now":
payment_transaction = payment_transaction_value.getRelativeUrl()
payment_mode = payment_transaction_value.getPaymentMode()
return json.dumps({"state": context.Base_translateString(state),
"payment_mode": payment_mode,
"payment_transaction": payment_transaction})
return {"state": context.Base_translateString(state),
"payment_mode": payment_mode,
"payment_transaction": payment_transaction}
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_payment_state</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Payment State</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: context.Base_translateString(context.AccountingTransaction_getPaymentState())</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_payment_transaction</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Payment Transaction</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: context.SaleInvoiceTransaction_getSlapOSPaymentRelated()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -85,7 +85,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Reference</string> </value>
<value> <string>Resource</string> </value>
</item>
</dictionary>
</value>
......
......@@ -100,7 +100,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Reference</string> </value>
<value> <string>Start Date</string> </value>
</item>
</dictionary>
</value>
......
......@@ -9,7 +9,9 @@
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
<list>
<string>title</string>
</list>
</value>
</item>
<item>
......@@ -71,16 +73,20 @@
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_title</string> </value>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewWebFieldLibrary</string> </value>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Total Price</string> </value>
</item>
</dictionary>
</value>
</item>
......
......@@ -37,6 +37,8 @@ web_page_module/rjs_gadget_erp5_page_slap_add_software_installation_html
web_page_module/rjs_gadget_erp5_page_slap_add_software_installation_js
web_page_module/rjs_gadget_erp5_page_slap_add_ticket_html
web_page_module/rjs_gadget_erp5_page_slap_add_ticket_js
web_page_module/rjs_gadget_erp5_page_slap_all_invoice_list_html
web_page_module/rjs_gadget_erp5_page_slap_all_invoice_list_js
web_page_module/rjs_gadget_erp5_page_slap_close_ticket_html
web_page_module/rjs_gadget_erp5_page_slap_close_ticket_js
web_page_module/rjs_gadget_erp5_page_slap_compute_node_get_token_html
......
......@@ -34,6 +34,8 @@ web_page_module/rjs_gadget_erp5_page_slap_add_software_installation_html
web_page_module/rjs_gadget_erp5_page_slap_add_software_installation_js
web_page_module/rjs_gadget_erp5_page_slap_add_ticket_html
web_page_module/rjs_gadget_erp5_page_slap_add_ticket_js
web_page_module/rjs_gadget_erp5_page_slap_all_invoice_list_html
web_page_module/rjs_gadget_erp5_page_slap_all_invoice_list_js
web_page_module/rjs_gadget_erp5_page_slap_close_ticket_html
web_page_module/rjs_gadget_erp5_page_slap_close_ticket_js
web_page_module/rjs_gadget_erp5_page_slap_compute_node_get_token_html
......
......@@ -60,11 +60,52 @@
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" />
</tal:block>
<tal:block tal:define="pagination_configuration python: {'header': '(1)', 'footer': '${count} Records'};
dummy python: context.REQUEST.set('mapping', {'count': '1'})">
<tal:block tal:define="pagination_configuration python: {'header': '(0)', 'footer': 'No records'}">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/check_listbox_pagination_text" />
</tal:block>
<tr>
<td colspan="3"><b tal:content="python: 'Click on Show all'"> Menu Item </b></td>
</tr>
<tal:block define="menu_action python: 'Show all'">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_submenu_action" />
</tal:block>
<tal:block tal:define="pagination_configuration python: {'header': '(1)', 'footer': '${count} Records'};
dummy python: context.REQUEST.set('mapping', {'count': '1'})">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/check_listbox_pagination_text" />
</tal:block>
<tr>
<td>waitForElementPresent</td>
<td tal:content="python: '//div[contains(@data-gadget-url, \'gadget_slapos_invoice_state.html\')]//li[text()=\'%s\']' % (here.Base_translateString('Paid', lang=lang))"></td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td tal:content="python: '//div[contains(@data-gadget-url, \'gadget_slapos_invoice_state.html\')]//li[text()=\'%s\']' % (here.Base_translateString('Paid', lang=lang))"></td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td> //div[contains(@data-gadget-url, 'gadget_slapos_invoice_printout.html')]//a[contains(@href, 'SaleInvoiceTransaction_viewSlapOSPrintout')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td> //div[contains(@data-gadget-url, 'gadget_slapos_invoice_printout.html')]//a[contains(@href, 'SaleInvoiceTransaction_viewSlapOSPrintout')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td> //div[contains(@data-gadget-url, 'gadget_slapos_invoice_printout.html')]//a[contains(@href, '/accounting_module/')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td> //div[contains(@data-gadget-url, 'gadget_slapos_invoice_printout.html')]//a[contains(@href, '/accounting_module/')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//p[@data-date='2019-10-20']</td>
......@@ -125,6 +166,36 @@
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td tal:content="python: '//div[contains(@data-gadget-url, \'gadget_slapos_invoice_state.html\')]//li[text()=\'%s\']' % (here.Base_translateString('Paid', lang=lang))"></td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td tal:content="python: '//div[contains(@data-gadget-url, \'gadget_slapos_invoice_state.html\')]//li[text()=\'%s\']' % (here.Base_translateString('Paid', lang=lang))"></td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td> //div[contains(@data-gadget-url, 'gadget_slapos_invoice_printout.html')]//a[contains(@href, 'SaleInvoiceTransaction_viewSlapOSPrintout')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td> //div[contains(@data-gadget-url, 'gadget_slapos_invoice_printout.html')]//a[contains(@href, 'SaleInvoiceTransaction_viewSlapOSPrintout')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td> //div[contains(@data-gadget-url, 'gadget_slapos_invoice_printout.html')]//a[contains(@href, '/accounting_module/')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td> //div[contains(@data-gadget-url, 'gadget_slapos_invoice_printout.html')]//a[contains(@href, '/accounting_module/')]</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_logout" />
</tbody>
</table>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testSlapOSJSInvoiceUnpaid</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -19,10 +19,10 @@ def wrapWithShadow():
payment.confirm()
payment.start()
payment.stop()
if not unpaid:
payment.stop()
payment.PaymentTransaction_generatePayzenId()
payment.PaymentTransaction_generatePayzenId()
template = portal.restrictedTraverse(portal.portal_preferences.getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate())
current_invoice = template.Base_createCloneDocument(batch_mode=1)
......@@ -42,9 +42,6 @@ def wrapWithShadow():
quantity=1
)
cell.setPrice(1)
return current_invoice, payment
current_invoice, payment = demo_user_functional.Person_restrictMethodAsShadowUser(
......@@ -53,10 +50,29 @@ current_invoice, payment = demo_user_functional.Person_restrictMethodAsShadowUse
argument_list=[])
payment.setCausalityValue(current_invoice)
payment.setDestinationSectionValue(demo_user_functional)
current_invoice.plan()
current_invoice.confirm()
current_invoice.startBuilding()
current_invoice.reindexObject()
current_invoice.stop()
current_invoice.activate(after_method_id="immediateReindexObject").Delivery_manageBuildingCalculatingDelivery()
current_invoice.activate(
after_method_id=(
"immediateReindexObject", "_updateSimulation", "Delivery_manageBuildingCalculatingDelivery")
).SaleInvoiceTransaction_forceBuildSlapOSAccountingLineList()
if not unpaid:
current_invoice.activate(
after_method_id=(
"immediateReindexObject",
"_updateSimulation",
"Delivery_manageBuildingCalculatingDelivery",
"SimulationMovement_buildSlapOS",
"SaleInvoiceTransaction_forceBuildSlapOSAccountingLineList")
).SaleInvoiceTransaction_setFakeGroupingReference()
return 'Done.'
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
<value> <string>unpaid=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......
kw = {}
select_dict= {'delivery_uid': None}
kw.update(
portal_type='Simulation Movement',
# This is an optimisation to help mariadb selecting a better index
simulation_state=['draft', 'planned', None],
left_join_list=select_dict.keys(),
delivery_uid=None
)
applied_rule = context.getCausalityRelated(portal_type="Applied Rule")
for simulation_movement in context.getPortalObject().portal_catalog(
path="%%%s%%" % applied_rule, **kw):
if simulation_movement.getDelivery() is not None:
# movement build but not indexed, so do nothing
continue
root_applied_rule = simulation_movement.getRootAppliedRule()
root_applied_rule_path = root_applied_rule.getPath()
business_link = simulation_movement.getCausalityValue(portal_type='Business Link')
business_link.build(path='%s/%%' % root_applied_rule_path, activate_kw={'tag': "ForceBuild"})
return "Done."
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleInvoiceTransaction_forceBuildSlapOSAccountingLineList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
portal = context.getPortalObject()
def isNodeFromLineReceivable(line):
node_value = line.getSourceValue(portal_type='Account')
return node_value.getAccountType() == 'asset/receivable'
for line in context.getMovementList(portal.getPortalAccountingMovementTypeList()):
if isNodeFromLineReceivable(line):
if not line.hasGroupingReference():
line.setGroupingReference('FAKEGROUPINGREFERENCE')
break
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleInvoiceTransaction_setFakeGroupingReference</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -1205,11 +1205,6 @@
<td colspan="3"><b> Create a fake invoice</b></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tr>
<td>assertTextPresent</td>
<td>Done.</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td tal:content="python:'${base_url}/ERP5Site_createSlapOSFakeInvoiceForTestUser'">.../ERP5Site_createSlapOSFakeInvoiceForTestUser</td>
......@@ -1222,11 +1217,24 @@
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
</tal:block>
<tal:block metal:define-macro="create_fake_unpaid_invoice">
<tr>
<td colspan="3"><b> Create a fake UNPAID invoice</b></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tr>
<td>open</td>
<td tal:content="python:'${base_url}/ERP5Site_createSlapOSFakeInvoiceForTestUser?unpaid=True'">.../ERP5Site_createSlapOSFakeInvoiceForTestUser</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Done.</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
</tal:block>
<tal:block metal:define-macro="check_contextual_help">
......
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