mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Improve UI, allowing user to measure the catch weight in a specific unit of measure.
This UOM should be convertable (in the same category) as the normal stock UOM for the product. Example: If you want to sell 'units' of 50lbs then you should make a "50lbs" UOM in the Weight category and use that as the sale and purchase UOM, then your "Catch Weight UOM" can be the stock "lb(s)" UOM.
This commit is contained in:
committed by
Bhoomi Vaishnani
parent
1fb03d8d73
commit
b1c4aba75e
@@ -12,6 +12,7 @@
|
|||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
'website': 'https://hibou.io/',
|
'website': 'https://hibou.io/',
|
||||||
'data': [
|
'data': [
|
||||||
|
'views/account_invoice_views.xml',
|
||||||
'views/stock_views.xml',
|
'views/stock_views.xml',
|
||||||
],
|
],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
from . import account_invoice
|
from . import account_invoice
|
||||||
|
from . import product
|
||||||
from . import stock_patch
|
from . import stock_patch
|
||||||
from . import stock
|
from . import stock
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ _logger = logging.getLogger(__name__)
|
|||||||
class AccountInvoiceLine(models.Model):
|
class AccountInvoiceLine(models.Model):
|
||||||
_inherit = 'account.invoice.line'
|
_inherit = 'account.invoice.line'
|
||||||
|
|
||||||
|
catch_weight = fields.Float(string='Catch Weight', digits=(10, 4), compute='_compute_price', store=True)
|
||||||
|
catch_weight_uom_id = fields.Many2one('product.uom', related='product_id.catch_weight_uom_id')
|
||||||
|
|
||||||
@api.one
|
@api.one
|
||||||
@api.depends('price_unit', 'discount', 'invoice_line_tax_ids', 'quantity',
|
@api.depends('price_unit', 'discount', 'invoice_line_tax_ids', 'quantity',
|
||||||
'product_id', 'invoice_id.partner_id', 'invoice_id.currency_id', 'invoice_id.company_id',
|
'product_id', 'invoice_id.partner_id', 'invoice_id.currency_id', 'invoice_id.company_id',
|
||||||
@@ -17,6 +20,7 @@ class AccountInvoiceLine(models.Model):
|
|||||||
|
|
||||||
ratio = 1.0
|
ratio = 1.0
|
||||||
qty_done_total = 0.0
|
qty_done_total = 0.0
|
||||||
|
catch_weight = 0.0
|
||||||
if self.invoice_id.type in ('out_invoice', 'out_refund'):
|
if self.invoice_id.type in ('out_invoice', 'out_refund'):
|
||||||
move_lines = self.sale_line_ids.mapped('move_ids.move_line_ids')
|
move_lines = self.sale_line_ids.mapped('move_ids.move_line_ids')
|
||||||
else:
|
else:
|
||||||
@@ -26,7 +30,9 @@ class AccountInvoiceLine(models.Model):
|
|||||||
r = move_line.lot_id.catch_weight_ratio
|
r = move_line.lot_id.catch_weight_ratio
|
||||||
ratio = ((ratio * qty_done_total) + (qty_done * r)) / (qty_done + qty_done_total)
|
ratio = ((ratio * qty_done_total) + (qty_done * r)) / (qty_done + qty_done_total)
|
||||||
qty_done_total += qty_done
|
qty_done_total += qty_done
|
||||||
|
catch_weight += move_line.lot_id.catch_weight
|
||||||
price = price * ratio
|
price = price * ratio
|
||||||
|
self.catch_weight = catch_weight
|
||||||
|
|
||||||
taxes = False
|
taxes = False
|
||||||
if self.invoice_line_tax_ids:
|
if self.invoice_line_tax_ids:
|
||||||
|
|||||||
7
product_catch_weight/models/product.py
Normal file
7
product_catch_weight/models/product.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
from odoo import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class ProductProduct(models.Model):
|
||||||
|
_inherit = 'product.template'
|
||||||
|
|
||||||
|
catch_weight_uom_id = fields.Many2one('product.uom', string='Catch Weight UOM')
|
||||||
@@ -4,17 +4,43 @@ from odoo import api, fields, models
|
|||||||
class StockProductionLot(models.Model):
|
class StockProductionLot(models.Model):
|
||||||
_inherit = 'stock.production.lot'
|
_inherit = 'stock.production.lot'
|
||||||
|
|
||||||
catch_weight_ratio = fields.Float(string='Catch Weight Ratio', digits=(10, 6), default=1.0)
|
catch_weight_ratio = fields.Float(string='Catch Weight Ratio', digits=(10, 6), compute='_compute_catch_weight_ratio')
|
||||||
|
catch_weight = fields.Float(string='Catch Weight', digits=(10, 4))
|
||||||
|
catch_weight_uom_id = fields.Many2one('product.uom', related='product_id.catch_weight_uom_id')
|
||||||
|
|
||||||
|
|
||||||
|
@api.depends('catch_weight')
|
||||||
|
def _compute_catch_weight_ratio(self):
|
||||||
|
for lot in self:
|
||||||
|
if not lot.catch_weight_uom_id:
|
||||||
|
lot.catch_weight_ratio = 1.0
|
||||||
|
else:
|
||||||
|
lot.catch_weight_ratio = lot.catch_weight_uom_id._compute_quantity(lot.catch_weight,
|
||||||
|
lot.product_id.uom_id,
|
||||||
|
rounding_method='DOWN')
|
||||||
|
|
||||||
|
|
||||||
|
class StockMove(models.Model):
|
||||||
|
_inherit = 'stock.move'
|
||||||
|
|
||||||
|
product_catch_weight_uom_id = fields.Many2one('product.uom', related="product_id.catch_weight_uom_id")
|
||||||
|
|
||||||
|
def _prepare_move_line_vals(self, quantity=None, reserved_quant=None):
|
||||||
|
vals = super(StockMove, self)._prepare_move_line_vals(quantity=quantity, reserved_quant=reserved_quant)
|
||||||
|
vals['catch_weight_uom_id'] = self.product_catch_weight_uom_id.id if self.product_catch_weight_uom_id else False
|
||||||
|
return vals
|
||||||
|
|
||||||
|
def action_show_details(self):
|
||||||
|
action = super(StockMove, self).action_show_details()
|
||||||
|
action['context']['show_catch_weight'] = bool(self.product_id.catch_weight_uom_id)
|
||||||
|
return action
|
||||||
|
|
||||||
|
|
||||||
class StockMoveLine(models.Model):
|
class StockMoveLine(models.Model):
|
||||||
_inherit = 'stock.move.line'
|
_inherit = 'stock.move.line'
|
||||||
|
|
||||||
lot_catch_weight_ratio = fields.Float(string='Catch Weight Ratio', digits=(10, 6), default=1.0)
|
catch_weight_ratio = fields.Float(string='Catch Weight Ratio', digits=(10, 6), default=1.0)
|
||||||
lot_catch_weight_ratio_related = fields.Float(related='lot_id.catch_weight_ratio')
|
catch_weight = fields.Float(string='Catch Weight', digits=(10,4))
|
||||||
#lot_catch_weight_ratio = fields.Float(related='lot_id.catch_weight_ratio')
|
catch_weight_uom_id = fields.Many2one('product.uom', string='Catch Weight UOM')
|
||||||
|
lot_catch_weight = fields.Float(related='lot_id.catch_weight')
|
||||||
# def _action_done(self):
|
lot_catch_weight_uom_id = fields.Many2one('product.uom', related='product_id.catch_weight_uom_id')
|
||||||
# super(StockMoveLine, self)._action_done()
|
|
||||||
# for ml in self.filtered(lambda l: l.product_id.tracking == 'serial' and l.lot_id):
|
|
||||||
# ml.lot_id.catch_weight_ratio = ml.lot_catch_weight_ratio
|
|
||||||
|
|||||||
@@ -41,8 +41,9 @@ def _action_done(self):
|
|||||||
# the fly before assigning it to the move line if the user checked both
|
# the fly before assigning it to the move line if the user checked both
|
||||||
# `use_create_lots` and `use_existing_lots`.
|
# `use_create_lots` and `use_existing_lots`.
|
||||||
if ml.lot_name and not ml.lot_id:
|
if ml.lot_name and not ml.lot_id:
|
||||||
|
lot_catch_weight = ml.catch_weight_uom_id._compute_quantity(ml.catch_weight, ml.product_id.catch_weight_uom_id, rounding_method='DOWN')
|
||||||
lot = self.env['stock.production.lot'].create(
|
lot = self.env['stock.production.lot'].create(
|
||||||
{'name': ml.lot_name, 'product_id': ml.product_id.id, 'catch_weight_ratio': ml.lot_catch_weight_ratio}
|
{'name': ml.lot_name, 'product_id': ml.product_id.id, 'catch_weight': lot_catch_weight}
|
||||||
)
|
)
|
||||||
ml.write({'lot_id': lot.id})
|
ml.write({'lot_id': lot.id})
|
||||||
elif not picking_type_id.use_create_lots and not picking_type_id.use_existing_lots:
|
elif not picking_type_id.use_create_lots and not picking_type_id.use_existing_lots:
|
||||||
|
|||||||
@@ -9,7 +9,16 @@ _logger = logging.getLogger(__name__)
|
|||||||
class TestPicking(TransactionCase):
|
class TestPicking(TransactionCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestPicking, self).setUp()
|
super(TestPicking, self).setUp()
|
||||||
|
self.nominal_weight = 50.0
|
||||||
self.partner1 = self.env.ref('base.res_partner_2')
|
self.partner1 = self.env.ref('base.res_partner_2')
|
||||||
|
self.stock_location = self.env.ref('stock.stock_location_stock')
|
||||||
|
self.ref_uom_id = self.env.ref('product.product_uom_kgm')
|
||||||
|
self.product_uom_id = self.env['product.uom'].create({
|
||||||
|
'name': '50 ref',
|
||||||
|
'category_id': self.ref_uom_id.category_id.id,
|
||||||
|
'uom_type': 'bigger',
|
||||||
|
'factor_inv': self.nominal_weight,
|
||||||
|
})
|
||||||
self.product1 = self.env['product.product'].create({
|
self.product1 = self.env['product.product'].create({
|
||||||
'name': 'Product 1',
|
'name': 'Product 1',
|
||||||
'type': 'product',
|
'type': 'product',
|
||||||
@@ -17,13 +26,10 @@ class TestPicking(TransactionCase):
|
|||||||
'list_price': 100.0,
|
'list_price': 100.0,
|
||||||
'standard_price': 50.0,
|
'standard_price': 50.0,
|
||||||
'taxes_id': [(5, 0, 0)],
|
'taxes_id': [(5, 0, 0)],
|
||||||
|
'uom_id': self.product_uom_id.id,
|
||||||
|
'uom_po_id': self.product_uom_id.id,
|
||||||
|
'catch_weight_uom_id': self.ref_uom_id.id,
|
||||||
})
|
})
|
||||||
#self.product1 = self.env.ref('product.product_order_01')
|
|
||||||
self.product1.write({
|
|
||||||
'type': 'product',
|
|
||||||
'tracking': 'serial',
|
|
||||||
})
|
|
||||||
self.stock_location = self.env.ref('stock.stock_location_stock')
|
|
||||||
|
|
||||||
|
|
||||||
# def test_creation(self):
|
# def test_creation(self):
|
||||||
@@ -50,12 +56,13 @@ class TestPicking(TransactionCase):
|
|||||||
# self.env['stock.quant']._update_available_quantity(self.productA, stock_location, 1.0, lot_id=lot)
|
# self.env['stock.quant']._update_available_quantity(self.productA, stock_location, 1.0, lot_id=lot)
|
||||||
|
|
||||||
def test_so_invoice(self):
|
def test_so_invoice(self):
|
||||||
ratio = 0.8
|
ref_weight = 45.0
|
||||||
lot = self.env['stock.production.lot'].create({
|
lot = self.env['stock.production.lot'].create({
|
||||||
'product_id': self.product1.id,
|
'product_id': self.product1.id,
|
||||||
'name': '123456789',
|
'name': '123456789',
|
||||||
'catch_weight_ratio': ratio,
|
'catch_weight': ref_weight,
|
||||||
})
|
})
|
||||||
|
self.assertAlmostEqual(lot.catch_weight_ratio, ref_weight / self.nominal_weight)
|
||||||
self.env['stock.quant']._update_available_quantity(self.product1, self.stock_location, 1.0, lot_id=lot)
|
self.env['stock.quant']._update_available_quantity(self.product1, self.stock_location, 1.0, lot_id=lot)
|
||||||
so = self.env['sale.order'].create({
|
so = self.env['sale.order'].create({
|
||||||
'partner_id': self.partner1.id,
|
'partner_id': self.partner1.id,
|
||||||
@@ -75,20 +82,20 @@ class TestPicking(TransactionCase):
|
|||||||
|
|
||||||
inv_id = so.action_invoice_create()
|
inv_id = so.action_invoice_create()
|
||||||
inv = self.env['account.invoice'].browse(inv_id)
|
inv = self.env['account.invoice'].browse(inv_id)
|
||||||
self.assertEqual(inv.amount_total, ratio * self.product1.list_price)
|
self.assertAlmostEqual(inv.amount_total, lot.catch_weight_ratio * self.product1.list_price)
|
||||||
|
|
||||||
def test_so_invoice2(self):
|
def test_so_invoice2(self):
|
||||||
ratio1 = 0.8
|
ref_weight1 = 45.0
|
||||||
ratio2 = 1.1
|
ref_weight2 = 51.0
|
||||||
lot1 = self.env['stock.production.lot'].create({
|
lot1 = self.env['stock.production.lot'].create({
|
||||||
'product_id': self.product1.id,
|
'product_id': self.product1.id,
|
||||||
'name': '1-low',
|
'name': '1-low',
|
||||||
'catch_weight_ratio': ratio1,
|
'catch_weight': ref_weight1,
|
||||||
})
|
})
|
||||||
lot2 = self.env['stock.production.lot'].create({
|
lot2 = self.env['stock.production.lot'].create({
|
||||||
'product_id': self.product1.id,
|
'product_id': self.product1.id,
|
||||||
'name': '1-high',
|
'name': '1-high',
|
||||||
'catch_weight_ratio': ratio2,
|
'catch_weight': ref_weight2,
|
||||||
})
|
})
|
||||||
self.env['stock.quant']._update_available_quantity(self.product1, self.stock_location, 1.0, lot_id=lot1)
|
self.env['stock.quant']._update_available_quantity(self.product1, self.stock_location, 1.0, lot_id=lot1)
|
||||||
self.env['stock.quant']._update_available_quantity(self.product1, self.stock_location, 1.0, lot_id=lot2)
|
self.env['stock.quant']._update_available_quantity(self.product1, self.stock_location, 1.0, lot_id=lot2)
|
||||||
@@ -111,12 +118,12 @@ class TestPicking(TransactionCase):
|
|||||||
|
|
||||||
inv_id = so.action_invoice_create()
|
inv_id = so.action_invoice_create()
|
||||||
inv = self.env['account.invoice'].browse(inv_id)
|
inv = self.env['account.invoice'].browse(inv_id)
|
||||||
self.assertEqual(inv.amount_total, (ratio1 * self.product1.list_price) + (ratio2 * self.product1.list_price))
|
self.assertAlmostEqual(inv.amount_total, self.product1.list_price * (lot1.catch_weight_ratio + lot2.catch_weight_ratio))
|
||||||
|
|
||||||
def test_po_invoice(self):
|
def test_po_invoice(self):
|
||||||
ratio1 = 0.8
|
ref_weight1 = 45.0
|
||||||
ratio2 = 1.1
|
ref_weight2 = 51.0
|
||||||
ratios = (ratio1, ratio2)
|
weights = (ref_weight1, ref_weight2)
|
||||||
price = self.product1.standard_price
|
price = self.product1.standard_price
|
||||||
po = self.env['purchase.order'].create({
|
po = self.env['purchase.order'].create({
|
||||||
'partner_id': self.partner1.id,
|
'partner_id': self.partner1.id,
|
||||||
@@ -135,7 +142,7 @@ class TestPicking(TransactionCase):
|
|||||||
|
|
||||||
picking = po.picking_ids
|
picking = po.picking_ids
|
||||||
for i, line in enumerate(picking.move_lines.move_line_ids):
|
for i, line in enumerate(picking.move_lines.move_line_ids):
|
||||||
line.write({'lot_name': str(i), 'qty_done': 1.0, 'lot_catch_weight_ratio': ratios[i]})
|
line.write({'lot_name': str(i), 'qty_done': 1.0, 'catch_weight': weights[i]})
|
||||||
picking.button_validate()
|
picking.button_validate()
|
||||||
self.assertEqual(picking.state, 'done')
|
self.assertEqual(picking.state, 'done')
|
||||||
|
|
||||||
@@ -147,6 +154,5 @@ class TestPicking(TransactionCase):
|
|||||||
inv.purchase_order_change()
|
inv.purchase_order_change()
|
||||||
self.assertEqual(len(inv.invoice_line_ids), 1)
|
self.assertEqual(len(inv.invoice_line_ids), 1)
|
||||||
self.assertEqual(inv.invoice_line_ids.quantity, 2.0)
|
self.assertEqual(inv.invoice_line_ids.quantity, 2.0)
|
||||||
self.assertEqual(inv.amount_total, (ratio1 * price) + (ratio2 * price))
|
self.assertAlmostEqual(inv.amount_total, price * sum(w / self.nominal_weight for w in weights))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
69
product_catch_weight/views/account_invoice_views.xml
Normal file
69
product_catch_weight/views/account_invoice_views.xml
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<record id="invoice_form_inherit" model="ir.ui.view">
|
||||||
|
<field name="name">account.invoice.form.inherit</field>
|
||||||
|
<field name="model">account.invoice</field>
|
||||||
|
<field name="inherit_id" ref="account.invoice_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//tree/field[@name='price_unit']" position="after">
|
||||||
|
<field name="catch_weight" attrs="{'invisible': [('catch_weight_uom_id', '=', False)]}"/>
|
||||||
|
<field name="catch_weight_uom_id" readonly="1" attrs="{'invisible': [('catch_weight_uom_id', '=', False)]}"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record id="invoice_supplier_form_inherit" model="ir.ui.view">
|
||||||
|
<field name="name">account.invoice.supplier.form.inherit</field>
|
||||||
|
<field name="model">account.invoice</field>
|
||||||
|
<field name="inherit_id" ref="account.invoice_supplier_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//tree/field[@name='price_unit']" position="after">
|
||||||
|
<field name="catch_weight" attrs="{'invisible': [('catch_weight_uom_id', '=', False)]}"/>
|
||||||
|
<field name="catch_weight_uom_id" readonly="1" attrs="{'invisible': [('catch_weight_uom_id', '=', False)]}"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<template id="report_invoice_document_inherit" name="report_invoice_document_catch_weight" inherit_id="account.report_invoice_document">
|
||||||
|
<xpath expr="//thead/tr/th[4]" position="after">
|
||||||
|
<t t-if="o.invoice_line_ids.filtered(lambda l: l.catch_weight_uom_id)">
|
||||||
|
<th class="text-right">Catch Weight</th>
|
||||||
|
<th class="text-right">CW Unit Price</th>
|
||||||
|
</t>
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//tbody/tr[1]/td[4]" position="after">
|
||||||
|
<t t-if="o.invoice_line_ids.filtered(lambda l: l.catch_weight_uom_id)">
|
||||||
|
<t t-if="l.catch_weight_uom_id">
|
||||||
|
<td class="text-right">
|
||||||
|
<strong t-field="l.catch_weight"/>
|
||||||
|
<span t-field="l.catch_weight_uom_id"/>
|
||||||
|
<hr style="padding: 0; margin: 0;"/>
|
||||||
|
<t t-if="o.type in ('out_invoice', 'out_refund')" t-set="lots" t-value="l.sale_line_ids.mapped('move_ids.move_line_ids.lot_id')"/>
|
||||||
|
<t t-else="" t-set="lots" t-value="l.purchase_line_id.mapped('move_ids.move_line_ids.lot_id')"/>
|
||||||
|
<ul class="list-unstyled">
|
||||||
|
<li t-foreach="lots" t-as="lot">
|
||||||
|
<span t-field="lot.name"/>: <span t-field="lot.catch_weight"/>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td class="text-right">
|
||||||
|
<span t-esc="'{:0.2f}'.format(l.uom_id._compute_price(l.price_unit, l.catch_weight_uom_id))"/>
|
||||||
|
/
|
||||||
|
<span t-field="l.catch_weight_uom_id"/>
|
||||||
|
</td>
|
||||||
|
</t>
|
||||||
|
<t t-else="">
|
||||||
|
<td/>
|
||||||
|
<td/>
|
||||||
|
</t>
|
||||||
|
</t>
|
||||||
|
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//tbody/tr[2]/td[4]" position="after">
|
||||||
|
<t t-if="o.invoice_line_ids.filtered(lambda l: l.catch_weight_uom_id)">
|
||||||
|
<td/>
|
||||||
|
<td/>
|
||||||
|
</t>
|
||||||
|
</xpath>
|
||||||
|
</template>
|
||||||
|
</odoo>
|
||||||
@@ -7,17 +7,32 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//field[@name='product_id']" position="after">
|
<xpath expr="//field[@name='product_id']" position="after">
|
||||||
<field name="catch_weight_ratio"/>
|
<field name="catch_weight_ratio"/>
|
||||||
|
<field name="catch_weight"/>
|
||||||
|
<field name="catch_weight_uom_id" readonly="1"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="view_move_line_form_inherit" model="ir.ui.view">
|
<!--<record id="view_move_line_form_inherit" model="ir.ui.view">-->
|
||||||
<field name="name">stock.move.line.form.inherit</field>
|
<!--<field name="name">stock.move.line.form.inherit</field>-->
|
||||||
<field name="model">stock.move.line</field>
|
<!--<field name="model">stock.move.line</field>-->
|
||||||
<field name="inherit_id" ref="stock.view_move_line_form" />
|
<!--<field name="inherit_id" ref="stock.view_move_line_form" />-->
|
||||||
|
<!--<field name="arch" type="xml">-->
|
||||||
|
<!--<xpath expr="//field[@name='lot_name']" position="after">-->
|
||||||
|
<!--<field name="lot_catch_weight_ratio" readonly="1"/>-->
|
||||||
|
<!--</xpath>-->
|
||||||
|
<!--</field>-->
|
||||||
|
<!--</record>-->
|
||||||
|
<record id="view_stock_move_operations_inherit" model="ir.ui.view">
|
||||||
|
<field name="name">stock.move.operations.form.inherit</field>
|
||||||
|
<field name="model">stock.move</field>
|
||||||
|
<field name="inherit_id" ref="stock.view_stock_move_operations"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//field[@name='lot_name']" position="after">
|
<xpath expr="//field[@name='location_dest_id']" position="after">
|
||||||
<field name="lot_catch_weight_ratio" readonly="1"/>
|
<field name="product_catch_weight_uom_id" invisible="1"/>
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//field[@name='move_line_ids']" position="attributes">
|
||||||
|
<attribute name="context">{'tree_view_ref': 'stock.view_stock_move_line_operation_tree', 'default_product_uom_id': product_uom, 'default_picking_id': picking_id, 'default_move_id': id, 'default_product_id': product_id, 'default_location_id': location_id, 'default_location_dest_id': location_dest_id, 'default_catch_weight_uom_id': product_catch_weight_uom_id}</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
@@ -27,8 +42,20 @@
|
|||||||
<field name="inherit_id" ref="stock.view_stock_move_line_operation_tree" />
|
<field name="inherit_id" ref="stock.view_stock_move_line_operation_tree" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//field[@name='lot_name']" position="after">
|
<xpath expr="//field[@name='lot_name']" position="after">
|
||||||
<field name="lot_catch_weight_ratio" invisible="not context.get('show_lots_text')"/>
|
<field name="catch_weight" invisible="not context.get('show_lots_text') or not context.get('show_catch_weight')"/>
|
||||||
<field name="lot_catch_weight_ratio_related" invisible="not context.get('show_lots_m2o')"/>
|
<field name="catch_weight_uom_id" invisible="not context.get('show_lots_text') or not context.get('show_catch_weight')"/>
|
||||||
|
<field name="lot_catch_weight" invisible="not context.get('show_lots_m2o') or not context.get('show_catch_weight')" readonly="1"/>
|
||||||
|
<field name="lot_catch_weight_uom_id" invisible="not context.get('show_lots_m2o') or not context.get('show_catch_weight')" readonly="1"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record id="product_template_form_view_inherit" model="ir.ui.view">
|
||||||
|
<field name="name">product.template.common.form.inherit</field>
|
||||||
|
<field name="model">product.template</field>
|
||||||
|
<field name="inherit_id" ref="product.product_template_form_view" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//field[@name='uom_po_id']" position="after">
|
||||||
|
<field name="catch_weight_uom_id" attrs="{'invisible': [('tracking', '!=', 'serial')]}" help="Leave empty to not use catch weight."/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
Reference in New Issue
Block a user