[ADD] support for generic alternative content in right-hand side

dd.alternatives triggers "widget", each (dt, dd) is an alternative with
dt being the alternative (and radio button) label and dd being the
actual content to display on selection.
This commit is contained in:
Xavier Morel 2015-04-16 11:57:02 +02:00
parent eb20f603b5
commit 15c51c9845
3 changed files with 165 additions and 32 deletions

View File

@ -153,3 +153,17 @@ blockquote.highlights {
margin-bottom: 0; margin-bottom: 0;
text-align: center; text-align: center;
} }
/*
lists of alternatives
*/
.alternatives-controls label {
display: block;
}
dl.alternatives > dt,
dl.alternatives > dd {
display: none;
}
dl.alternatives > dd {
margin-left: 0;
}

View File

@ -1,5 +1,52 @@
(function () { (function () {
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
alternatives()
checks_handling();
});
/** alternatives display:
* - prepend control for each <dt>
* - radio input with link to following dd
* - label is <dt> content
* - hide all first-level dt and dd (CSS)
* - on change
* - hide all dds
* - show dd corresponding to the selected radio
* - automatically select first control on startup
*/
function alternatives() {
$('dl.alternatives').each(function (index) {
var $list = $(this),
$contents = $list.children('dd');
var $controls = $('<div class="alternatives-controls">').append(
$list.children('dt').map(function () {
var label = document.createElement('label'),
input = document.createElement('input');
input.setAttribute('type', 'radio');
input.setAttribute('name', 'alternatives-' + index);
var sibling = this;
while ((sibling = sibling.nextSibling) && sibling.nodeType !== 1);
input.content = sibling;
label.appendChild(input);
label.appendChild(document.createTextNode(' '));
label.appendChild(document.createTextNode(this.textContent));
return label;
}))
.insertBefore($list)
.on('change', 'input', function (e) {
// change event triggers only on newly selected input, not
// on the one being deselected
$contents.css('display', '');
var content = e.target.content;
content && (content.style.display = 'block');
})
.find('input:first').click();
});
}
function checks_handling() {
var $section = $('.checks-handling'); var $section = $('.checks-handling');
if (!$section.length) { return; } if (!$section.length) { return; }
@ -9,7 +56,7 @@
while (this.firstChild) { while (this.firstChild) {
this.removeChild(this.firstChild) this.removeChild(this.firstChild)
} }
$('<label style="display: block;">') $('<label style="display: block;">')
.append('<input type="radio" name="checks-handling">') .append('<input type="radio" name="checks-handling">')
.append(' ') .append(' ')
@ -28,5 +75,6 @@
}).eq(idx).prop('checked', true); }).eq(idx).prop('checked', true);
$ul.nextAll('div').hide().eq(idx).show(); $ul.nextAll('div').hide().eq(idx).show();
} }
});
}
})(); })();

View File

@ -17,13 +17,30 @@ Operations
Stock moves represent the transit of goods and materials between inventory Stock moves represent the transit of goods and materials between inventory
locations. locations.
* Manufacturing Order .. rst-class:: alternatives force-right
* Drop-shipping
* Picking ➔ Packing ➔ Shipping Manufacturing Order
* Inter-Warehouse transfert Consume:
* Loss of product | 2 Wheels: Warehouse → Manufacturing
* Inventory | 1 Bike Frame: Warehouse → Manufacturing
* Reception Produce:
1 Bicycle: Manufacturing → Warehouse
Configuration:
| Warehouse: the location the Manufacturing Order is initiated
| Manufacturing: on the product form, field “Manufacturing Location”
Drop-shipping
stuff 1
Picking ➔ Packing ➔ Shipping
stuff 2
Inter-Warehouse transfert
stuff 3
Loss of product
stuff 4
Inventory
stuff 5
Reception
stuff 6
Analysis Analysis
======== ========
@ -41,17 +58,33 @@ For each inventory location, multiple data points can be analysed:
* value of products delivered to clients over a period * value of products delivered to clients over a period
* value of products in transit between locations * value of products in transit between locations
Procurements & Pull Rules Procurements & Procurement Rules
========================= ================================
A procurement is a request for a specific quantity of products to a specific A procurement is a request for a specific quantity of products to a specific
location. They can be created manually or automatically triggered by: location. They can be created manually or automatically triggered by:
* sale orders .. rst-class:: alternatives force-right
* minimum stock rules
* rules
*Pull rules* describe how to fulfill procurements on specific locations: Sale order
Effect
A procurement is created at the customer location for every product
ordered by the customer (you have to deliver the customer)
Configuration
Procurement Location: on the customer, field “Customer Location” (property)
Minimum Stock Rule
Effect
todo
Configuration
todo
Rules
Effect
todo
Configuration
todo
*Procurement rules* describe how to fulfill procurements on specific
locations:
* where the product should come from (source location) * where the product should come from (source location)
* whether the procurement is :abbr:`MTO (Made To Order)` or :abbr:`MTS (Made * whether the procurement is :abbr:`MTO (Made To Order)` or :abbr:`MTS (Made
@ -64,30 +97,68 @@ location. They can be created manually or automatically triggered by:
Routes Routes
====== ======
At each step or a procurement's fulfillment, multiple rules may be Procurement rules are grouped in routes. Routes define paths the product must
available. *Routes* define which rules should be used based on the environment follow. Routes may be applicable or not, depending on the products, sales
(product, sales orders, warehouse, …). To fulfill a procurement, the system order lines, warehouse,...
will search for routes in the following order:
1. sale order line routes To fulfill a procurement, the system will search for rules belonging to routes
2. product routes that are defined in (by order of priority):
3. product category routes
4. warehouse routes .. rst-class:: alternatives force-right
Warehouses
Warehouse Route Example:
Pick → Pack → Ship
Picking List:
Pick Zone → Pack Zone
Pack List:
Pack Zone → Gate A
Delivery Order:
Gate A → Customer
Routes that describe how you organize your warehouse should be defined on the warehouse.
A Product
Product Route Example:
Supplier → Quality Control → Inventory
Product Category
Product Category Route Example:
Supplier → Cross-Docks → Pack Zone
Sale Order Line
Sale Order Line Example: Drop-shipping
Supplier → Customer
Push Rules Push Rules
========== ==========
Push rules are triggered when a product enters a specific location, and allows
chaining locations. Push rules can also be configured and filtered using
routes.
Some example: Push rule are trigered when products arrive at a specific location and allows
* quality control to automatically move them to another location. Push rules applications also
* transit warehouse 1 depends on applicable routes.
.. warning:: push rules and pull rules are *not* symmetrical, pull rules are .. rst-class:: alternatives force-right
triggered by procurement requests whereas push rules are
triggered by stock moves Quality Control
* Product lands in Arrival Zone
* Push 1: Arrival Zone → Quality Control
* Push 2: Quality Control → Inventry
Transit Warehouse 1
* Product lands in ?
Procurement Groups Procurement Groups
================== ==================
Routes and rules defines the inventory moves. On every rule, the document type
is provided:
* Picking
* Packing
* Delivery Order
* Purchase Order
* ...
Moves are grouped within the same document type if their procurement group and
locations are the same.
A sale order creates a procurement group so that pickings and delivery orders
of the same order are grouped. But you can define specific groups on
reordering rules too. (e.g. to group purchases of specific products together)