Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
8438 มุมมอง

From the Accounting -> supp/cuastomer payments, journal entry is mandatory field. I want to remove that constraint by inheriting the module "account.voucher". How can i do this?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Journal entry field is not a mandatory field in customer/supplier payments. It is many2one field account.move object and that is automatically created on Validating the payment. If you are talking about Journal field, then we cannot make that field non-mandatory as this field is a mandatory field in journal entry which is created automatically on Validation.

 

Mandatory fields we are giving in two ways. Either in python file on field declaration or in xml file. If required=True is given in python file, we have to rewrite the field in our module without giviong required attribute. If it is given in xml file, we have to inherit and change the attribute.

<xpath expr="//field[@name='field_name']" position="attributes">
                    <attribute name="required">0</attribute>
                </xpath>

 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Mandatory fields we are giving in two ways. Either in python file on field declaration or in xml file. If required=True is given in python file, we have to rewrite the field in our module without giviong required attribute. If it is given in xml file, we have to inherit and change the attribute.

<xpath expr="//field[@name='field_name']" position="attributes">
                    <attribute name="required">0</attribute>
                </xpath>

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

If You want to remove the mandatory field then

copy the original column fields in your customer model change the fields parameter required=False

Example

class class_name(osv.osv):
    _inherit = "model.name"
    _columns = {

      'col_name'      : fields.char('Name', size=120, required=False),
    }

class_name()

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Remove NOT NULL Constraint in Product แก้ไขแล้ว
2
พ.ย. 22
6000
Sql constraint for boolean field แก้ไขแล้ว
2
ก.ย. 18
6841
2
ส.ค. 17
4088
2
ก.ค. 17
6229
9
มี.ค. 16
60735