[REF] stock: add a group to display/hide the lot name on the delivery

initial work by Alexandre Moens <mao@odoo.com>
task 1832574
closes #24299
This commit is contained in:
Simon Lejeune
2018-08-16 15:01:25 +02:00
parent 6671725c3b
commit f57bc96d32
6 changed files with 39 additions and 0 deletions
@@ -16,6 +16,8 @@ class ResConfigSettings(models.TransientModel):
help="Track following dates on lots & serial numbers: best before, removal, end of life, alert. \n Such dates are set automatically at lot/serial number creation based on values set on the product (in days).")
group_stock_production_lot = fields.Boolean("Lots & Serial Numbers",
implied_group='stock.group_production_lot')
group_lot_on_delivery_slip = fields.Boolean("Display Lots & Serial Numbers",
implied_group='stock.group_lot_on_delivery_slip')
group_stock_tracking_lot = fields.Boolean("Delivery Packages",
implied_group='stock.group_tracking_lot')
group_stock_tracking_owner = fields.Boolean("Consignment",
@@ -58,6 +60,11 @@ class ResConfigSettings(models.TransientModel):
if self.group_stock_multi_warehouses:
self.group_stock_multi_locations = True
@api.onchange('group_stock_production_lot')
def _onchange_group_stock_production_lot(self):
if not self.group_stock_production_lot:
self.group_lot_on_delivery_slip = False
@api.onchange('group_stock_adv_location')
def onchange_adv_location(self):
if self.group_stock_adv_location and not self.group_stock_multi_locations:
+5
View File
@@ -22,6 +22,11 @@ class ResUsers(models.Model):
compute='_compute_groups_id', inverse='_inverse_groups_id',
group_xml_id='stock.group_production_lot')
has_group_lot_on_delivery_slip = fields.Boolean(
'Display Lots & Serial Numbers on Delivery Slip',
compute='_compute_groups_id', inverse='_inverse_groups_id',
group_xml_id='stock.group_lot_on_delivery_slip')
has_group_tracking_lot = fields.Boolean(
'Manage Packages',
compute='_compute_groups_id', inverse='_inverse_groups_id',
@@ -65,9 +65,13 @@
</tbody>
</table>
<table class="table table-sm mt48" t-if="o.move_line_ids and o.state=='done'">
<t t-set="has_serial_number" t-value="o.move_line_ids.mapped('lot_id')" />
<thead>
<tr>
<th><strong>Product</strong></th>
<th name="lot_serial" t-if="has_serial_number" groups="stock.group_lot_on_delivery_slip">
Lot/Serial Number
</th>
<th class="text-center"><strong>Quantity</strong></th>
</tr>
</thead>
@@ -82,6 +86,9 @@
<span t-field="move_line.product_id.sudo().description_pickingin"/>
</p>
</td>
<td t-if="has_serial_number" groups="stock.group_lot_on_delivery_slip">
<span t-field="move_line.lot_name"/>
</td>
<td class="text-center">
<span t-field="move_line.qty_done"/>
<span t-field="move_line.product_uom_id"/>
+5
View File
@@ -26,6 +26,11 @@
<field name="name">Manage Lots / Serial Numbers</field>
</record>
<record id="group_lot_on_delivery_slip" model="res.groups">
<field name="name">Display Serial &amp; Lot Number in Delivery Slips</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>
<record id="group_tracking_lot" model="res.groups">
<field name="name">Manage Packages</field>
</record>
@@ -222,6 +222,17 @@
</div>
</div>
</div>
<div class="col-12 col-lg-6 o_setting_box" attrs="{'invisible': [('group_stock_production_lot', '=', False)]}" id="group_lot_on_delivery_slip">
<div class="o_setting_left_pane">
<field name="group_lot_on_delivery_slip"/>
</div>
<div class="o_setting_right_pane">
<label for="group_lot_on_delivery_slip"/>
<div class="text-muted">
Lots &amp; Serial numbers will appear on the delivery slip
</div>
</div>
</div>
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="group_stock_tracking_owner"/>
+4
View File
@@ -22,6 +22,10 @@
<div>
<field name='has_group_production_lot' colspan="1" class="oe_inline"/>
</div>
<label for="has_group_lot_on_delivery_slip" colspan="3"/>
<div>
<field name='has_group_lot_on_delivery_slip' colspan="1" class="oe_inline"/>
</div>
<label for="has_group_tracking_lot" colspan="3"/>
<div>
<field name='has_group_tracking_lot' colspan="1" class="oe_inline"/>