Browse Source

[IMP] move the flag become client to easy_my_coop_base

pull/1/head
houssine 6 years ago
parent
commit
f214882447
  1. 6
      easy_my_coop/models/coop.py
  2. 1
      easy_my_coop/models/product.py
  3. 1
      easy_my_coop/view/product_view.xml
  4. 3
      easy_my_coop_eater/models/coop.py
  5. 1
      easy_my_coop_eater/models/product.py
  6. 1
      easy_my_coop_eater/view/product_view.xml

6
easy_my_coop/models/coop.py

@ -234,7 +234,7 @@ class subscription_request(models.Model):
partner_vals = {'name':self.company_name, 'is_company': self.is_company,
'company_register_number':self.company_register_number, 'customer':False,
'cooperator':True, 'street':self.address, 'zip':self.zip_code,
'city': self.city,'email':self.email, 'out_inv_comm_type':'bba',
'city': self.city,'email':self.email, 'out_inv_comm_type':'bba','customer': share_product_id.customer,
'out_inv_comm_algorithm':'random', 'country_id': self.country_id.id, 'lang':self.lang}
return partner_vals
@ -244,7 +244,7 @@ class subscription_request(models.Model):
'city': self.city, 'phone': self.phone, 'email':self.email,
'national_register_number':self.no_registre, 'out_inv_comm_type':'bba',
'out_inv_comm_algorithm':'random', 'country_id': self.country_id.id,
'lang':self.lang, 'birthdate':self.birthdate}
'lang':self.lang, 'birthdate':self.birthdate, 'customer': share_product_id.customer}
return partner_vals
def create_coop_partner(self):
@ -275,7 +275,7 @@ class subscription_request(models.Model):
user.sudo().with_context({'create_user': True}).action_reset_password()
return True
@api.one
def validate_subscription_request(self):
partner_obj = self.env['res.partner']

1
easy_my_coop/models/product.py

@ -12,6 +12,7 @@ class ProductTemplate(models.Model):
force_min_qty = fields.Boolean(String="Force minimum quantity?")
by_company = fields.Boolean(string="Can be subscribed by companies?")
by_individual = fields.Boolean(string="Can be subscribed by individuals?")
customer = fields.Boolean(string='Become customer')
@api.multi
def get_web_share_products(self, is_company):

1
easy_my_coop/view/product_view.xml

@ -28,6 +28,7 @@
<field name="default_share_product" attrs="{'invisible':[('is_share','=',False)]}" groups="easy_my_coop.group_energiris_user"/>
<field name="force_min_qty" attrs="{'invisible':[('is_share','=',False)]}" groups="easy_my_coop.group_energiris_user"/>
<field name="minimum_quantity" attrs="{'invisible':[('is_share','=',False)]}" groups="easy_my_coop.group_energiris_user"/>
<field name="customer" attrs="{'invisible':[('is_share','=',False)]}"/>
<field name="by_company" attrs="{'invisible':[('is_share','=',False)]}" groups="easy_my_coop.group_energiris_user"/>
<field name="by_individual" attrs="{'invisible':[('is_share','=',False)]}" groups="easy_my_coop.group_energiris_user"/>
</xpath>

3
easy_my_coop_eater/models/coop.py

@ -8,11 +8,10 @@ class subscription_request(models.Model):
vals = {}
eater = share_product_id.eater
if partner.is_company or partner.age < 18:
if partner.is_company or partner.age < 18:
eater = 'eater'
vals['eater'] = eater
vals['customer'] = share_product_id.customer
return vals

1
easy_my_coop_eater/models/product.py

@ -4,5 +4,4 @@ from openerp import api, fields, models, _
class ProductTemplate(models.Model):
_inherit = 'product.template'
customer = fields.Boolean(string='Become customer')
eater = fields.Selection([('eater', 'Eater'), ('worker_eater', 'Worker and Eater')], string="Eater/Worker")

1
easy_my_coop_eater/view/product_view.xml

@ -6,7 +6,6 @@
<field name="inherit_id" ref="easy_my_coop.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='minimum_quantity']" position="after">
<field name="customer" attrs="{'invisible':[('is_share','=',False)]}"/>
<field name="eater" attrs="{'invisible':[('is_share','=',False)]}"/>
</xpath>
</field>

Loading…
Cancel
Save