From 44bf62e38d6fcbb3de7438385156f9be2e4caeec Mon Sep 17 00:00:00 2001 From: houssine Date: Tue, 29 Jan 2019 10:28:21 +0100 Subject: [PATCH] [IMP] turn some fields mandatory --- easy_my_coop/models/coop.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/easy_my_coop/models/coop.py b/easy_my_coop/models/coop.py index 83c2e23..d452bc7 100644 --- a/easy_my_coop/models/coop.py +++ b/easy_my_coop/models/coop.py @@ -152,26 +152,32 @@ class subscription_request(models.Model): ('cancelled', 'Cancelled'), ('paid', 'paid')], string='State', required=True, default="draft") - email = fields.Char(string='Email') + email = fields.Char(string='Email', required=True) iban = fields.Char(string='Account Number') partner_id = fields.Many2one('res.partner', string='Cooperator') share_product_id = fields.Many2one('product.product', string='Share type', - domain=[('is_share', '=', True)]) + domain=[('is_share', '=', True)], + required=True) share_short_name = fields.Char(related='share_product_id.short_name', string='Share type name') share_unit_price = fields.Float(related='share_product_id.list_price', string='Share price') subscription_amount = fields.Float(compute='_compute_subscription_amount', string='Subscription amount') - ordered_parts = fields.Integer(string='Number of Share') - address = fields.Char(string='Address') - city = fields.Char(string='City') - zip_code = fields.Char(string='Zip Code') + ordered_parts = fields.Integer(string='Number of Share', + required=True) + address = fields.Char(string='Address', + required=True) + city = fields.Char(string='City', + required=True) + zip_code = fields.Char(string='Zip Code', + required=True) country_id = fields.Many2one('res.country', string='Country', - ondelete='restrict') + ondelete='restrict', + required=True) phone = fields.Char(string='Phone') no_registre = fields.Char(string='National Register Number') user_id = fields.Many2one('res.users', @@ -189,8 +195,10 @@ class subscription_request(models.Model): " a passport") lang = fields.Selection(_lang_get, string='Language', + required=True, default=lambda self: self.env['res.company']._company_default_get().default_lang_id.code) date = fields.Date(string='Subscription date request', + required=True, default=lambda self: datetime.strftime(datetime.now(), '%Y-%m-%d')) company_id = fields.Many2one('res.company', string='Company', required=True, change_default=True,