robin.keunen
5 years ago
96 changed files with 2501 additions and 1766 deletions
-
1.dockerignore
-
3README.md
-
2beesdoo_account/readme/CONTRIBUTORS.rst
-
44beesdoo_base/__manifest__.py
-
1beesdoo_base/demo/eaters.xml
-
29beesdoo_base/models/membercard.py
-
88beesdoo_base/models/partner.py
-
2beesdoo_base/readme/CONTRIBUTORS.rst
-
4beesdoo_base/security/ir.model.access.csv
-
47beesdoo_base/wizard/member_card.py
-
18beesdoo_base/wizard/partner.py
-
30beesdoo_base/wizard/portal_wizard.py
-
23beesdoo_crelan_csv/__manifest__.py
-
2beesdoo_crelan_csv/models/account_journal.py
-
129beesdoo_crelan_csv/wizard/import_crelan_csv.py
-
47beesdoo_easy_my_coop/__manifest__.py
-
27beesdoo_easy_my_coop/controllers/main.py
-
8beesdoo_easy_my_coop/models/product.py
-
20beesdoo_easy_my_coop/models/res_company.py
-
40beesdoo_easy_my_coop/models/res_partner.py
-
13beesdoo_easy_my_coop/models/subscription_request.py
-
50beesdoo_easy_my_coop/tests/test_res_partner.py
-
13beesdoo_easy_my_coop/wizards/beesdoo_shift_subscribe.py
-
25beesdoo_inventory/__manifest__.py
-
43beesdoo_inventory/models/stock.py
-
2beesdoo_inventory/readme/CONTRIBUTORS.rst
-
2beesdoo_pos/__init__.py
-
32beesdoo_pos/__manifest__.py
-
2beesdoo_pos/models/__init__.py
-
4beesdoo_pos/models/beesdoo_pos.py
-
2beesdoo_pos/readme/CONTRIBUTORS.rst
-
2beesdoo_pos/static/src/css/beesdoo.css
-
2beesdoo_pos_reporting/models/res_partner.py
-
2beesdoo_pos_reporting/readme/CONTRIBUTORS.rst
-
38beesdoo_product/__manifest__.py
-
28beesdoo_product/data/product_sequence.xml
-
2beesdoo_product/models/__init__.py
-
281beesdoo_product/models/beesdoo_product.py
-
2beesdoo_product/readme/CONTRIBUTORS.rst
-
10beesdoo_product/security/ir.model.access.csv
-
24beesdoo_product/wizard/label_printing_utils.py
-
28beesdoo_product_usability/__manifest__.py
-
16beesdoo_product_usability/models/beesdoo_product.py
-
5beesdoo_purchase/__manifest__.py
-
38beesdoo_shift/__manifest__.py
-
1beesdoo_shift/models/__init__.py
-
295beesdoo_shift/models/cooperative_status.py
-
225beesdoo_shift/models/planning.py
-
127beesdoo_shift/models/res_partner.py
-
236beesdoo_shift/models/task.py
-
2beesdoo_shift/readme/CONTRIBUTORS.rst
-
21beesdoo_shift/wizard/assign_super_coop.py
-
72beesdoo_shift/wizard/batch_template.py
-
64beesdoo_shift/wizard/extension.py
-
41beesdoo_shift/wizard/holiday.py
-
36beesdoo_shift/wizard/instanciate_planning.py
-
193beesdoo_shift/wizard/subscribe.py
-
50beesdoo_shift/wizard/temporary_exemption.py
-
38beesdoo_shift_attendance/__manifest__.py
-
47beesdoo_shift_attendance/models/attendance_sheet.py
-
4beesdoo_shift_attendance/models/res_config_settings.py
-
22beesdoo_shift_attendance/tests/test_beesdoo_shift.py
-
8beesdoo_shift_attendance/wizard/generate_missing_attendance_sheets.py
-
7beesdoo_shift_attendance/wizard/validate_attendance_sheet.py
-
10beesdoo_stock/__manifest__.py
-
30beesdoo_stock/models/stock.py
-
2beesdoo_stock_coverage/models/product_template.py
-
1beesdoo_stock_coverage/readme/CONTRIBUTORS.rst
-
5beesdoo_stock_coverage/tests/test_stock_coverage.py
-
31beesdoo_website_eater/__manifest__.py
-
10beesdoo_website_eater/controllers/main.py
-
22beesdoo_website_posorder_amount/controllers/main.py
-
6beesdoo_website_shift/__manifest__.py
-
355beesdoo_website_shift/controllers/main.py
-
29beesdoo_website_shift/models/res_config.py
-
21beesdoo_website_shift/models/website.py
-
2beesdoo_website_shift/readme/CONTRIBUTORS.rst
-
29beesdoo_website_theme/__manifest__.py
-
2beesdoo_website_theme/readme/CONTRIBUTORS.rst
-
40beesdoo_worker_status/__manifest__.py
-
256beesdoo_worker_status/models/cooperative_status.py
-
44beesdoo_worker_status/models/task.py
-
2initial-data-load/01_readme.md
-
14install-odoo-docker.md
-
512install-odoo-linux-server.md
-
1install-odoo-linux.md
-
2macavrac_base/__init__.py
-
26macavrac_base/__manifest__.py
-
2macavrac_base/models/__init__.py
-
74macavrac_base/models/res_partner.py
-
2purchase_order_generator/models/product_template.py
-
2purchase_order_generator/models/purchase_order.py
-
5purchase_order_generator/models/purchase_order_generator.py
-
4purchase_order_generator/models/purchase_order_generator_line.py
-
2purchase_order_generator/tests/test_pog.py
-
4website_portal_restrict_modification/controllers/main.py
@ -1,2 +1 @@ |
|||
* |
|||
|
@ -0,0 +1,2 @@ |
|||
* Beescoop - Cellule IT |
|||
* Coop IT Easy SCRLfs |
@ -1,24 +1,35 @@ |
|||
from odoo import models, fields, api |
|||
import uuid |
|||
|
|||
class MemberCard(models.Model): |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class MemberCard(models.Model): |
|||
def _get_current_user(self): |
|||
return self.env.uid |
|||
|
|||
def _compute_bar_code(self): |
|||
rule = self.env['barcode.rule'].search([('name', '=', 'Customer Barcodes')])[0] |
|||
rule = self.env["barcode.rule"].search( |
|||
[("name", "=", "Customer Barcodes")] |
|||
)[0] |
|||
size = 13 - len(rule.pattern) |
|||
ean = rule.pattern + str(uuid.uuid4().fields[-1])[:size] |
|||
return ean[0:12] + str(self.env['barcode.nomenclature'].ean_checksum(ean)) |
|||
return ean[0:12] + str( |
|||
self.env["barcode.nomenclature"].ean_checksum(ean) |
|||
) |
|||
|
|||
_name = 'member.card' |
|||
_order = 'create_date desc' |
|||
_name = "member.card" |
|||
_order = "create_date desc" |
|||
_description = "Member Card" |
|||
|
|||
valid = fields.Boolean(default=True, string="Active") |
|||
barcode = fields.Char("Barcode", oldname='ean13', default=_compute_bar_code) |
|||
partner_id = fields.Many2one('res.partner') #, default=_get_current_client) |
|||
responsible_id = fields.Many2one('res.users', default=_get_current_user, string="Responsible") |
|||
barcode = fields.Char( |
|||
"Barcode", oldname="ean13", default=_compute_bar_code |
|||
) |
|||
partner_id = fields.Many2one( |
|||
"res.partner" |
|||
) # , default=_get_current_client) |
|||
responsible_id = fields.Many2one( |
|||
"res.users", default=_get_current_user, string="Responsible" |
|||
) |
|||
end_date = fields.Date(readonly=True, string="Expiration Date") |
|||
comment = fields.Char("Reason", required=True) |
@ -0,0 +1,2 @@ |
|||
* Beescoop - Cellule IT |
|||
* Coop IT Easy SCRLfs |
@ -1,2 +1,2 @@ |
|||
"id","name","model_id/id","group_id/id","perm_read","perm_write","perm_create","perm_unlink" |
|||
"member_card_read_all","member card read all","beesdoo_base.model_member_card","","True","False","False","False" |
|||
"id","name","model_id/id","group_id/id","perm_read","perm_write","perm_create","perm_unlink" |
|||
"member_card_read_all","member card read all","beesdoo_base.model_member_card","","True","False","False","False" |
@ -1,20 +1,22 @@ |
|||
from odoo import models, fields, api |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class NewEaterWizard(models.TransientModel): |
|||
""" |
|||
A transient model for the creation of a eater related to a worker. |
|||
""" |
|||
_name = 'eater.new.wizard' |
|||
_description = 'eater.new.wizard' |
|||
|
|||
_name = "eater.new.wizard" |
|||
_description = "eater.new.wizard" |
|||
|
|||
def _get_default_partner(self): |
|||
return self.env.context['active_id'] |
|||
return self.env.context["active_id"] |
|||
|
|||
first_name = fields.Char('First Name', required=True) |
|||
last_name = fields.Char('Last Name', required=True) |
|||
email = fields.Char('Email') |
|||
first_name = fields.Char("First Name", required=True) |
|||
last_name = fields.Char("Last Name", required=True) |
|||
email = fields.Char("Email") |
|||
|
|||
partner_id = fields.Many2one('res.partner', default=_get_default_partner) |
|||
partner_id = fields.Many2one("res.partner", default=_get_default_partner) |
|||
|
|||
@api.one |
|||
def create_new_eater(self): |
|||
|
@ -1,25 +1,29 @@ |
|||
from odoo import models, fields, api |
|||
from odoo import SUPERUSER_ID |
|||
from odoo import SUPERUSER_ID, api, fields, models |
|||
|
|||
|
|||
class BeesdooWizard(models.TransientModel): |
|||
|
|||
_inherit = 'portal.wizard' |
|||
_inherit = "portal.wizard" |
|||
|
|||
@api.onchange('portal_id') |
|||
@api.onchange("portal_id") |
|||
def onchange_portal(self): |
|||
# for each partner, determine corresponding portal.wizard.user records |
|||
res_partner = self.env['res.partner'] |
|||
partner_ids = self._context.get('active_ids', []) |
|||
res_partner = self.env["res.partner"] |
|||
partner_ids = self._context.get("active_ids", []) |
|||
|
|||
contact_ids = set() |
|||
for partner in res_partner.browse(partner_ids): |
|||
for contact in (partner.child_ids | partner): |
|||
for contact in partner.child_ids | partner: |
|||
# make sure that each contact appears at most once in the list |
|||
if contact.id not in contact_ids: |
|||
contact_ids.add(contact.id) |
|||
in_portal = self.portal_id in contact.user_ids.mapped('groups_id') |
|||
self.user_ids |= self.env['portal.wizard.user'].new({ |
|||
'partner_id': contact.id, |
|||
'email': contact.email, |
|||
'in_portal': in_portal, |
|||
}) |
|||
in_portal = self.portal_id in contact.user_ids.mapped( |
|||
"groups_id" |
|||
) |
|||
self.user_ids |= self.env["portal.wizard.user"].new( |
|||
{ |
|||
"partner_id": contact.id, |
|||
"email": contact.email, |
|||
"in_portal": in_portal, |
|||
} |
|||
) |
@ -1,35 +1,28 @@ |
|||
{ |
|||
'name': "Beescoop link with easy my coop", |
|||
|
|||
'summary': """ |
|||
"name": "Beescoop link with easy my coop", |
|||
"summary": """ |
|||
Module that made the link between beesdoo customization |
|||
and easy_my_coop |
|||
""", |
|||
|
|||
'description': """ |
|||
"description": """ |
|||
""", |
|||
|
|||
'author': "BEES coop, Coop IT Easy", |
|||
'website': "https://github.com/beescoop/Obeesdoo", |
|||
|
|||
'category': 'Cooperative management', |
|||
'version': '12.0.1.0.0', |
|||
|
|||
'depends': ['beesdoo_base', |
|||
'beesdoo_shift', |
|||
'easy_my_coop', |
|||
'easy_my_coop_website', |
|||
'partner_age', |
|||
], |
|||
|
|||
'data': [ |
|||
'views/res_company.xml', |
|||
'views/subscription_request.xml', |
|||
'views/subscription_templates.xml', |
|||
'views/product.xml' |
|||
"author": "BEES coop, Coop IT Easy", |
|||
"website": "https://github.com/beescoop/Obeesdoo", |
|||
"category": "Cooperative management", |
|||
"version": "12.0.1.0.0", |
|||
"depends": [ |
|||
"beesdoo_base", |
|||
"beesdoo_shift", |
|||
"easy_my_coop", |
|||
"easy_my_coop_website", |
|||
"partner_age", |
|||
], |
|||
'demo': [ |
|||
'demo/product_share.xml', |
|||
"data": [ |
|||
"views/res_company.xml", |
|||
"views/subscription_request.xml", |
|||
"views/subscription_templates.xml", |
|||
"views/product.xml", |
|||
], |
|||
'auto_install': True, |
|||
"demo": ["demo/product_share.xml"], |
|||
"auto_install": True, |
|||
} |
@ -1,19 +1,22 @@ |
|||
from odoo import http |
|||
from odoo.http import request |
|||
|
|||
from odoo.addons.easy_my_coop_website.controllers.main import WebsiteSubscription as Base |
|||
from odoo.addons.easy_my_coop_website.controllers.main import ( |
|||
WebsiteSubscription as Base, |
|||
) |
|||
|
|||
class WebsiteSubscription(Base): |
|||
|
|||
class WebsiteSubscription(Base): |
|||
def fill_values(self, values, is_company, logged, load_from_user=False): |
|||
values = super(WebsiteSubscription, self).fill_values(values, |
|||
is_company, |
|||
logged, |
|||
load_from_user) |
|||
cmp = request.env['res.company']._company_default_get() |
|||
values.update({ |
|||
'display_info_session': cmp.display_info_session_confirmation, |
|||
'info_session_required': cmp.info_session_confirmation_required, |
|||
'info_session_text': cmp.info_session_confirmation_text, |
|||
}) |
|||
values = super(WebsiteSubscription, self).fill_values( |
|||
values, is_company, logged, load_from_user |
|||
) |
|||
cmp = request.env["res.company"]._company_default_get() |
|||
values.update( |
|||
{ |
|||
"display_info_session": cmp.display_info_session_confirmation, |
|||
"info_session_required": cmp.info_session_confirmation_required, |
|||
"info_session_text": cmp.info_session_confirmation_text, |
|||
} |
|||
) |
|||
return values |
@ -1,26 +1,25 @@ |
|||
# Copyright 2019 Coop IT Easy SCRLfs |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
from odoo import api, fields, models, _ |
|||
from odoo import _, api, fields, models |
|||
|
|||
|
|||
class SubscriptionRequest(models.Model): |
|||
|
|||
_inherit = 'subscription.request' |
|||
_inherit = "subscription.request" |
|||
|
|||
info_session_confirmed = fields.Boolean( |
|||
string="Confirmed Info Session", |
|||
default=False, |
|||
string="Confirmed Info Session", default=False |
|||
) |
|||
|
|||
def get_partner_vals(self): |
|||
partner_vals = super(SubscriptionRequest, self).get_partner_vals() |
|||
partner_vals['info_session_confirmed'] = self.info_session_confirmed |
|||
partner_vals["info_session_confirmed"] = self.info_session_confirmed |
|||
return partner_vals |
|||
|
|||
def get_required_field(self): |
|||
required_fields = super(SubscriptionRequest, self).get_required_field() |
|||
company = self.env['res.company']._company_default_get() |
|||
company = self.env["res.company"]._company_default_get() |
|||
if company.info_session_confirmation_required: |
|||
required_fields.append('info_session_confirmed') |
|||
required_fields.append("info_session_confirmed") |
|||
return required_fields |
@ -0,0 +1,2 @@ |
|||
* Beescoop - Cellule IT |
|||
* Coop IT Easy SCRLfs |
@ -1 +1 @@ |
|||
from . import models |
|||
from . import models |
@ -1 +1 @@ |
|||
from . import beesdoo_pos |
|||
from . import beesdoo_pos |
@ -0,0 +1,2 @@ |
|||
* Beescoop - Cellule IT |
|||
* Coop IT Easy SCRLfs |
@ -0,0 +1,2 @@ |
|||
* Beescoop - Cellule IT |
|||
* Coop IT Easy SCRLfs |
@ -1,14 +1,14 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<data noupdate="1"> |
|||
<record id="seq_ean_product_internal_ref" model="ir.sequence"> |
|||
<field name="name">Internal reference</field> |
|||
<field name="code">product.internal.code</field> |
|||
<field name="prefix"></field> |
|||
<field name="padding">5</field> |
|||
<field name="suffix"></field> |
|||
<field name="number_next">1</field> |
|||
<!-- <field name="barcode_sequence" eval="True"/> --> |
|||
</record> |
|||
</data> |
|||
</odoo> |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<data noupdate="1"> |
|||
<record id="seq_ean_product_internal_ref" model="ir.sequence"> |
|||
<field name="name">Internal reference</field> |
|||
<field name="code">product.internal.code</field> |
|||
<field name="prefix"></field> |
|||
<field name="padding">5</field> |
|||
<field name="suffix"></field> |
|||
<field name="number_next">1</field> |
|||
<!-- <field name="barcode_sequence" eval="True"/> --> |
|||
</record> |
|||
</data> |
|||
</odoo> |
@ -1 +1 @@ |
|||
from . import beesdoo_product |
|||
from . import beesdoo_product |
@ -0,0 +1,2 @@ |
|||
* Beescoop - Cellule IT |
|||
* Coop IT Easy SCRLfs |
@ -1,5 +1,5 @@ |
|||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
|||
beesdoo_product_label_read_all,beesdoo.product.label Read All,model_beesdoo_product_label,,1,0,0,0 |
|||
beesdoo_product_label_all_access_sale_manager,beesdoo.product.label All Access Sale Manager,model_beesdoo_product_label,sales_team.group_sale_manager,1,1,1,1 |
|||
beesdoo_scale_category_read_all,beesdoo.scale.category Read All,model_beesdoo_scale_category,,1,0,0,0 |
|||
beesdoo_scale_categoryl_all_access_sale_manager,beesdoo.scale.category All Access Sale Manager,model_beesdoo_scale_category,sales_team.group_sale_manager,1,1,1,0 |
|||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
|||
beesdoo_product_label_read_all,beesdoo.product.label Read All,model_beesdoo_product_label,,1,0,0,0 |
|||
beesdoo_product_label_all_access_sale_manager,beesdoo.product.label All Access Sale Manager,model_beesdoo_product_label,sales_team.group_sale_manager,1,1,1,1 |
|||
beesdoo_scale_category_read_all,beesdoo.scale.category Read All,model_beesdoo_scale_category,,1,0,0,0 |
|||
beesdoo_scale_categoryl_all_access_sale_manager,beesdoo.scale.category All Access Sale Manager,model_beesdoo_scale_category,sales_team.group_sale_manager,1,1,1,0 |
@ -1,20 +1,26 @@ |
|||
from odoo import models, fields, api |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class RequestLabelPrintingWizard(models.TransientModel): |
|||
_name = 'label.printing.wizard' |
|||
_description = 'label.printing.wizard' |
|||
_name = "label.printing.wizard" |
|||
_description = "label.printing.wizard" |
|||
|
|||
def _get_selected_products(self): |
|||
return self.env.context['active_ids'] |
|||
|
|||
product_ids = fields.Many2many('product.template', default=_get_selected_products) |
|||
return self.env.context["active_ids"] |
|||
|
|||
product_ids = fields.Many2many( |
|||
"product.template", default=_get_selected_products |
|||
) |
|||
|
|||
@api.one |
|||
def request_printing(self): |
|||
self.product_ids.write({'label_to_be_printed' : True}) |
|||
|
|||
self.product_ids.write({"label_to_be_printed": True}) |
|||
|
|||
@api.one |
|||
def set_as_printed(self): |
|||
self.product_ids.write({'label_to_be_printed' : False, 'label_last_printed' : fields.Datetime.now()}) |
|||
self.product_ids.write( |
|||
{ |
|||
"label_to_be_printed": False, |
|||
"label_last_printed": fields.Datetime.now(), |
|||
} |
|||
) |
@ -1,22 +1,18 @@ |
|||
# Copyright 2017 - 2020 BEES coop SCRLfs |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
{ |
|||
'name': "BEES coop Product Usability", |
|||
|
|||
'description': """ |
|||
Adapt the |
|||
"name": "BEES coop Product Usability", |
|||
"summary": """ |
|||
Adapt the product views. |
|||
""", |
|||
|
|||
'author': "Beescoop - Cellule IT, Coop IT Easy", |
|||
'website': "https://github.com/beescoop/Obeesdoo", |
|||
'category': 'Sales Management', |
|||
'version': '12.0.1.0.0', |
|||
'depends': [ |
|||
'beesdoo_product', |
|||
'beesdoo_stock_coverage', |
|||
'beesdoo_purchase', |
|||
], |
|||
'data': [ |
|||
'views/beesdoo_product.xml', |
|||
"author": "Beescoop - Cellule IT, Coop IT Easy SCRLfs", |
|||
"website": "https://github.com/beescoop/Obeesdoo", |
|||
"category": "Sales Management", |
|||
"version": "12.0.1.0.0", |
|||
"depends": [ |
|||
"beesdoo_product", |
|||
"beesdoo_stock_coverage", |
|||
"beesdoo_purchase", |
|||
], |
|||
"data": ["views/beesdoo_product.xml",], |
|||
} |
@ -1,4 +1,3 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from . import task |
|||
from . import planning |
|||
from . import cooperative_status |
|||
|
@ -0,0 +1,2 @@ |
|||
* Beescoop - Cellule IT |
|||
* Coop IT Easy SCRLfs |
@ -1,14 +1,23 @@ |
|||
from odoo import models, fields, api, _ |
|||
from odoo import _, api, fields, models |
|||
|
|||
|
|||
class AssignSuperCoop(models.TransientModel): |
|||
_name = 'beesddoo.shift.assign_super_coop' |
|||
_description = 'beesddoo.shift.assign_super_coop' |
|||
_name = "beesddoo.shift.assign_super_coop" |
|||
_description = "beesddoo.shift.assign_super_coop" |
|||
|
|||
super_coop_id = fields.Many2one('res.users', 'New Super Cooperative', required=True, domain=[('super', '=', True)]) |
|||
shift_ids = fields.Many2many('beesdoo.shift.shift', readonly=True, default=lambda self: self._context.get('active_ids')) |
|||
super_coop_id = fields.Many2one( |
|||
"res.users", |
|||
"New Super Cooperative", |
|||
required=True, |
|||
domain=[("super", "=", True)], |
|||
) |
|||
shift_ids = fields.Many2many( |
|||
"beesdoo.shift.shift", |
|||
readonly=True, |
|||
default=lambda self: self._context.get("active_ids"), |
|||
) |
|||
|
|||
@api.multi |
|||
def write_super_coop(self): |
|||
self.ensure_one() |
|||
self.shift_ids.write({'super_coop_id' : self.super_coop_id.id}) |
|||
self.shift_ids.write({"super_coop_id": self.super_coop_id.id}) |
@ -1,33 +1,63 @@ |
|||
from odoo import models, fields, api, _ |
|||
from odoo import _, api, fields, models |
|||
from odoo.exceptions import UserError |
|||
|
|||
|
|||
class Subscribe(models.TransientModel): |
|||
_name = 'beesdoo.shift.extension' |
|||
_description = 'beesdoo.shift.extension' |
|||
_inherit = 'beesdoo.shift.action_mixin' |
|||
_name = "beesdoo.shift.extension" |
|||
_description = "beesdoo.shift.extension" |
|||
_inherit = "beesdoo.shift.action_mixin" |
|||
|
|||
def _get_default_extension_delay(self): |
|||
return int(self.env['ir.config_parameter'].sudo().get_param('default_extension_delay', 28)) |
|||
|
|||
return int( |
|||
self.env["ir.config_parameter"] |
|||
.sudo() |
|||
.get_param("default_extension_delay", 28) |
|||
) |
|||
|
|||
extension_start_date = fields.Date(string="Start date for the extension", default=fields.Date.today, readonly=True) |
|||
extension_start_date = fields.Date( |
|||
string="Start date for the extension", |
|||
default=fields.Date.today, |
|||
readonly=True, |
|||
) |
|||
auto = fields.Boolean("Auto Extension", default=False) |
|||
extension_days = fields.Integer(default=_get_default_extension_delay) |
|||
|
|||
@api.multi |
|||
def auto_ext(self): |
|||
self = self._check(group='beesdoo_shift.group_shift_attendance') |
|||
status_id = self.env['cooperative.status'].search([('cooperator_id', '=', self.cooperator_id.id)]) |
|||
status_id.sudo().write({'extension_start_time': self.extension_start_date}) |
|||
self = self._check(group="beesdoo_shift.group_shift_attendance") |
|||
status_id = self.env["cooperative.status"].search( |
|||
[("cooperator_id", "=", self.cooperator_id.id)] |
|||
) |
|||
status_id.sudo().write( |
|||
{"extension_start_time": self.extension_start_date} |
|||
) |
|||
|
|||
@api.multi |
|||
def extension(self): |
|||
self = self._check() #maybe a different group |
|||
grace_delay = int(self.env['ir.config_parameter'].sudo().get_param('default_grace_delay', 10)) |
|||
status_id = self.env['cooperative.status'].search([('cooperator_id', '=', self.cooperator_id.id)]) |
|||
self = self._check() # maybe a different group |
|||
grace_delay = int( |
|||
self.env["ir.config_parameter"] |
|||
.sudo() |
|||
.get_param("default_grace_delay", 10) |
|||
) |
|||
status_id = self.env["cooperative.status"].search( |
|||
[("cooperator_id", "=", self.cooperator_id.id)] |
|||
) |
|||
if not status_id.extension_start_time: |
|||
raise UserError(_('You should not make a manual extension when the grace delay has not been triggered yet')) |
|||
today_delay = (status_id.today - status_id.extension_start_time).days - grace_delay |
|||
raise UserError( |
|||
_( |
|||
"You should not make a manual extension when the grace delay has not been triggered yet" |
|||
) |
|||
) |
|||
today_delay = ( |
|||
status_id.today - status_id.extension_start_time |
|||
).days - grace_delay |
|||
if today_delay < 0: |
|||
raise UserError(_('You should not start a manual extension during the grace delay')) |
|||
status_id.sudo().write({'time_extension': self.extension_days + today_delay}) |
|||
raise UserError( |
|||
_( |
|||
"You should not start a manual extension during the grace delay" |
|||
) |
|||
) |
|||
status_id.sudo().write( |
|||
{"time_extension": self.extension_days + today_delay} |
|||
) |
@ -1,19 +1,40 @@ |
|||
from odoo import models, fields, api, _ |
|||
from odoo import _, api, fields, models |
|||
from odoo.exceptions import ValidationError |
|||
|
|||
|
|||
class Subscribe(models.TransientModel): |
|||
_name = 'beesdoo.shift.holiday' |
|||
_description = 'beesdoo.shift.holiday' |
|||
_inherit = 'beesdoo.shift.action_mixin' |
|||
_name = "beesdoo.shift.holiday" |
|||
_description = "beesdoo.shift.holiday" |
|||
_inherit = "beesdoo.shift.action_mixin" |
|||
|
|||
holiday_start_day = fields.Date(string="Start date for the holiday", default=fields.Date.today) |
|||
holiday_start_day = fields.Date( |
|||
string="Start date for the holiday", default=fields.Date.today |
|||
) |
|||
holiday_end_day = fields.Date(string="End date for the holiday (included)") |
|||
|
|||
@api.multi |
|||
def holidays(self): |
|||
self = self._check() # maybe a different group |
|||
status_id = self.env['cooperative.status'].search([('cooperator_id', '=', self.cooperator_id.id)]) |
|||
if status_id.holiday_end_time and status_id.holiday_end_time >= status_id.today: |
|||
raise ValidationError(_("You cannot encode new holidays since the previous holidays encoded are not over yet")) |
|||
status_id.sudo().write({'holiday_start_time': self.holiday_start_day, 'holiday_end_time': self.holiday_end_day}) |
|||
self.env['beesdoo.shift.shift'].sudo().unsubscribe_from_today([self.cooperator_id.id], today=self.holiday_start_day, end_date=self.holiday_end_day) |
|||
status_id = self.env["cooperative.status"].search( |
|||
[("cooperator_id", "=", self.cooperator_id.id)] |
|||
) |
|||
if ( |
|||
status_id.holiday_end_time |
|||
and status_id.holiday_end_time >= status_id.today |
|||
): |
|||
raise ValidationError( |
|||
_( |
|||
"You cannot encode new holidays since the previous holidays encoded are not over yet" |
|||
) |
|||
) |
|||
status_id.sudo().write( |
|||
{ |
|||
"holiday_start_time": self.holiday_start_day, |
|||
"holiday_end_time": self.holiday_end_day, |
|||
} |
|||
) |
|||
self.env["beesdoo.shift.shift"].sudo().unsubscribe_from_today( |
|||
[self.cooperator_id.id], |
|||
today=self.holiday_start_day, |
|||
end_date=self.holiday_end_day, |
|||
) |
@ -1,28 +1,34 @@ |
|||
from odoo import models, fields, api, _ |
|||
from odoo import _, api, fields, models |
|||
|
|||
|
|||
class InstanciatePlanning(models.TransientModel): |
|||
_name = 'beesddoo.shift.generate_planning' |
|||
_description = 'beesddoo.shift.generate_planning' |
|||
_name = "beesddoo.shift.generate_planning" |
|||
_description = "beesddoo.shift.generate_planning" |
|||
|
|||
def _get_planning(self): |
|||
return self._context.get('active_id') |
|||
return self._context.get("active_id") |
|||
|
|||
date_start = fields.Date("First Day of planning (should be monday)", required=True) |
|||
planning_id = fields.Many2one('beesdoo.shift.planning', readonly=True, default=_get_planning) |
|||
date_start = fields.Date( |
|||
"First Day of planning (should be monday)", required=True |
|||
) |
|||
planning_id = fields.Many2one( |
|||
"beesdoo.shift.planning", readonly=True, default=_get_planning |
|||
) |
|||
|
|||
@api.multi |
|||
def generate_task(self): |
|||
self.ensure_one() |
|||
self = self.with_context(visualize_date=self.date_start, tracking_disable=True) |
|||
self = self.with_context( |
|||
visualize_date=self.date_start, tracking_disable=True |
|||
) |
|||
shifts = self.planning_id.task_template_ids._generate_task_day() |
|||
return { |
|||
'name': _('Generated Shift'), |
|||
'type': 'ir.actions.act_window', |
|||
'view_type': 'form', |
|||
'view_mode': 'kanban,calendar,tree,form,pivot', |
|||
'res_model': 'beesdoo.shift.shift', |
|||
'target': 'current', |
|||
'domain': [('id', 'in', shifts.ids)], |
|||
'context' : {'search_default_gb_day': 1} |
|||
"name": _("Generated Shift"), |
|||
"type": "ir.actions.act_window", |
|||
"view_type": "form", |
|||
"view_mode": "kanban,calendar,tree,form,pivot", |
|||
"res_model": "beesdoo.shift.shift", |
|||
"target": "current", |
|||
"domain": [("id", "in", shifts.ids)], |
|||
"context": {"search_default_gb_day": 1}, |
|||
} |
@ -1,24 +1,44 @@ |
|||
from odoo import models, fields, api, _ |
|||
from odoo import _, api, fields, models |
|||
from odoo.exceptions import ValidationError |
|||
|
|||
|
|||
class TemporaryExemption(models.TransientModel): |
|||
_name = 'beesdoo.shift.temporary_exemption' |
|||
_description = 'beesdoo.shift.temporary_exemption' |
|||
_inherit = 'beesdoo.shift.action_mixin' |
|||
_name = "beesdoo.shift.temporary_exemption" |
|||
_description = "beesdoo.shift.temporary_exemption" |
|||
_inherit = "beesdoo.shift.action_mixin" |
|||
|
|||
temporary_exempt_reason_id = fields.Many2one('cooperative.exempt.reason', 'Exempt Reason', required=True) |
|||
temporary_exempt_start_date = fields.Date(default=fields.Date.today, required=True) |
|||
temporary_exempt_reason_id = fields.Many2one( |
|||
"cooperative.exempt.reason", "Exempt Reason", required=True |
|||
) |
|||
temporary_exempt_start_date = fields.Date( |
|||
default=fields.Date.today, required=True |
|||
) |
|||
temporary_exempt_end_date = fields.Date(required=True) |
|||
|
|||
@api.multi |
|||
def exempt(self): |
|||
self = self._check() # maybe a different group |
|||
status_id = self.env['cooperative.status'].search([('cooperator_id', '=', self.cooperator_id.id)]) |
|||
if status_id.temporary_exempt_end_date and status_id.temporary_exempt_end_date >= status_id.today: |
|||
raise ValidationError(_("You cannot encode new temporary exemptuon since the previous one are not over yet")) |
|||
status_id.sudo().write({ |
|||
'temporary_exempt_start_date': self.temporary_exempt_start_date, |
|||
'temporary_exempt_end_date': self.temporary_exempt_end_date, |
|||
'temporary_exempt_reason_id': self.temporary_exempt_reason_id.id, |
|||
}) |
|||
self.env['beesdoo.shift.shift'].sudo().unsubscribe_from_today([self.cooperator_id.id], today=self.temporary_exempt_start_date, end_date=self.temporary_exempt_end_date) |
|||
status_id = self.env["cooperative.status"].search( |
|||
[("cooperator_id", "=", self.cooperator_id.id)] |
|||
) |
|||
if ( |
|||
status_id.temporary_exempt_end_date |
|||
and status_id.temporary_exempt_end_date >= status_id.today |
|||
): |
|||
raise ValidationError( |
|||
_( |
|||
"You cannot encode new temporary exemptuon since the previous one are not over yet" |
|||
) |
|||
) |
|||
status_id.sudo().write( |
|||
{ |
|||
"temporary_exempt_start_date": self.temporary_exempt_start_date, |
|||
"temporary_exempt_end_date": self.temporary_exempt_end_date, |
|||
"temporary_exempt_reason_id": self.temporary_exempt_reason_id.id, |
|||
} |
|||
) |
|||
self.env["beesdoo.shift.shift"].sudo().unsubscribe_from_today( |
|||
[self.cooperator_id.id], |
|||
today=self.temporary_exempt_start_date, |
|||
end_date=self.temporary_exempt_end_date, |
|||
) |
@ -1,2 +1 @@ |
|||
* Robin Keunen <robin@keunen.net> |
|||
|
@ -0,0 +1,2 @@ |
|||
* Beescoop - Cellule IT |
|||
* Coop IT Easy SCRLfs |
@ -1,23 +1,16 @@ |
|||
{ |
|||
'name': 'BEES coop Website Theme', |
|||
|
|||
'summary': """ |
|||
"name": "BEES coop Website Theme", |
|||
"summary": """ |
|||
Apply BEES coop design rules. |
|||
""", |
|||
'description': """ |
|||
"description": """ |
|||
""", |
|||
|
|||
'author': 'Rémy Taymans', |
|||
'website': "https://github.com/beescoop/Obeesdoo", |
|||
|
|||
'license': "AGPL-3", |
|||
'category': 'Themes', |
|||
'version': '12.0.0.1', |
|||
'application': True, |
|||
|
|||
'depends': ['website'], |
|||
|
|||
'data': [ |
|||
'views/assets.xml', |
|||
] |
|||
"author": "Rémy Taymans", |
|||
"website": "https://github.com/beescoop/Obeesdoo", |
|||
"license": "AGPL-3", |
|||
"category": "Themes", |
|||
"version": "12.0.0.1", |
|||
"application": True, |
|||
"depends": ["website"], |
|||
"data": ["views/assets.xml"], |
|||
} |
@ -0,0 +1,2 @@ |
|||
* Beescoop - Cellule IT |
|||
* Coop IT Easy SCRLfs |
@ -1,28 +1,16 @@ |
|||
# Copyright 2020 Coop IT Easy SCRL fs |
|||
# Elouan Le Bars <elouan@coopiteasy.be> |
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). |
|||
{ |
|||
'name': "Beescoop Worker Status manager", |
|||
|
|||
'summary': """ |
|||
Worker status management specific to beescoop""", |
|||
|
|||
'description': """ |
|||
|
|||
""", |
|||
|
|||
'author': "Thibault Francois, Elouan Le Bars, Coop It Easy", |
|||
'website': "https://github.com/beescoop/Obeesdoo", |
|||
|
|||
'category': 'Cooperative management', |
|||
'version': '12.0.1.0.0', |
|||
|
|||
'depends': [ |
|||
'beesdoo_base', |
|||
'beesdoo_shift', |
|||
], |
|||
|
|||
'data': [ |
|||
], |
|||
'demo': [ |
|||
"demo/cooperators.xml", |
|||
"demo/tasks.xml", |
|||
] |
|||
"name": "Beescoop Worker Status manager", |
|||
"summary": """ |
|||
Worker status management specific to beescoop.""", |
|||
"author": "Thibault Francois, Elouan Le Bars, Coop IT Easy SCRLfs", |
|||
"website": "https://github.com/beescoop/Obeesdoo", |
|||
"category": "Cooperative management", |
|||
"version": "12.0.1.0.0", |
|||
"depends": ["beesdoo_base", "beesdoo_shift",], |
|||
"data": [], |
|||
"demo": ["demo/cooperators.xml", "demo/tasks.xml",], |
|||
"license": "AGPL-3", |
|||
} |
@ -1,259 +1,267 @@ |
|||
# Install odoo on a linux server |
|||
|
|||
> by Thibault François |
|||
> by Thibault François |
|||
|
|||
## Installation basique |
|||
|
|||
##### 1) ajouter un utilisateur odoo |
|||
|
|||
# adduser odoo |
|||
|
|||
##### 2) installation de postgresql (DBMS) |
|||
|
|||
# apt-get install postgresql |
|||
|
|||
##### 3) install git |
|||
|
|||
# apt-get install git |
|||
|
|||
##### 4) installer pip : python package manager |
|||
|
|||
# apt-get install python-pip |
|||
|
|||
##### 5) installation des paquets devel pour compilation des bibliothèques python |
|||
|
|||
# apt-get install python-dev postgresql-server-dev-all libjpeg-dev zlib1g-dev libpng12-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev |
|||
|
|||
##### 6) installation de node-less |
|||
|
|||
# apt-get install node-less |
|||
|
|||
##### 7) clone odoo |
|||
|
|||
# su odoo |
|||
$ cd /home/odoo |
|||
$ git clone https://github.com/odoo/odoo.git |
|||
|
|||
##### 8) installer bibliothèque python |
|||
|
|||
$ exit |
|||
# cd /home/odoo/odoo |
|||
# pip install -r requirements.txt |
|||
|
|||
##### 9) créer odoo user pour postgresql avec les droits de création de base de donnée |
|||
|
|||
# su postgres |
|||
$ createuser -d odoo |
|||
$ exit |
|||
|
|||
##### 10) Installer wkhtml to pdf 0.12.1 !! (pas une autre) (sur une machine 64 bit avec un ubuntu 64bit 14.04) |
|||
|
|||
# apt-get install fontconfig libfontconfig1 libxrender1 fontconfig-config |
|||
# wget http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb |
|||
# dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb |
|||
# cd /usr/local/bin/ |
|||
# cp wkhtmltoimage /usr/bin/wkhtmltoimage |
|||
# cp wkhtmltopdf /usr/bin/wkhtmltopdf |
|||
|
|||
##### 11) Tester l'installation de odoo |
|||
|
|||
# su odoo |
|||
$ cd /home/odoo/odoo |
|||
$ ./odoo.py |
|||
|
|||
lancer le navigateur http://localhost:8069 la page de création de base de donnée d'odoo devrait s'ouvrir, essayé de créer une base de donnée |
|||
|
|||
ctrl + c pour tuer le processus odoo depuis la console |
|||
|
|||
## Pour aller plus loin: init.d script |
|||
|
|||
##### 1) créer un répertoire de log |
|||
|
|||
# su odoo |
|||
$ mkdir /home/odoo/log |
|||
|
|||
##### 2) créer fichier de config odoo |
|||
|
|||
$ cd /home/odoo/odoo |
|||
$ ./odoo.py -s -c /home/odoo/odoo.conf --stop-after-init --logfile=/home/odoo/log/odoo.log |
|||
|
|||
##### 3) Créer le fichier init.d |
|||
|
|||
$ exit |
|||
$ vim /etc/init.d/odoo |
|||
|
|||
copier le contenu dans le fichier (gedit va aussi bien que vim) |
|||
|
|||
|
|||
#!/bin/sh |
|||
|
|||
### BEGIN INIT INFO |
|||
# Provides: openerp-server |
|||
# Required-Start: $remote_fs $syslog |
|||
# Required-Stop: $remote_fs $syslog |
|||
# Should-Start: $network |
|||
# Should-Stop: $network |
|||
# Default-Start: 2 3 4 5 |
|||
# Default-Stop: 0 1 6 |
|||
# Short-Description: Enterprise Resource Management software |
|||
# Description: Open ERP is a complete ERP and CRM software. |
|||
### END INIT INFO |
|||
|
|||
PATH=/bin:/sbin:/usr/bin |
|||
DAEMON=/home/odoo/odoo/odoo.py |
|||
NAME=odoo |
|||
DESC=odoo |
|||
|
|||
# Specify the user name (Default: openerp). |
|||
USER=odoo |
|||
|
|||
# Specify an alternate config file (Default: /etc/openerp-server.conf). |
|||
CONFIGFILE="/home/odoo/odoo.conf" |
|||
|
|||
# pidfile |
|||
PIDFILE=/var/run/$NAME.pid |
|||
|
|||
# Additional options that are passed to the Daemon. |
|||
DAEMON_OPTS="-c $CONFIGFILE" |
|||
|
|||
[ -x $DAEMON ] || exit 0 |
|||
[ -f $CONFIGFILE ] || exit 0 |
|||
|
|||
checkpid() { |
|||
[ -f $PIDFILE ] || return 1 |
|||
pid=`cat $PIDFILE` |
|||
[ -d /proc/$pid ] && return 0 |
|||
pid=`cat $PIDFILE` |
|||
[ -d /proc/$pid ] && return 0 |
|||
return 1 |
|||
} |
|||
|
|||
case "${1}" in |
|||
start) |
|||
echo -n "Starting ${DESC}: " |
|||
|
|||
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \ |
|||
--chuid ${USER} --background --make-pidfile \ |
|||
--exec ${DAEMON} -- ${DAEMON_OPTS} |
|||
|
|||
echo "${NAME}." |
|||
;; |
|||
|
|||
stop) |
|||
echo -n "Stopping ${DESC}: " |
|||
|
|||
start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \ |
|||
--oknodo |
|||
|
|||
echo "${NAME}." |
|||
;; |
|||
|
|||
restart|force-reload) |
|||
echo -n "Restarting ${DESC}: " |
|||
|
|||
start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \ |
|||
--oknodo |
|||
|
|||
sleep 1 |
|||
|
|||
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \ |
|||
--chuid ${USER} --background --make-pidfile \ |
|||
--exec ${DAEMON} -- ${DAEMON_OPTS} |
|||
|
|||
echo "${NAME}." |
|||
|
|||
echo "${NAME}." |
|||
;; |
|||
|
|||
*) |
|||
N=/etc/init.d/${NAME} |
|||
echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2 |
|||
exit 1 |
|||
;; |
|||
esac |
|||
|
|||
exit 0 |
|||
|
|||
##### 4) donner les bons droits au fichier |
|||
|
|||
# chmod 755 /etc/init.d/odoo |
|||
|
|||
##### 5) tester le script |
|||
|
|||
# /etc/init.d/odoo start |
|||
|
|||
tester à nouveau sur localhost:8069 |
|||
|
|||
##### 6) faire en sorte que le script s'exécute au démarrage |
|||
|
|||
# update-rc.d odoo defaults |
|||
|
|||
|
|||
## Pour aller plus loin: proxy nginx |
|||
|
|||
##### 1) installer nginx |
|||
|
|||
# apt-get install nginx |
|||
|
|||
vous pouvez tester l'installation réussie sur http://localhost |
|||
|
|||
##### 2) configurer nginx pour odoo : editer le fichier de conf |
|||
|
|||
# vim /etc/nginx/sites-enabled/default |
|||
|
|||
supprimer le contenu et le remplacer par |
|||
|
|||
upstream odoo { |
|||
server 127.0.0.1:8069 weight=1 fail_timeout=300s; |
|||
} |
|||
|
|||
server { |
|||
# server port and name |
|||
listen 80; |
|||
server_name localhost; |
|||
|
|||
|
|||
location / { |
|||
proxy_pass http://odoo; |
|||
# force timeouts if the backend dies |
|||
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; |
|||
|
|||
# set headers |
|||
proxy_set_header Host $host; |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for; |
|||
|
|||
} |
|||
} |
|||
|
|||
##### 3) tester la config et relancer nginx |
|||
|
|||
# nginx -t |
|||
# nginx -s reload |
|||
|
|||
tester http://localhost |
|||
|
|||
devrait conduire à odoo (ne pas oublier de vider le cache de son navigateur au cas ou ca ne marche pas tout de suite) |
|||
|
|||
##### 1) ajouter un utilisateur odoo |
|||
|
|||
# adduser odoo |
|||
|
|||
##### 2) installation de postgresql (DBMS) |
|||
|
|||
# apt-get install postgresql |
|||
|
|||
##### 3) install git |
|||
|
|||
# apt-get install git |
|||
|
|||
##### 4) installer pip : python package manager |
|||
|
|||
# apt-get install python-pip |
|||
|
|||
##### 5) installation des paquets devel pour compilation des bibliothèques python |
|||
|
|||
# apt-get install python-dev postgresql-server-dev-all libjpeg-dev zlib1g-dev libpng12-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev |
|||
|
|||
##### 6) installation de node-less |
|||
|
|||
# apt-get install node-less |
|||
|
|||
##### 7) clone odoo |
|||
|
|||
# su odoo |
|||
$ cd /home/odoo |
|||
$ git clone https://github.com/odoo/odoo.git |
|||
|
|||
##### 8) installer bibliothèque python |
|||
|
|||
$ exit |
|||
# cd /home/odoo/odoo |
|||
# pip install -r requirements.txt |
|||
|
|||
##### 9) créer odoo user pour postgresql avec les droits de création de base de donnée |
|||
|
|||
# su postgres |
|||
$ createuser -d odoo |
|||
$ exit |
|||
|
|||
##### 10) Installer wkhtml to pdf 0.12.1 !! (pas une autre) (sur une machine 64 bit avec un ubuntu 64bit 14.04) |
|||
|
|||
# apt-get install fontconfig libfontconfig1 libxrender1 fontconfig-config |
|||
# wget http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb |
|||
# dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb |
|||
# cd /usr/local/bin/ |
|||
# cp wkhtmltoimage /usr/bin/wkhtmltoimage |
|||
# cp wkhtmltopdf /usr/bin/wkhtmltopdf |
|||
|
|||
##### 11) Tester l'installation de odoo |
|||
|
|||
# su odoo |
|||
$ cd /home/odoo/odoo |
|||
$ ./odoo.py |
|||
|
|||
lancer le navigateur http://localhost:8069 la page de création de base de donnée d'odoo devrait s'ouvrir, essayé de créer une base de donnée |
|||
|
|||
ctrl + c pour tuer le processus odoo depuis la console |
|||
|
|||
## Pour aller plus loin: init.d script |
|||
|
|||
|
|||
##### 1) créer un répertoire de log |
|||
|
|||
# su odoo |
|||
$ mkdir /home/odoo/log |
|||
|
|||
|
|||
##### 2) créer fichier de config odoo |
|||
|
|||
$ cd /home/odoo/odoo |
|||
$ ./odoo.py -s -c /home/odoo/odoo.conf --stop-after-init --logfile=/home/odoo/log/odoo.log |
|||
|
|||
|
|||
##### 3) Créer le fichier init.d |
|||
|
|||
$ exit |
|||
$ vim /etc/init.d/odoo |
|||
|
|||
copier le contenu dans le fichier (gedit va aussi bien que vim) |
|||
|
|||
|
|||
#!/bin/sh |
|||
|
|||
### BEGIN INIT INFO |
|||
# Provides: openerp-server |
|||
# Required-Start: $remote_fs $syslog |
|||
# Required-Stop: $remote_fs $syslog |
|||
# Should-Start: $network |
|||
# Should-Stop: $network |
|||
# Default-Start: 2 3 4 5 |
|||
# Default-Stop: 0 1 6 |
|||
# Short-Description: Enterprise Resource Management software |
|||
# Description: Open ERP is a complete ERP and CRM software. |
|||
### END INIT INFO |
|||
|
|||
PATH=/bin:/sbin:/usr/bin |
|||
DAEMON=/home/odoo/odoo/odoo.py |
|||
NAME=odoo |
|||
DESC=odoo |
|||
|
|||
# Specify the user name (Default: openerp). |
|||
USER=odoo |
|||
|
|||
# Specify an alternate config file (Default: /etc/openerp-server.conf). |
|||
CONFIGFILE="/home/odoo/odoo.conf" |
|||
|
|||
# pidfile |
|||
PIDFILE=/var/run/$NAME.pid |
|||
|
|||
# Additional options that are passed to the Daemon. |
|||
DAEMON_OPTS="-c $CONFIGFILE" |
|||
|
|||
[ -x $DAEMON ] || exit 0 |
|||
[ -f $CONFIGFILE ] || exit 0 |
|||
|
|||
checkpid() { |
|||
[ -f $PIDFILE ] || return 1 |
|||
pid=`cat $PIDFILE` |
|||
[ -d /proc/$pid ] && return 0 |
|||
pid=`cat $PIDFILE` |
|||
[ -d /proc/$pid ] && return 0 |
|||
return 1 |
|||
} |
|||
|
|||
case "${1}" in |
|||
start) |
|||
echo -n "Starting ${DESC}: " |
|||
|
|||
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \ |
|||
--chuid ${USER} --background --make-pidfile \ |
|||
--exec ${DAEMON} -- ${DAEMON_OPTS} |
|||
|
|||
echo "${NAME}." |
|||
;; |
|||
|
|||
stop) |
|||
echo -n "Stopping ${DESC}: " |
|||
|
|||
start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \ |
|||
--oknodo |
|||
|
|||
echo "${NAME}." |
|||
;; |
|||
|
|||
restart|force-reload) |
|||
echo -n "Restarting ${DESC}: " |
|||
|
|||
start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \ |
|||
--oknodo |
|||
|
|||
sleep 1 |
|||
|
|||
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \ |
|||
--chuid ${USER} --background --make-pidfile \ |
|||
--exec ${DAEMON} -- ${DAEMON_OPTS} |
|||
|
|||
echo "${NAME}." |
|||
|
|||
echo "${NAME}." |
|||
;; |
|||
|
|||
*) |
|||
N=/etc/init.d/${NAME} |
|||
echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2 |
|||
exit 1 |
|||
;; |
|||
esac |
|||
|
|||
exit 0 |
|||
|
|||
|
|||
##### 4) donner les bons droits au fichier |
|||
|
|||
# chmod 755 /etc/init.d/odoo |
|||
|
|||
|
|||
##### 5) tester le script |
|||
|
|||
# /etc/init.d/odoo start |
|||
|
|||
tester à nouveau sur localhost:8069 |
|||
|
|||
|
|||
##### 6) faire en sorte que le script s'exécute au démarrage |
|||
|
|||
# update-rc.d odoo defaults |
|||
|
|||
|
|||
## Pour aller plus loin: proxy nginx |
|||
|
|||
|
|||
##### 1) installer nginx |
|||
|
|||
# apt-get install nginx |
|||
|
|||
vous pouvez tester l'installation réussie sur http://localhost |
|||
|
|||
|
|||
##### 2) configurer nginx pour odoo : editer le fichier de conf |
|||
|
|||
# vim /etc/nginx/sites-enabled/default |
|||
|
|||
supprimer le contenu et le remplacer par |
|||
|
|||
upstream odoo { |
|||
server 127.0.0.1:8069 weight=1 fail_timeout=300s; |
|||
} |
|||
|
|||
server { |
|||
# server port and name |
|||
listen 80; |
|||
server_name localhost; |
|||
|
|||
|
|||
location / { |
|||
proxy_pass http://odoo; |
|||
# force timeouts if the backend dies |
|||
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; |
|||
|
|||
# set headers |
|||
proxy_set_header Host $host; |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for; |
|||
|
|||
} |
|||
} |
|||
|
|||
|
|||
##### 3) tester la config et relancer nginx |
|||
|
|||
# nginx -t |
|||
# nginx -s reload |
|||
|
|||
tester http://localhost |
|||
|
|||
devrait conduire à odoo (ne pas oublier de vider le cache de son navigateur au cas ou ca ne marche pas tout de suite) |
|||
|
|||
## Sécurité |
|||
|
|||
> odoo plus accessible sur le port et changer le master password |
|||
|
|||
a) editer fichier de conf de odoo |
|||
|
|||
# vim /home/odoo/odoo.conf |
|||
|
|||
changer |
|||
|
|||
admin_passwd = admin |
|||
xmlrpc_interface = |
|||
|
|||
pour |
|||
|
|||
admin_passwd = secret_password |
|||
xmlrpc_interface = 127.0.0.1 |
|||
|
|||
b) redémarrer odoo |
|||
|
|||
# /etc/init.d/odoo restart |
|||
|
|||
> odoo plus accessible sur le port et changer le master password |
|||
|
|||
a) editer fichier de conf de odoo |
|||
|
|||
# vim /home/odoo/odoo.conf |
|||
|
|||
changer |
|||
|
|||
admin_passwd = admin |
|||
xmlrpc_interface = |
|||
|
|||
pour |
|||
|
|||
admin_passwd = secret_password |
|||
xmlrpc_interface = 127.0.0.1 |
|||
|
|||
b) redémarrer odoo |
|||
|
|||
# /etc/init.d/odoo restart |
@ -1 +1 @@ |
|||
from . import models |
|||
from . import models |
@ -1,23 +1,15 @@ |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
{ |
|||
'name': "Macavrac Base Module", |
|||
|
|||
'summary': """ |
|||
"name": "Macavrac Base Module", |
|||
"summary": """ |
|||
Module with basic customizations for the Macavrac cooperative. |
|||
""", |
|||
|
|||
'description': """ |
|||
"description": """ |
|||
""", |
|||
|
|||
'author': "Patricia Daloze", |
|||
|
|||
'category': 'Sales', |
|||
'version': '12.0.1.0.0', |
|||
|
|||
'depends': ['beesdoo_shift', 'contacts'], |
|||
|
|||
'data': [ |
|||
'views/res_partner.xml', |
|||
], |
|||
'installable': True, |
|||
"author": "Patricia Daloze", |
|||
"category": "Sales", |
|||
"version": "12.0.1.0.0", |
|||
"depends": ["beesdoo_shift", "contacts"], |
|||
"data": ["views/res_partner.xml"], |
|||
"installable": True, |
|||
} |
@ -1 +1 @@ |
|||
from . import res_partner |
|||
from . import res_partner |
@ -1,49 +1,81 @@ |
|||
from odoo import models, fields, api, _ |
|||
from odoo import _, api, fields, models |
|||
from odoo.exceptions import ValidationError |
|||
|
|||
|
|||
class Partner(models.Model): |
|||
|
|||
_inherit = 'res.partner' |
|||
_inherit = "res.partner" |
|||
|
|||
date_stamp = fields.Date(string="Timestamp", help="Date de remplissage du formulaire") |
|||
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") |
|||
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") |
|||
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? |
|||
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 |
|||
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. |
|||
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="") |
|||
|
|||
is_worker = fields.Boolean( |
|||
compute="_compute_is_worker", |
|||
search="_search_is_worker", |
|||
string="is Worker", |
|||
readonly=True, |
|||
related="", |
|||
) |
|||
|
|||
@api.depends('share_qty') |
|||
@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 |
|||
rec.share_amount = ( |
|||
rec.share_qty * 25.0 |
|||
) # TODO add ir.config_parameter to make this amount editable |
|||
|
|||
|
|||
@api.depends('cooperator_type') |
|||
@api.depends("cooperator_type") |
|||
def _compute_is_worker(self): |
|||
for rec in self: |
|||
rec.is_worker = rec.cooperator_type == 'share_b' |
|||
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')] |
|||
if (operator == "=" and value) or (operator == "!=" and not value): |
|||
return [("cooperator_type", "=", "share_b")] |
|||
else: |
|||
return [('cooperator_type', '!=', 'share_b')] |
|||
return [("cooperator_type", "!=", "share_b")] |
Write
Preview
Loading…
Cancel
Save
Reference in new issue