Browse Source

[ADD] macavrac_base module.

(+ small cleans on beesdoo_website_shift)
pull/143/head
odoo-pda 5 years ago
parent
commit
3aae0fa025
  1. 0
      beesdoo_website_shift/__manifest__.py
  2. 13
      beesdoo_website_shift/controllers/main.py
  3. 8
      beesdoo_website_shift/data/res_config_data.xml
  4. 2
      beesdoo_website_shift/models/res_config.py
  5. 4
      beesdoo_website_shift/views/my_shift_website_templates.xml
  6. 4
      beesdoo_website_shift/views/res_config_views.xml
  7. 2
      beesdoo_worker_status/models/cooperative_status.py
  8. 1
      macavrac_base/__init__.py
  9. 23
      macavrac_base/__manifest__.py
  10. 1
      macavrac_base/models/__init__.py
  11. 49
      macavrac_base/models/res_partner.py
  12. 31
      macavrac_base/views/res_partner.xml

0
beesdoo_website_shift/__openerp__.py → beesdoo_website_shift/__manifest__.py

13
beesdoo_website_shift/controllers/main.py

@ -9,11 +9,10 @@ from datetime import datetime, timedelta
from itertools import groupby from itertools import groupby
from pytz import timezone, utc from pytz import timezone, utc
from openerp import http, fields
from openerp.http import request
from odoo import http, fields
from odoo.http import request
from openerp.addons.beesdoo_shift.models.planning import float_to_time
from openerp.addons.beesdoo_shift.models.cooperative_status import PERIOD
from odoo.addons.beesdoo_shift.models.planning import float_to_time
class WebsiteShiftController(http.Controller): class WebsiteShiftController(http.Controller):
@ -408,6 +407,8 @@ class WebsiteShiftController(http.Controller):
# Get config # Get config
regular_next_shift_limit = int(request.env['ir.config_parameter'].get_param( regular_next_shift_limit = int(request.env['ir.config_parameter'].get_param(
'beesdoo_website_shift.regular_next_shift_limit')) 'beesdoo_website_shift.regular_next_shift_limit'))
shift_period = int(request.env['ir.config_parameter'].get_param(
'beesdoo_website_shift.shift_period'))
for i in range(nb_subscribed_shifts, regular_next_shift_limit): for i in range(nb_subscribed_shifts, regular_next_shift_limit):
# Create the fictive shift # Create the fictive shift
@ -426,11 +427,11 @@ class WebsiteShiftController(http.Controller):
# Set new date # Set new date
shift.start_time = self.add_days( shift.start_time = self.add_days(
fields.Datetime.from_string(main_shift.start_time), fields.Datetime.from_string(main_shift.start_time),
days=i * PERIOD
days=i * shift_period
) )
shift.end_time = self.add_days( shift.end_time = self.add_days(
fields.Datetime.from_string(main_shift.end_time), fields.Datetime.from_string(main_shift.end_time),
days=i * PERIOD
days=i * shift_period
) )
# Add the fictive shift to the list of shift # Add the fictive shift to the list of shift
subscribed_shifts.append(shift) subscribed_shifts.append(shift)

8
beesdoo_website_shift/data/res_config_data.xml

@ -3,7 +3,7 @@
Copyright 2017-2018 Rémy Taymans <remytaymans@gmail.com> Copyright 2017-2018 Rémy Taymans <remytaymans@gmail.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->
<openerp>
<odoo>
<data noupdate="1"> <data noupdate="1">
<record id="beesdoo_website_shift.irregular_shift_limit" model="ir.config_parameter"> <record id="beesdoo_website_shift.irregular_shift_limit" model="ir.config_parameter">
<field name="key">beesdoo_website_shift.irregular_shift_limit</field> <field name="key">beesdoo_website_shift.irregular_shift_limit</field>
@ -37,5 +37,9 @@
<field name="key">beesdoo_website_shift.regular_highlight_rule</field> <field name="key">beesdoo_website_shift.regular_highlight_rule</field>
<field name="value">20</field> <field name="value">20</field>
</record> </record>
<record id="beesdoo_website_shift.shift_period" model="ir.config_parameter">
<field name="key">beesdoo_website_shift.shift_period</field>
<field name="value">28</field>
</record>
</data> </data>
</openerp>
</odoo>

2
beesdoo_website_shift/models/res_config.py

