Browse Source

[IMP] turn some fields mandatory

pull/1/head
houssine 6 years ago
parent
commit
44bf62e38d
  1. 22
      easy_my_coop/models/coop.py

22
easy_my_coop/models/coop.py

@ -152,26 +152,32 @@ class subscription_request(models.Model):
('cancelled', 'Cancelled'), ('cancelled', 'Cancelled'),
('paid', 'paid')], ('paid', 'paid')],
string='State', required=True, default="draft") string='State', required=True, default="draft")
email = fields.Char(string='Email')
email = fields.Char(string='Email', required=True)
iban = fields.Char(string='Account Number') iban = fields.Char(string='Account Number')
partner_id = fields.Many2one('res.partner', partner_id = fields.Many2one('res.partner',
string='Cooperator') string='Cooperator')
share_product_id = fields.Many2one('product.product', share_product_id = fields.Many2one('product.product',
string='Share type', string='Share type',
domain=[('is_share', '=', True)])
domain=[('is_share', '=', True)],
required=True)
share_short_name = fields.Char(related='share_product_id.short_name', share_short_name = fields.Char(related='share_product_id.short_name',
string='Share type name') string='Share type name')
share_unit_price = fields.Float(related='share_product_id.list_price', share_unit_price = fields.Float(related='share_product_id.list_price',
string='Share price') string='Share price')
subscription_amount = fields.Float(compute='_compute_subscription_amount', subscription_amount = fields.Float(compute='_compute_subscription_amount',
string='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', country_id = fields.Many2one('res.country',
string='Country', string='Country',
ondelete='restrict')
ondelete='restrict',
required=True)
phone = fields.Char(string='Phone') phone = fields.Char(string='Phone')
no_registre = fields.Char(string='National Register Number') no_registre = fields.Char(string='National Register Number')
user_id = fields.Many2one('res.users', user_id = fields.Many2one('res.users',
@ -189,8 +195,10 @@ class subscription_request(models.Model):
" a passport") " a passport")
lang = fields.Selection(_lang_get, lang = fields.Selection(_lang_get,
string='Language', string='Language',
required=True,
default=lambda self: self.env['res.company']._company_default_get().default_lang_id.code) default=lambda self: self.env['res.company']._company_default_get().default_lang_id.code)
date = fields.Date(string='Subscription date request', date = fields.Date(string='Subscription date request',
required=True,
default=lambda self: datetime.strftime(datetime.now(), '%Y-%m-%d')) default=lambda self: datetime.strftime(datetime.now(), '%Y-%m-%d'))
company_id = fields.Many2one('res.company', string='Company', required=True, company_id = fields.Many2one('res.company', string='Company', required=True,
change_default=True, change_default=True,

Loading…
Cancel
Save