Hello,
I've created a Custom Field (size_of_pieces) in the Manufacturing Order screen and another Customer field (size_of_pieces_inv) in the Inventory Transfers screen.
When the user enters a value for: size_of_pieces I want size_of_pieces_inv to automatically take that value. How would I go about doing that?
My Code:
models.py :
# -*- coding: utf-8 -*-
from odoo import models, fields, api
class mo_screen(models.Model):
_inherit = 'mrp.production'
size_of_pieces = fields.Char(string='Size of Pieces', store=True, readonly=False)
class inv_screen(models.Model):
_inherit = 'stock.picking'
size_of_pieces_inv = fields.Many2one('mo.screen', string='Size of Pieces', store=True, readonly=False)
views.xml :
<odoo>
<data>
<record id="mrp_production_form_view_inherits" model="ir.ui.view">
<field name="name">mrp.production.form</field>
<field name="model">mrp.production</field>
<field name="priority" eval="40"/>
<field name="inherit_id" ref="mrp.mrp_production_form_view"/>
<field name="arch" type="xml">
<xpath expr="//form/sheet/group/group/field[@name='bom_id']" position="after">
<field name="size_of_pieces"/>
</xpath>
</field>
</record>
</data>
</odoo>
inv_views.xml :
<odoo>
<data>
<record id="view_picking_form_inherit" model="ir.ui.view">
<field name="name">stock.picking.form.inherit</field>
<field name="model">stock.picking</field>
<field name="priority" eval="40"/>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<xpath expr="//group/group/field[@name='picking_type_id']" position="after">
<field name="size_of_pieces_inv"/>
</xpath>
</field>
</record>
</data>
</odoo>
Any help is appreciated, thanks in advance!