@ -4,7 +4,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from ast import literal_eval from ast import literal_eval
from openerp import fields, models, api
from odoo import fields, models, api
PARAMS = [ PARAMS = [
('irregular_shift_limit', 'beesdoo_website_shift.irregular_shift_limit'), ('irregular_shift_limit', 'beesdoo_website_shift.irregular_shift_limit'),

4
beesdoo_website_shift/views/my_shift_website_templates.xml

@ -3,7 +3,7 @@
Copyright 2017-2018 Rémy Taymans <remytaymans@gmail.com> Copyright 2017-2018 Rémy Taymans <remytaymans@gmail.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->
<openerp>
<odoo>
<!-- Add menu entries --> <!-- Add menu entries -->
<template id="my_shift_link" name="Link to frontend portal" inherit_id="website.layout"> <template id="my_shift_link" name="Link to frontend portal" inherit_id="website.layout">
@ -949,4 +949,4 @@
</t> </t>
</template> </template>
</openerp>
</odoo>

4
beesdoo_website_shift/views/res_config_views.xml

@ -3,7 +3,7 @@
Copyright 2017-2018 Rémy Taymans <remytaymans@gmail.com> Copyright 2017-2018 Rémy Taymans <remytaymans@gmail.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->
<openerp>
<odoo>
<data> <data>
<record id="view_website_shift_config_irregular" model="ir.ui.view"> <record id="view_website_shift_config_irregular" model="ir.ui.view">
@ -101,4 +101,4 @@
sequence="10"/> sequence="10"/>
</data> </data>
</openerp>
</odoo>

2
beesdoo_worker_status/models/cooperative_status.py

@ -253,7 +253,7 @@ class ResPartner(models.Model):
Override is_worker definition Override is_worker definition
You need have subscribe to a A Share You need have subscribe to a A Share
""" """
is_worker = fields.Boolean(compute="_is_worker", search="_search_worker")
is_worker = fields.Boolean(compute="_is_worker", search="_search_worker", readonly=True, related="")
def _is_worker(self): def _is_worker(self):
for rec in self: for rec in self:

1
macavrac_base/__init__.py

@ -0,0 +1 @@
from . import models

23
macavrac_base/__manifest__.py

@ -0,0 +1,23 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': "Macavrac Base Module",
'summary': """
Module with basic customizations for the Macavrac cooperative.
""",
'description': """
""",
'author': "Patricia Daloze",
'category': 'Sales',
'version': '12.0.1.0.0',
'depends': ['beesdoo_shift', 'contacts'],
'data': [
'views/res_partner.xml',
],
'installable': True,
}

1
macavrac_base/models/__init__.py

@ -0,0 +1 @@
from . import res_partner

49
macavrac_base/models/res_partner.py

@ -0,0 +1,49 @@
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError
class Partner(models.Model):
_inherit = 'res.partner'
date_stamp = fields.Date(string="Timestamp", help="Date de remplissage du formulaire")
birthdate = fields.Date(string="Date d'anniversaire")
payment_date = fields.Date(string="Date de paiement")
certificate_sent_date = fields.Date(string="Certificat envoyé le")
fiscal_certificate_sent_date = fields.Date(string="Attestation fiscale envoyée le")
coop_number = fields.Integer(string="Coop N°")
share_qty = fields.Integer(string="Nombre de part")
share_amount = fields.Float(string="Montant", compute="_compute_share_amount")
gender = fields.Selection([('female','Féminin'),('male','Masculin'),('other','Autre')], string="Genre")
cooperator_type = fields.Selection([('share_a', 'Part A'), ('share_b', 'Part B'), ('share_c', 'Part C'), ('share_d', 'Part D')], string="Type de Part")
state_request = fields.Selection([('ok',"En ordre"),('waiting_payment','En attente de paiement'),
('certificate_to_send', 'Certificat à envoyer'), ('resigning', 'Parts revendues')]) #TODO should we use the cooperative.status model instead?
national_register_number = fields.Char(string="Numéro de registre national") #TODO add constraint / check consistancy
share_numbers = fields.Char(string="Numéro de parts")
payment_details = fields.Char(string="Détail de paiement")
iban = fields.Char(string="IBAN") #TODO remove. Temp for import purpose.
comment_request = fields.Char(string="Commentaire")
email_sent = fields.Boolean(string="Email envoyé")
is_worker = fields.Boolean(compute="_compute_is_worker", search="_search_is_worker", string="is Worker", readonly=True, related="")
@api.depends('share_qty')
def _compute_share_amount(self):
for rec in self:
rec.share_amount = rec.share_qty * 25.0 #TODO add ir.config_parameter to make this amount editable
@api.depends('cooperator_type')
def _compute_is_worker(self):
for rec in self:
rec.is_worker = rec.cooperator_type == 'share_b'
def _search_is_worker(self, operator, value):
if (operator == '=' and value) or (operator == '!=' and not value):
return [('cooperator_type', '=', 'share_b')]
else:
return [('cooperator_type', '!=', 'share_b')]

31
macavrac_base/views/res_partner.xml

@ -0,0 +1,31 @@
<odoo>
<record model="ir.ui.view" id="macavrac_coop_partner_inherited_view_form">
<field name="name">Macavrac Coop</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="priority">99</field>
<field name="arch" type="xml">
<xpath expr="//notebook" position="inside">
<page string="Google Sheet Infos" name="google_sheet">
<group>
<field name="date_stamp"/>
<field name="coop_number"/>
<field name="gender"/>
<field name="birthdate"/>
<field name="national_register_number"/>
<field name="share_qty"/>
<field name="share_numbers"/>
<field name="share_amount"/>
<field name="state_request"/>
<field name="email_sent"/>
<field name="payment_date"/>
<field name="payment_details"/>
<field name="certificate_sent_date"/>
<field name="comment_request"/>
<field name="fiscal_certificate_sent_date"/>
</group>
</page>
</xpath>
</field>
</record>
</odoo>
Loading…
Cancel
Save