콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
1698 화면

​ 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
    }


아바타
취소
베스트 답변

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.


아바타
취소
관련 게시물 답글 화면 활동
3
7월 25
1977
1
6월 25
2293
2
5월 25
1963
1
5월 25
1183
1
2월 25
38