fix partner_custom

This commit is contained in:
ahmed-nouri051 2025-05-12 08:44:46 +02:00
parent c204536b56
commit 60f6a0c91c
3 changed files with 14 additions and 14 deletions

View File

@ -13,9 +13,9 @@ class ResPartner(models.Model):
('iqama', 'Iqama'),
('passport', 'Passport'),
('other', 'Other')], default='id',string='Identification Type')
identification_number = fields.Char(string='Identification NUmber')
identification_number = fields.Char(string='Identification NUmber',copy=False)
identification_issue_date = fields.Date(string='Identification Issue Date')
identification_expiry_date = fields.Date(string='Identification Expiry Date')
identification_expiry_date = fields.Date(string='Identification Expiry Date',copy=False)
issuer = fields.Char(string='Issuer')
copy_no = fields.Integer(string='Copy No')
@ -23,9 +23,9 @@ class ResPartner(models.Model):
def check_expr_date(self):
for each in self:
if each.identification_expiry_date:
exp_date = fields.Date.from_string(each.identification_expiry_date)
if exp_date < date.today():
raise Warning(_('Your Document Is Expired.'))
exp_date = fields.Date.from_string(each.identification_expiry_date)
if exp_date < date.today():
raise Warning(_('Your Document Is Expired.'))
if each.identification_type == 'id':
if each.identification_number and len(each.identification_number) != 10:
@ -46,12 +46,12 @@ class ResPartner(models.Model):
if date.today() >= each.identification_expiry_date:
raise Warning(_("Error, the expiry date must be greater than the date of the day"))
@api.constrains('phone')
def _check_phone_length_and_digits(self):
for record in self:
if record.phone:
if not record.phone.isdigit() or len(record.phone) != 10:
raise ValidationError(_("The phone number must contain exactly 10 digits and no letters or symbols."))
# @api.constrains('mobile')
# def _check_phone_length_and_digits(self):
# for record in self:
# if record.mobile:
# if not record.mobile.isdigit() or len(record.mobile) != 10:
# raise ValidationError(_("The mobile number must contain exactly 10 digits and no letters or symbols."))
@api.constrains('email')

View File

@ -2,8 +2,8 @@
<odoo>
<record id="sale_purchase_tab" model="res.groups">
<field name="name">Sale/Purchase Tab</field>
<record id="sale_purchase_group" model="res.groups">
<field name="name">Sale/Purchase</field>
<field name="category_id" ref="dev_membership.membership_category"/>
</record>
</odoo>

View File

@ -30,7 +30,7 @@
</page>
</xpath>
<xpath expr="//page[@name='sales_purchases']" position="attributes">
<attribute name="groups">partner_custom.sale_purchase_tab</attribute>
<attribute name="groups">partner_custom.sale_purchase_group</attribute>
</xpath>
</field>