Skip to content
Snippets Groups Projects
Commit 4576bef8 authored by Rémi - Le Filament's avatar Rémi - Le Filament
Browse files

[ADD] available quants on lots

parent e777926b
Branches
No related tags found
No related merge requests found
# Copyright 2021 Le Filament (<http://www.le-filament.com>)
# Copyright 2017 Open For Small Business Ltd
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import datetime
import re
......@@ -60,3 +61,12 @@ class FumocStockProductionLot(models.Model):
for field, value in dates_dict.items():
setattr(self, field, value)
# function copied from https://github.com/odoonz/odoonz-addons/tree/14.0/stock_prodlot_qty
# Copyright 2017 Open For Small Business Ltd
def name_get(self):
res = super().name_get()
if self.env.context.get("show_qty"):
res = self.browse([r[0] for r in res]).mapped(
lambda r: (r.id, r.name + " (en stock : %.0f)" % r.product_qty)
)
return res
......@@ -10,13 +10,28 @@
<field name="inherit_id" ref="product_expiry.view_stock_move_line_detailed_operation_tree_expiry"/>
<field name="priority" eval="8"/>
<field name="arch" type="xml">
<field name="lot_id" position="attributes">
<attribute name="context">{'default_product_id': product_id, 'default_company_id': company_id, 'active_picking_id': picking_id, 'show_qty': True}</attribute>
</field>
<xpath expr="//field[@name='expiration_date']" position="attributes">
<attribute name="string">DLC</attribute>
<attribute name="attrs">{'column_invisible': [('parent.show_lots_text', '=', True)]}</attribute>
<attribute name="attrs">{'column_invisible': [('parent.show_lots_text', '=', True)], 'readonly': [('picking_type_use_existing_lots', '=', True)]}</attribute>
<attribute name="widget">date</attribute>
</xpath>
</field>
</record>
<record id="fumoc_stock_move_line_operation_tree_inherit" model="ir.ui.view">
<field name="name">fumoc_sale.stock.move.line.op.tree</field>
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="product_expiry.view_stock_move_line_operation_tree_expiry"/>
<field name="priority" eval="8"/>
<field name="arch" type="xml">
<field name="lot_id" position="attributes">
<attribute name="context">{'default_product_id': parent.product_id, 'default_company_id': parent.company_id, 'active_picking_id': picking_id, 'show_qty': True}</attribute>
</field>
</field>
</record>
</data>
</odoo>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment