commit
4c94de7443
|
|
@ -0,0 +1,2 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from . import models
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
'name': "partner_custom",
|
||||
|
||||
'summary': """
|
||||
Short (1 phrase/line) summary of the module's purpose, used as
|
||||
subtitle on modules listing or apps.openerp.com""",
|
||||
|
||||
'description': """
|
||||
Long description of module's purpose
|
||||
""",
|
||||
|
||||
'author': "My Company",
|
||||
'website': "http://www.yourcompany.com",
|
||||
|
||||
# Categories can be used to filter modules in modules listing
|
||||
# Check https://github.com/odoo/odoo/blob/15.0/odoo/addons/base/data/ir_module_category_data.xml
|
||||
# for the full list
|
||||
'category': 'Uncategorized',
|
||||
'version': '0.1',
|
||||
|
||||
# any module necessary for this one to work correctly
|
||||
'depends': ['base'],
|
||||
|
||||
# always loaded
|
||||
'data': [
|
||||
# 'security/ir.model.access.csv',
|
||||
'views/views.xml',
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import models
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
import base64
|
||||
import re
|
||||
from odoo import models, fields, api, exceptions, tools, _
|
||||
from datetime import datetime, date, timedelta
|
||||
from odoo.exceptions import Warning
|
||||
|
||||
from odoo.modules.module import get_module_resource
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
identification_type = fields.Selection([('id', 'National ID'),
|
||||
('iqama', 'Iqama'),
|
||||
('passport', 'Passport'),
|
||||
('other', 'Other')], default='id',string='Identification Type')
|
||||
identification_number = fields.Char(string='Identification NUmber')
|
||||
identification_issue_date = fields.Date(string='Identification Issue Date')
|
||||
identification_expiry_date = fields.Date(string='Identification Expiry Date')
|
||||
issuer = fields.Char(string='Issuer')
|
||||
copy_no = fields.Integer(string='Copy No')
|
||||
|
||||
@api.constrains('identification_expiry_date','identification_type','identification_number', 'identification_issue_date')
|
||||
def check_expr_date(self):
|
||||
for each in self:
|
||||
if self.identification_expiry_date:
|
||||
exp_date = fields.Date.from_string(each.identification_expiry_date)
|
||||
if exp_date < date.today():
|
||||
raise Warning('Your Document Is Expired.')
|
||||
if self.identification_type=='id':
|
||||
if len(self.identification_number) != 10:
|
||||
raise Warning(_('Saudi ID must be 10 digits'))
|
||||
if self.identification_number[0] != '1':
|
||||
raise Warning(_('The Saudi ID number should begin with 1'))
|
||||
|
||||
if self.identification_type=='iqama':
|
||||
if len(self.identification_number) != 10:
|
||||
raise Warning(_('Identity must be 10 digits'))
|
||||
if self.identification_number[0] != '2' and self.identification_number[0] != '4' and self.identification_number[0] != '3':
|
||||
raise Warning(_('Identity must begin with 2 or 3 or 4'))
|
||||
|
||||
if self.identification_expiry_date and self.identification_issue_date:
|
||||
|
||||
if self.identification_expiry_date <= self.identification_issue_date:
|
||||
raise Warning(_('Error, date of issue must be less than expiry date'))
|
||||
|
||||
if date.today() >= self.identification_expiry_date:
|
||||
raise Warning(_("Error,the expiry date must be greater than the date of the day"))
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<record model="ir.ui.view" id="partner_view_property_cusotm">
|
||||
<field name="name">partner.view.property</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[1]" position="after">
|
||||
<page name="personal_info" string='Personal Information'>
|
||||
<group>
|
||||
<group name="identifcation_info">
|
||||
<field name="identification_type"
|
||||
attrs="{'invisible':[('company_type', '=', 'company')], 'required':[('company_type', '!=', 'company')]}"/>
|
||||
<field name="identification_number"
|
||||
attrs="{'invisible':[('company_type', '=', 'company')], 'required':[('company_type', '!=', 'company')]}"/>
|
||||
<field name="issuer"
|
||||
attrs="{'invisible':[('company_type', '=', 'company')], 'required':[('company_type', '!=', 'company')]}"/>
|
||||
<field name="identification_issue_date"
|
||||
attrs="{'invisible':[('company_type', '=', 'company')], 'required':[('company_type', '!=', 'company')]}"/>
|
||||
<field name="identification_expiry_date"
|
||||
attrs="{'invisible':[('company_type', '=', 'company')]}"/>
|
||||
<field name="copy_no"
|
||||
attrs="{'invisible':['|',('company_type', '=', 'company'),('identification_type','!=','iqama')], 'required':[('company_type', '!=', 'company')]}"/>
|
||||
|
||||
</group>
|
||||
|
||||
</group>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
Loading…
Reference in New Issue