Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
5379 Lượt xem

I develop new module 

and i have  Char field`cont_no` how make it searchable in database if entred exsist (like many2one autocomplate)

Model.py

`


class RealContract(models.Model):
_name = 'real.contracts'
_sql_constraints = [
('contract_no_unique', 'unique (cont_no)', 'You Enter Number Already exsist! \n Contract Number Must be Unique!')]
cont_no = fields.Char('Contract No.', index=True, search='_search_function',
filter_domain="[('cont_no','ilike',self)]", required=True)
real_id = fields.Many2one('real.realstate', 'Real State.', ondelete='restrict')

`

view.xml

`

<record model="ir.ui.view" id="real.contract_form">
<
field name="name">Contracts Form</field>
<
field name="model">real.contracts</field>
<
field name="arch" type="xml">
<
form>
<
sheet>
<
group>
<
field name="cont_no" filter_domain="[('cont_no','ilike',self)]"/>
         </group>
</
sheet>
</
form>
</
field>
</
record>

`

how do it?

Thanks

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

Please see this free module and see whether this newly added widget satisfy your need.

Module: Auto Fill Widget


Thanks

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 7 15
3799
1
thg 10 18
15342
1
thg 5 25
752
1
thg 4 15
6884
2
thg 3 15
5720