Reputation: 1
I'm trying to add a field to a Sales view. The view is the stock.picking.form under the Detailed Operations page. That page renders the field move_line_ids_without_package
using the tree_view_ref
context of stock.view_stock_move_line_detailed_operation_tree
The field I'm trying to add to the tree is a simple Boolean field, the field populates the correct values and see no issue there.
class StockMoveLine(models.Model):
_inherit = 'stock.move.line'
all_done = fields.Boolean(string="Check", compute="_check_done")
@api.depends_context('product_uom_qty', 'qty_done')
def _check_done(self):
for move_line in self:
if move_line.product_uom_qty == 0 and move_line.qty_done != 0:
move_line.all_done = True
else:
move_line.all_done = False
I extended the view correctly, I see it under the list of views and even under the inherited views
of the view used in the fields, tree_view_ref
context.
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="stock_move_line_tree_view_inherit" model="ir.ui.view">
<field name="name">stock.move.line.tree.inherit</field>
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_id']" position="before">
<field name="all_done" readonly="1"/>
</xpath>
</field>
</record>
</odoo>
But even with all that, I am not seeing the field being added to the view. No errors or the such are being thrown by Odoo.
Here in Detailed Operations page before the Product column I wish to add my boolean checkmark field:
Upvotes: 0
Views: 695
Reputation: 1
Obviously a hard one
On Odoo studio, it xpath on the mother view and write the sub tree and the form directly in the field so the ref view is the ignore. Sure it work, but what about upgrade, but Studio is a Enterprise feature with garantee to upgrade so, if some one got a better solution, I suggest doint the same, xpath mother view to define the tree and the form of the children datas
Upvotes: 0