[IMP] sale_stock,delivery: Various imp on delivery slips and picking reports

ON THE DELIVERY SLIP : 

1. CUSTOMER REFERENCE
- If a customer reference is filled in the SO, on the delivery slip, under
  Customer Address, add a section Customer Reference :
- Display every customer information in the header

2. SO NUMBER 
- Display the SO reference under the origin instead on the picking type name.
  Do not display it if unset

3. LOCATIONS AND STATUS
- remove the columns locations and status

4. ORDERED QUANTITY
- add a column (between product and quantity) named Ordered Quantity. It
  contains the quantity of the initial demand. Rename Quantity into
  Delivered Quantity

5. BACKORDER
- If the delivery is a backorder, add the string : This shipment is a backorder
  of "stock.picking.name".
- If a backorder has been created, add the string  : All items couldn't be shipped,
  the remaining ones will be shipped as soon as they become available.
- If it is a backorder and another backorder has been created, both strings should
  be printed.

6. SCHEDULE DATE
- Should be the date when the delivery order is validated.
- Rename Scheduled Date into "Date" 
    - If the DO is not yet validated, display the scheduled date.
    - If the DO is validated : display the date it was validated.

7. WEIGHT
- Add the unit of measure after the weight value
- Display only if set

8. CARRIER
- Display only if set

9. LOT/SERIAL NUMBERS
- Keep the header of the column + rename it into Serial Number / Lot

10. CUSTOMER/CONTACT ADDRESS
- Should be displayed on the right, keep only minimal information: Customer name,
  phone number

