Skip to Content
Menú
This question has been flagged
1 Respondre
505 Vistes

​ created a module named Custom_ETA_Module in my openerp 1 7 and the it has been installed successfully and is working fine now.The only issue is the existing field labels in the formview of purchzse module are not displayed.What might be the reason for this.I searched for a long but the solution is not yet available.The module files are :

View.xml
<odoo>
<record id="view_purchase_order_form_inherited" model="ir.ui.view">
<field name="name">purchase.order.form.inherited</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<!-- Insert fields after 'currency_id' while keeping the labels -->
<xpath expr="//field[@name='currency_id']" position="after">
<group string="ETA Container Information" colspan="2">
<group>
<field name="eta_pcd1" nolabel="0"/>
<field name="eta_pcd2" nolabel="0"/>
<field name="eta_pcd3" nolabel="0"/>
</group>
<group>
<field name="container_1" nolabel="0" placeholder="Enter Container 1"/>
<field name="container_2" nolabel="0" placeholder="Enter Container 2"/>
<field name="container_3" nolabel="0" placeholder="Enter Container 3"/>
</group>
</group>
</xpath>
</field>
</record>
</odoo>
Module.py
from odoo import models, fields, api
import re
from odoo.exceptions import ValidationError


class PurchaseOrder(models.Model):
_inherit = "purchase.order"

eta_pcd1 = fields.Date(string="ETA / PCD1", oldname="x_studio_eta_pcd1")
eta_pcd2 = fields.Date(string="ETA / PCD2", oldname="x_studio_eta_pcd2")
eta_pcd3 = fields.Date(string="ETA / PCD3", oldname="x_studio_eta_pcd3")

container_1 = fields.Char(string="Container 1", oldname="x_studio_container_1")
container_2 = fields.Char(string="Container 2", oldname="x_studio_container_2")
container_3 = fields.Char(string="Container 3", oldname="x_studio_container_1_1")

@api.constrains('container_1', 'container_2', 'container_3')
def _check_container_format(self):
pattern = re.compile(r'^[A-Za-z0-9]+$')
for record in self:
if record.container_1 and not pattern.match(record.container_1):
raise ValidationError("Container 1 can only contain letters and digits.")
if record.container_2 and not pattern.match(record.container_2):
raise ValidationError("Container 2 can only contain letters and digits.")
if record.container_3 and not pattern.match(record.container_3):
raise ValidationError("Container 3 can only contain letters and digits.")

  • Manifest :
    {
    "name": "Custom ETA Module",
    "version": "1.0",
    "summary": "Module for managing ETA and container details in purchase orders",
    "description": "Adds custom ETA and container tracking fields in the purchase order form.",
    "author": "Your Name",
    "category": "Purchase",
    "depends": ["purchase"],
    "data": [
    "security/ir.model.access.csv",
    "views/eta_model_views.xml"
    ],
    "installable": True,
    "application": False
    }


Avatar
Descartar
Best Answer

Try by removing the "no_label=0" it might remove the String of the field in the View that may be the reason you cant able to see the fields in the view.


Avatar
Descartar
Related Posts Respostes Vistes Activitat
1
de febr. 25
37
1
de gen. 25
498
2
de des. 24
703
0
de des. 24
426
0
de des. 24
677