Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
from odoo import models, fields, api
class OCRReceipt(models.Model):
_name = 'thaiocr.receipt'
_description = 'Thai OCR Module'
_order = 'date_billed desc, name'
<!-- custom search -->
<record model="ir.ui.view" id="thaiocr_search">
<field name="name">Thai OCR Search</field>
<field name="model">thaiocr.receipt</field>
<field name="arch" type="xml">
<search>
<field name="name"/>
<field name="purchaser_id"/>
<filter string="No Purchaser"
name="without_purchaser"
<!-- explicit form view definition -->
<record model="ir.ui.view" id="thaiocr_form">
<field name="name">Thai OCR</field>
<field name="model">thaiocr.receipt</field>
<field name="arch" type="xml">
<form>
<group>
<field name="name"/>
<field name="product_ids"/>
</group>
<record model="ir.ui.view" id="thaiocr_list">
<field name="name">Thai OCR</field>
<field name="model">thaiocr.receipt</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="store_id"/>
<field name="date_billed"/>
<field name="purchaser_id"/>
</tree>
<!-- actions opening views on models -->
<record model="ir.actions.act_window" id="thaiocr_action_window">
<field name="name">Thai OCR</field>
<field name="res_model">thaiocr.receipt</field>
<field name="view_mode">tree,form</field>
</record>
<!-- Top menu item -->
<menuitem name="Thai OCR" id="thaiocr_menu_root" action="thaiocr_action_window"/>
class OCRReceipt(models.Model):
_name = 'thaiocr.receipt'
name = fields.Char('Receipt Title', required=True)
date_billed = fields.Date('Billed On')
store_id = fields.Many2one('res.partner',
string='Store',
index=True)
purchaser_id = fields.Many2one('res.partner',
string='Purchaser',
index=True)
[options]
#
# WARNING:
# If you use the Odoo Database utility to change the master password be aware
# that the formatting of this file WILL be LOST! A copy of this file named
# /etc/odoo/openerp-server.conf.template has been made in case this happens
# Note that the copy does not have any first boot changes
#-----------------------------------------------------------------------------
# Odoo Server Config File - TurnKey Linux