Browse Source

[IMP] b_emc: Merge emc_eater into b_emc

pull/134/head
Rémy Taymans 5 years ago
parent
commit
d8c8837ed3
  1. 4
      beesdoo_easy_my_coop/__manifest__.py
  2. 1
      beesdoo_easy_my_coop/models/__init__.py
  3. 31
      beesdoo_easy_my_coop/models/coop.py
  4. 4
      beesdoo_easy_my_coop/models/product.py
  5. 7
      beesdoo_easy_my_coop/views/product.xml

4
beesdoo_easy_my_coop/__manifest__.py

@ -9,7 +9,7 @@
'description': """
""",
'author': "Beescoop - Cellule IT",
'author': "BEES coop, Coop IT Easy",
'website': "https://github.com/beescoop/Obeesdoo",
'category': 'Cooperative management',
@ -18,8 +18,8 @@
'depends': ['beesdoo_base',
'beesdoo_shift',
'easy_my_coop',
'easy_my_coop_eater',
'easy_my_coop_website',
'partner_age',
],
'data': [

1
beesdoo_easy_my_coop/models/__init__.py

@ -2,3 +2,4 @@ from . import res_partner
from . import subscription_request
from . import res_company
from . import product
from . import coop

31
beesdoo_easy_my_coop/models/coop.py

@ -0,0 +1,31 @@
from odoo import api, models
class SubscriptionRequest(models.Model):
_inherit = "subscription.request"
_majority = 18
def get_eater_vals(self, partner, share_product_id):
vals = {}
eater = share_product_id.eater
if partner.is_company or partner.age < self._majority:
eater = "eater"
vals["eater"] = eater
return vals
@api.one
def validate_subscription_request(self):
invoice = super(
SubscriptionRequest, self
).validate_subscription_request()[0]
partner = invoice.partner_id
vals = self.get_eater_vals(partner, self.share_product_id)
partner.write(vals)
return invoice

4
beesdoo_easy_my_coop/models/product.py

@ -20,3 +20,7 @@ class ProductTemplate(models.Model):
"shift system."
)
)
eater = fields.Selection(
[("eater", "Eater"), ("worker_eater", "Worker and Eater")],
string="Eater/Worker",
)

7
beesdoo_easy_my_coop/views/product.xml

@ -6,8 +6,11 @@
<field name="inherit_id" ref="easy_my_coop.product_template_share_form_view"/>
<field name="arch" type="xml">
<field name="customer" position="after">
<field name="allow_working"/>
<field name="max_nb_eater_allowed"/>
<field name="allow_working" attrs="{'invisible':[('is_share','=',False)]}"/>
<field name="max_nb_eater_allowed" attrs="{'invisible':[('is_share','=',False)]}"/>
</field>
<field name="minimum_quantity" position="after">
<field name="eater" attrs="{'invisible':[('is_share','=',False)]}"/>
</field>
</field>
</record>

Loading…
Cancel
Save