Browse Source

[TASK 0044_b] Gestion des shifts : visualiser le créneau sur la fiche du membre régulier + [ADD] Tab worker information for all information linked with the work in the cooperative + [ADD] share type for beescoop + [ADD] Specific module that make the link between beesdoo and easy_my_coop : compute the share_type base on the share bought

pull/15/head
Thibault Francois 8 years ago
parent
commit
b8cd7c008a
  1. 1
      beesdoo_base/models/partner.py
  2. 6
      beesdoo_base/views/partner.xml
  3. 2
      beesdoo_easy_my_coop/__init__.py
  4. 30
      beesdoo_easy_my_coop/__openerp__.py
  5. 23
      beesdoo_easy_my_coop/data/product_share.xml
  6. 1
      beesdoo_easy_my_coop/models/__init__.py
  7. 14
      beesdoo_easy_my_coop/models/res_partner.py
  8. 2
      beesdoo_shift/models/cooperative_status.py
  9. 18
      beesdoo_shift/views/cooperative_status.xml

1
beesdoo_base/models/partner.py

@ -20,6 +20,7 @@ class Partner(models.Model):
member_card_to_be_printed = fields.Boolean('Print BEES card?')
last_printed = fields.Datetime('Last printed on')
share_type = fields.Selection([('share_a', 'Share A'), ('share_b', 'Share B'), ('share_c', 'Share C')])
@api.onchange('first_name', 'last_name')

6
beesdoo_base/views/partner.xml

@ -27,14 +27,17 @@
default_focus="1" />
</field>
<field name="website" position="after">
<field name="share_type" invisible="1"/>
<field name="eater" attrs="{'invisible': [('customer', '=', False)]}" />
<field name="parent_eater_id" attrs="{'invisible' : [('eater', '!=', 'eater')]}" />
</field>
<xpath expr="//notebook" position="inside">
<page string="Worker information" attrs="{'invisible': [('share_type', '!=', 'share_a')]}" name="work">
<group name="info_session" />
</page>
<page string="Member Card"
attrs="{'invisible': ['|', ('customer', '=', False), ('eater', '!=', 'worker_eater')]}">
<group>
<group name="info_session" />
<group>
<field name="member_card_to_be_printed" />
<field name="last_printed" />
@ -63,6 +66,7 @@
type="action" />
</group>
</page>
</xpath>
<field name="barcode" position="attributes">
<attribute name="attrs">{'invisible' : [('eater', '!=',

2
beesdoo_easy_my_coop/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
import models

30
beesdoo_easy_my_coop/__openerp__.py

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
{
'name': "Beescoop link with easy my coop",
'summary': """
Module that made the link between beesdoo customization and easy_my_coop
""",
'description': """
""",
'author': "Beescoop - Cellule IT",
'website': "https://github.com/beescoop/Obeesdoo",
# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xml
# for the full list
'category': 'Cooperative management',
'version': '1.0',
# any module necessary for this one to work correctly
'depends': ['beesdoo_base', 'beesdoo_shift', 'easy_my_coop'],
# always loaded
'data': [
'data/product_share.xml',
],
# only loaded in demonstration mode
}

23
beesdoo_easy_my_coop/data/product_share.xml

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="share_a" model="product.template" >
<field name="name">Acquisition de parts A de Beescoop scrl</field>
<field name="default_code">share_a</field>
<field name="customer" eval="True" />
<field name="is_share" eval="True" />
</record>
<record id="share_b" model="product.template" >
<field name="name">Acquisition de parts B de Beescoop scrl</field>
<field name="default_code">share_b</field>
<field name="customer" eval="True" />
<field name="is_share" eval="True" />
</record>
<record id="share_c" model="product.template" >
<field name="name">Acquisition de parts C de Beescoop scrl</field>
<field name="default_code">share_c</field>
<field name="customer" eval="False" />
<field name="is_share" eval="True" />
</record>
</data>
</odoo>

1
beesdoo_easy_my_coop/models/__init__.py

@ -0,0 +1 @@
import res_partner

14
beesdoo_easy_my_coop/models/res_partner.py

@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
from openerp import models, fields, api, _
class Partner(models.Model):
_inherit = 'res.partner'
share_type = fields.Selection(compute='_get_share_product_type')
@api.multi
@api.depends('share_ids', 'share_ids.share_product_id', 'share_ids.share_product_id.default_code')
def _get_share_product_type(self):
for rec in self:
codes = rec.share_ids.mapped('share_product_id.default_code')
rec.share_type = codes[0] if codes else ''

2
beesdoo_shift/models/cooperative_status.py

@ -44,7 +44,7 @@ class ResPartner(models.Model):
info_session = fields.Boolean(related='cooperative_status_ids.info_session', string='Information Session ?', readonly=True, store=True)
info_session_date = fields.Datetime(related='cooperative_status_ids.info_session_date', string='Information Session Date', readonly=True, store=True)
working_mode = fields.Selection(related='cooperative_status_ids.working_mode', readonly=True, store=True)
subscribed_shift_ids = fields.Many2many('beesdoo.shift.template')
@api.multi
def coop_subscribe(self):
return {

18
beesdoo_shift/views/cooperative_status.xml

@ -8,18 +8,24 @@
<header>
<button name="coop_subscribe" string="Subscribe to shift" class="oe_highlight"
type="object" groups="beesdoo_shift.group_shift_management"
attrs="{'invisible': [('eater', '!=', 'worker_eater')]}"/>
attrs="{'invisible': [('share_type', '!=', 'share_a')]}"/>
</header>
</xpath>
<field name="eater" position="after">
<field name="super" />
<field name="working_mode" />
</field>
<group name="info_session" position="inside">
<page name="work" position="inside">
<group>
<group>
<field name="info_session" />
<field name="info_session_date"
attrs="{'invisible': ['|', ('info_session', '=', False)]}" />
</group>
<group>
<field name="working_mode" />
<field name="super" />
</group>
</group>
<separator string="Subscribed Shift" />
<field name="subscribed_shift_ids" />
</page>
</field>
</record>

Loading…
Cancel
Save