ON THE PICKING REPORT
- picking: https://drive.google.com/file/d/0Bx4JWs1efCreX1FrZUhaZDEtblU/view?usp=drivesdk
- form: https://drive.google.com/a/openerp.com/file/d/0B5BDHVRYo-q5X3VGVWI1aThWcWM/view?usp=drivesdk
This commit is contained in:
Mansi Trivedi
2016-04-07 14:06:14 +02:00
committed by Yannick Tivisse
parent fa3df7b9df
commit 977d1acc7c
8 changed files with 100 additions and 68 deletions
@@ -1,15 +1,16 @@
<odoo>
<template id="report_delivery_document2" inherit_id="stock.report_delivery_document">
<xpath expr="//th[@name='td_sched_date_h']" position="after">
<th t-if="o.picking_type_id.code == 'outgoing'"><strong>Carrier</strong></th>
<th><strong>Weight</strong></th>
<th t-if="o.picking_type_id.code == 'outgoing' and o.carrier_id"><strong>Carrier</strong></th>
<th t-if="o.weight"><strong>Weight</strong></th>
</xpath>
<xpath expr="//td[@name='td_sched_date']" position="after">
<td t-if="o.picking_type_id.code == 'outgoing'">
<td t-if="o.picking_type_id.code == 'outgoing' and o.carrier_id">
<span t-field="o.carrier_id"/>
</td>
<td>
<td t-if="o.weight">
<span t-field="o.weight"/>
<span t-field="o.weight_uom_id"/>
</td>
</xpath>
</template>
+5 -4
View File
@@ -1,15 +1,16 @@
<odoo>
<template id="report_shipping2" inherit_id="stock.report_picking">
<xpath expr="//th[@name='td_sched_date_h']" position="after">
<th t-if="o.picking_type_id.code == 'outgoing'"><strong>Carrier</strong></th>
<th><strong>Weight</strong></th>
<th t-if="o.picking_type_id.code == 'outgoing' and o.carrier_id"><strong>Carrier</strong></th>
<th t-if="o.weight"><strong>Weight</strong></th>
</xpath>
<xpath expr="//td[@name='td_sched_date']" position="after">
<td t-if="o.picking_type_id.code == 'outgoing'">
<td t-if="o.picking_type_id.code == 'outgoing' and o.carrier_id">
<span t-field="o.carrier_id"/>
</td>
<td>
<td t-if="o.weight">
<span t-field="o.weight"/>
<span t-field="o.weight_uom_id"/>
</td>
</xpath>
</template>
+1
View File
@@ -34,6 +34,7 @@ You can choose flexible invoicing methods:
'stock_view.xml',
'res_config_view.xml',
'account_invoice_view.xml',
'views/report_deliveryslip.xml',
],
'demo': ['sale_stock_demo.xml'],
'installable': True,
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_delivery_document_inherit_sale_stock" inherit_id="stock.report_delivery_document">
<xpath expr="//div[@name='customer_address']" position="after">
<div class="row" t-if="o.sale_id.client_order_ref">
<div class="col-xs-4 pull-right">
<strong>Customer Reference:</strong>
<p t-field="o.sale_id.client_order_ref"/>
</div>
</div>
</xpath>
</template>
</odoo>
+7
View File
@@ -2009,6 +2009,7 @@ class stock_move(osv.osv):
'restrict_partner_id': fields.many2one('res.partner', 'Owner ', help="Technical field used to depict a restriction on the ownership of quants to consider when marking this move as 'done'"),
'route_ids': fields.many2many('stock.location.route', 'stock_location_route_move', 'move_id', 'route_id', 'Destination route', help="Preferred route to be followed by the procurement order"),
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', help="Technical field depicting the warehouse to consider for the route selection on the next procurement (if any)."),
'ordered_qty': fields.float('Ordered Quantity', digits_compute=dp.get_precision('Product Unit of Measure')),
}
def _default_destination_address(self, cr, uid, context=None):
@@ -2139,6 +2140,7 @@ class stock_move(osv.osv):
if track:
picking = picking_obj.browse(cr, uid, vals['picking_id'], context=context)
initial_values = {picking.id: {'state': picking.state}}
vals['ordered_qty'] = vals.get('product_uom_qty')
res = super(stock_move, self).create(cr, uid, vals, context=context)
if track:
picking_obj.message_track(cr, uid, [vals['picking_id']], picking_obj.fields_get(cr, uid, ['state'], context=context), initial_values, context=context)
@@ -4480,6 +4482,7 @@ class stock_pack_operation(osv.osv):
('assigned', 'Available'),
('done', 'Done'),
]),
'ordered_qty': fields.float('Ordered Quantity', digits_compute=dp.get_precision('Product Unit of Measure')),
}
_defaults = {
@@ -4501,6 +4504,10 @@ class stock_pack_operation(osv.osv):
raise UserError(_('The quantity to split should be smaller than the quantity To Do. '))
return True
def create(self, cr, uid, vals, context=None):
vals['ordered_qty'] = vals.get('product_qty')
return super(stock_pack_operation, self).create(cr, uid, vals, context=context)
def write(self, cr, uid, ids, vals, context=None):
vals['fresh_record'] = False
context = context or {}
+1
View File
@@ -889,6 +889,7 @@
<button name="force_assign" states="confirmed,waiting,partially_available" string="Force Availability" type="object" groups="base.group_user"/>
<button name="do_new_transfer" states="draft,partially_available,assigned" string="Validate" groups="stock.group_stock_user" type="object" class="oe_highlight"/>
<button name="do_print_picking" string="Print" groups="stock.group_stock_user" type="object" attrs="{'invisible': [('state', 'not in', ('assigned', 'partially_available'))]}"/>
<button name="%(action_report_delivery)d" string="Print" states="done" type="action" groups="base.group_user"/>
<button name="%(act_stock_return_picking)d" string="Reverse" states="done" type="action" groups="base.group_user"/>
<button name="action_cancel" states="assigned,confirmed,partially_available,draft,waiting" string="Cancel" groups="base.group_user" type="object"/>
<button name="do_unreserve" string="Unreserve" groups="base.group_user" type="object" attrs="{'invisible': [('quant_reserved_exist', '=', False)]}"/>
+41 -37
View File
@@ -6,8 +6,8 @@
<t t-call="report.external_layout">
<t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})" />
<div class="page">
<div class="row">
<div class="col-xs-6">
<div class="row" name="customer_address">
<div class="col-xs-4 pull-right">
<div>
<span><strong>Customer Address:</strong></span>
</div>
@@ -15,7 +15,7 @@
<div t-field="o.partner_id"
t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/>
</div>
</div>
</div>
</div>
<h2>
<span t-field="o.name"/>
@@ -23,17 +23,24 @@
<table class="table table-condensed">
<thead>
<tr>
<th><strong>Order (Origin)</strong></th>
<th name="td_sched_date_h"><strong>Scheduled Date</strong></th>
<th t-if="o.origin"><strong>Order (Origin)</strong></th>
<th name="td_sched_date_h">
<strong>Date</strong>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<span t-field="o.picking_type_id"/>
<td t-if="o.origin">
<span t-field="o.origin"/>
</td>
<td name="td_sched_date">
<span t-field="o.min_date"/>
<t t-if="o.state == 'done'">
<span t-field="o.date_done"/>
</t>
<t t-if="o.state != 'done'">
<span t-field="o.min_date"/>
</t>
</td>
</tr>
</tbody>
@@ -42,32 +49,30 @@
<thead>
<tr>
<th><strong>Product</strong></th>
<th><strong>Status</strong></th>
<th><strong>Location</strong></th>
<th class="text-right"><strong>Quantity</strong></th>
<th><strong>Ordered Quantity</strong></th>
</tr>
</thead>
<tbody>
<tr t-foreach="o.move_lines" t-as="move">
<td><span t-field="move.product_id"/></td>
<td><span t-field="move.state"/></td>
<td><span t-field="move.location_id"/></td>
<td class="text-right">
<span t-field="move.product_uom_qty"/>
<td>
<span t-field="move.ordered_qty"/>
<span t-field="move.product_uom"/>
</td>
</tr>
</tbody>
</table>
<t t-set="backorder" t-value="False"/>
<table class="table table-condensed mt48" t-if="o.pack_operation_ids">
<t t-set="has_serial_number" t-value="o.pack_operation_ids.filtered('pack_lot_ids')" groups="stock.group_production_lot"/>
<thead>
<tr>
<th><strong>Product</strong></th>
<th t-if="has_serial_number"><strong>Serial Number</strong></th>
<th><strong>Status</strong></th>
<th><strong>Location</strong></th>
<th class="text-right"><strong>Quantity</strong></th>
<th t-if="has_serial_number"><strong>Serial Number /Lot</strong></th>
<th class="text-center"><strong>Ordered Quantity</strong></th>
<th t-if="any([pack_operation.state == 'done' for pack_operation in o.pack_operation_ids])" class="text-right">
<strong>Delivered Quantity</strong>
</th>
</tr>
</thead>
<tbody>
@@ -81,9 +86,6 @@
<t t-if="has_serial_number">
<td t-if="pack_operation.pack_lot_ids">
<table class="table table-condensed" t-if="pack_operation.pack_lot_ids">
<thead>
<tr><th>Lot</th><th>Qty</th></tr>
</thead>
<tr t-foreach="pack_operation.pack_lot_ids" t-as="packlot">
<td>
<span t-field="packlot.lot_id"/>
@@ -92,35 +94,37 @@
</t>
</td>
<td>
<span t-field="packlot.qty"/> <t t-if="o.picking_type_id.use_existing_lots and o.state!='done'"> / <span t-field="packlot.qty_todo"/></t>
<span t-field="packlot.qty"/>
</td>
</tr>
</table>
</td>
<td t-if="not pack_operation.pack_lot_ids"/>
</t>
<td>
<t t-set="mls" t-value="pack_operation.picking_id.move_lines"/>
<t t-set="check" t-value="True"/>
<t t-foreach="mls" t-as="ml">
<t t-if="ml.product_id.id == pack_operation.product_id.id and check">
<t t-set="check" t-value="False"/>
<span t-field="ml.state"/>
</t>
</t>
</td>
<td>
<span t-field="pack_operation.location_id"/>
<td class="text-center">
<span t-if="pack_operation.package_id">:</span>
<span t-field="pack_operation.package_id"/>
<span t-field="pack_operation.ordered_qty"/>
<span t-field="pack_operation.product_uom_id"/>
</td>
<td class="text-right">
<span t-field="pack_operation.product_qty"/>
<td class="text-right" t-if="pack_operation.state == 'done'">
<t t-if="pack_operation.ordered_qty != pack_operation.qty_done">
<t t-set="backorder" t-value="True"/>
</t>
<span t-field="pack_operation.qty_done"/>
<span t-field="pack_operation.product_uom_id"/>
</td>
</tr>
</tbody>
</table>
<p t-if="o.backorder_id">
This shipment is a backorder of <t t-esc="o.backorder_id.name"/>.
</p>
<p>
<t t-if="backorder">
All items couldn't be shipped, the remaining ones will be shipped as soon as they become available.
</t>
</p>
</div>
</t>
</t>
@@ -21,22 +21,6 @@
<br/>
<div class="row">
<div class="col-xs-6">
<div t-if="o.picking_type_id.code=='incoming' and o.partner_id">
<span><strong>Vendor Address:</strong></span>
</div>
<div t-if="o.picking_type_id.code=='internal' and o.partner_id">
<span><strong>Warehouse Address:</strong></span>
</div>
<div t-if="o.picking_type_id.code=='outgoing' and o.partner_id">
<span><strong>Customer Address:</strong></span>
</div>
<div t-if="o.partner_id" name="partner_header">
<div t-field="o.partner_id"
t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true, "phone_icons": true}'/>
<p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p>
</div>
</div>
<div class="col-xs-5 col-xs-offset-1">
<div t-if="o.move_lines and o.move_lines[0].partner_id and o.move_lines[0].partner_id.id != o.partner_id.id">
<span><strong>Delivery Address:</strong></span>
<div t-field="o.move_lines[0].partner_id"
@@ -48,14 +32,29 @@
t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true, "phone_icons": true}'/>
</div>
</div>
<div class="col-xs-5 col-xs-offset-1">
<div t-if="o.picking_type_id.code=='incoming' and o.partner_id">
<span><strong>Vendor Address:</strong></span>
</div>
<div t-if="o.picking_type_id.code=='internal' and o.partner_id">
<span><strong>Warehouse Address:</strong></span>
</div>
<div t-if="o.picking_type_id.code=='outgoing' and o.partner_id">
<span><strong>Customer Address:</strong></span>
</div>
<div t-if="o.partner_id" name="partner_header">
<div t-field="o.partner_id"
t-field-options='{"widget": "contact", "fields": ["name", "phone"], "no_marker": true, "phone_icons": true}'/>
<p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p>
</div>
</div>
</div>
<br/><br/>
<div t-field="o.picking_type_id"/>
<h1 t-field="o.name" class="mt0"/>
<table class="table table-condensed">
<thead>
<tr>
<th><strong>Order (Origin)</strong></th>
<th t-if="o.origin"><strong>Order (Origin)</strong></th>
<th><strong>State</strong></th>
<th><strong>Commitment Date</strong></th>
<th name="td_sched_date_h"><strong>Scheduled Date</strong></th>
@@ -63,7 +62,7 @@
</thead>
<tbody>
<tr>
<td>
<td t-if="o.origin">
<span t-field="o.origin"/>
</td>
<td>
@@ -81,12 +80,18 @@
<br/>
<br/>
<table class="table table-condensed" t-if="o.pack_operation_ids">
<t t-set="has_serial_number" t-value="o.pack_operation_ids.filtered('pack_lot_ids')" groups="stock.group_production_lot"/>
<thead>
<tr>
<th><strong>Product</strong></th>
<th class="text-right"><strong>Quantity</strong></th>
<t t-if="o.picking_type_id.code != 'incoming'"><th><strong>Source</strong></th></t>
<th><strong>Barcode</strong></th>
<th t-if="any([pack_operation.product_id and pack_operation.product_id.barcode or pack_operation.package_id for pack_operation in o.pack_operation_ids])">
<strong>Barcode</strong>
</th>
<th t-if="has_serial_number">
<strong>Serial Number /Lot</strong>
</th>
<t t-if="o.picking_type_id.code != 'outgoing'"><th><strong>Destination</strong></th></t>
</tr>
</thead>
@@ -108,10 +113,9 @@
<span t-if="pack_operation.package_id and not pack_operation.product_id">
<img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', pack_operation.package_id.name, 600, 100)" style="width:300px;height:50px"/>
</span>
</td>
<td t-if="has_serial_number">
<table class="table table-condensed" t-if="pack_operation.pack_lot_ids">
<thead>
<tr><th>Lot</th><th>Qty</th></tr>
</thead>
<tr t-foreach="pack_operation.pack_lot_ids" t-as="packlot">
<td>
<span t-field="packlot.lot_id"/>