Do not allow (or manually correct) the Serial number selected by the user.

This commit is contained in:
Jared Kipe
2018-12-11 08:37:04 -08:00
parent 24a73663e5
commit 2e5fa6e5ab
4 changed files with 65 additions and 1 deletions

View File

@@ -18,6 +18,7 @@
], ],
'data': [ 'data': [
'templates/assets.xml', 'templates/assets.xml',
'views/pos_views.xml',
], ],
'qweb': [ 'qweb': [
'static/src/xml/pos.xml' 'static/src/xml/pos.xml'

View File

@@ -128,11 +128,21 @@ odoo.define("pos_product_catch_weight.models", function (require) {
}, },
set_lot_name: function(name){ set_lot_name: function(name){
this.set({ /*
If you want to allow selling unknown lots:
{
lot_name : _.str.trim(name) || null, lot_name : _.str.trim(name) || null,
lot_catch_weight_ratio : 1.0, lot_catch_weight_ratio : 1.0,
lot_catch_weight : 1.0, lot_catch_weight : 1.0,
lot_catch_weight_uom_id : null, lot_catch_weight_uom_id : null,
}
*/
this.set({
lot_name : _.str.trim(name) || null,
lot_catch_weight_ratio : 9999.0,
lot_catch_weight : 9999.0,
lot_catch_weight_uom_id : [0, 'INVALID'],
}); });
}, },
}) })

View File

@@ -37,4 +37,19 @@
</t> </t>
</t> </t>
<t t-extend="PosTicket">
<t t-jquery=".receipt-orderlines tr td:nth-child(1)" t-operation="append">
<br/>
<t t-set="lots" t-value="orderline.pack_lot_lines.get_valid_lots()"/>
<t t-if="lots" t-foreach="lots" t-as="lot">
-- <t t-esc="lot.get_lot_name()"/>
<t t-if="lot.get('lot_catch_weight_uom_id')">
@ <t t-esc="lot.get('lot_catch_weight')"/>
<t t-esc="lot.get('lot_catch_weight_uom_id')[1]"/>
</t>
<br/>
</t>
</t>
</t>
</templates> </templates>

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_pos_order_line_form_inherit" model="ir.ui.view">
<field name="name">pos.order.line.form.inherit</field>
<field name="model">pos.order.line</field>
<field name="inherit_id" ref="point_of_sale.view_pos_order_line_form"/>
<field name="arch" type="xml">
<xpath expr="//group" position="after">
<group col="4">
<field name="pack_lot_ids" colspan="4">
<tree>
<field name="lot_name"/>
<field name="lot_id"/>
</tree>
</field>
</group>
</xpath>
</field>
</record>
<record id="view_pos_pos_form_inherit" model="ir.ui.view">
<field name="name">pos.order.form.inherit</field>
<field name="model">pos.order</field>
<field name="inherit_id" ref="point_of_sale.view_pos_pos_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='lines']/form/group" position="after">
<group col="4">
<field name="pack_lot_ids" colspan="4">
<tree>
<field name="lot_name"/>
<field name="lot_id"/>
</tree>
</field>
</group>
</xpath>
</field>
</record>
</odoo>