Browse Source
Adding beesdoo_base module (version 9.0)
Adding beesdoo_base module (version 9.0)
The beesdoo_base module is added, before upgrading it to version 12.0. Commits history can be found on branch 9.0, here : https://github.com/beescoop/Obeesdoo/commits/9.0/beesdoo_basepull/105/head
Elouan
5 years ago
24 changed files with 1076 additions and 0 deletions
-
4beesdoo_base/__init__.py
-
29beesdoo_base/__openerp__.py
-
1beesdoo_base/controllers/__init__.py
-
73beesdoo_base/controllers/report.py
-
10beesdoo_base/data/default_contact.xml
-
321beesdoo_base/i18n/fr_BE.po
-
1beesdoo_base/models/__init__.py
-
24beesdoo_base/models/membercard.py
-
91beesdoo_base/models/partner.py
-
177beesdoo_base/report/beescard.xml
-
6beesdoo_base/security/groups.xml
-
2beesdoo_base/security/ir.model.access.csv
-
BINbeesdoo_base/static/font/Roboto-Bold.ttf
-
BINbeesdoo_base/static/font/Roboto-Regular.ttf
-
BINbeesdoo_base/static/src/img/blueline.png
-
BINbeesdoo_base/static/src/img/logo.png
-
BINbeesdoo_base/static/src/img/redline.png
-
120beesdoo_base/views/partner.xml
-
2beesdoo_base/wizard/__init__.py
-
52beesdoo_base/wizard/member_card.py
-
21beesdoo_base/wizard/partner.py
-
26beesdoo_base/wizard/portal_wizard.py
-
82beesdoo_base/wizard/views/member_card.xml
-
34beesdoo_base/wizard/views/partner.xml
@ -0,0 +1,4 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
import models |
||||
|
import wizard |
||||
|
import controllers |
@ -0,0 +1,29 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
{ |
||||
|
'name': "Beescoop Base Module", |
||||
|
|
||||
|
'summary': """ |
||||
|
Module that customize the base module and contains some python tools |
||||
|
""", |
||||
|
|
||||
|
'description': """ |
||||
|
""", |
||||
|
|
||||
|
'author': "Beescoop - Cellule IT", |
||||
|
'website': "https://github.com/beescoop/Obeesdoo", |
||||
|
|
||||
|
'category': 'Project Management', |
||||
|
'version': '9.0.1.0.1', |
||||
|
|
||||
|
'depends': ['point_of_sale', 'purchase', 'report', 'portal', 'partner_firstname'], |
||||
|
|
||||
|
'data': [ |
||||
|
'security/groups.xml', |
||||
|
'security/ir.model.access.csv', |
||||
|
'views/partner.xml', |
||||
|
'wizard/views/member_card.xml', |
||||
|
'wizard/views/partner.xml', |
||||
|
'data/default_contact.xml', |
||||
|
'report/beescard.xml', |
||||
|
], |
||||
|
} |
@ -0,0 +1 @@ |
|||||
|
import report |
@ -0,0 +1,73 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Part of Odoo. See LICENSE file for full copyright and licensing details. |
||||
|
|
||||
|
from openerp.addons.web.http import Controller, route, request |
||||
|
from openerp.addons.web.controllers.main import _serialize_exception, content_disposition |
||||
|
from openerp.tools import html_escape |
||||
|
|
||||
|
import json |
||||
|
import time |
||||
|
from werkzeug import url_decode |
||||
|
from werkzeug.test import Client |
||||
|
from werkzeug.wrappers import BaseResponse |
||||
|
from werkzeug.datastructures import Headers |
||||
|
|
||||
|
from openerp.addons.report.controllers.main import ReportController |
||||
|
from openerp.tools.safe_eval import safe_eval |
||||
|
|
||||
|
|
||||
|
class ReportCustom(ReportController): |
||||
|
|
||||
|
@route(['/report/download'], type='http', auth="user") |
||||
|
def report_download(self, data, token): |
||||
|
"""This function is used by 'qwebactionmanager.js' in order to trigger the download of |
||||
|
a pdf/controller report. |
||||
|
|
||||
|
:param data: a javascript array JSON.stringified containg report internal url ([0]) and |
||||
|
type [1] |
||||
|
:returns: Response with a filetoken cookie and an attachment header |
||||
|
""" |
||||
|
requestcontent = json.loads(data) |
||||
|
url, type = requestcontent[0], requestcontent[1] |
||||
|
try: |
||||
|
if type == 'qweb-pdf': |
||||
|
reportname = url.split('/report/pdf/')[1].split('?')[0] |
||||
|
|
||||
|
docids = None |
||||
|
if '/' in reportname: |
||||
|
reportname, docids = reportname.split('/') |
||||
|
|
||||
|
if docids: |
||||
|
# Generic report: |
||||
|
response = self.report_routes(reportname, docids=docids, converter='pdf') |
||||
|
else: |
||||
|
# Particular report: |
||||
|
data = url_decode(url.split('?')[1]).items() # decoding the args represented in JSON |
||||
|
response = self.report_routes(reportname, converter='pdf', **dict(data)) |
||||
|
|
||||
|
cr, uid = request.cr, request.uid |
||||
|
report = request.registry['report']._get_report_from_name(cr, uid, reportname) |
||||
|
filename = "%s.%s" % (report.name, "pdf") |
||||
|
if docids: |
||||
|
ids = [int(x) for x in docids.split(",")] |
||||
|
obj = request.env[report.model].browse(ids) |
||||
|
if report.attachment and not len(obj) > 1: |
||||
|
filename = safe_eval(report.attachment, {'object': obj, 'time': time}) |
||||
|
response.headers.add('Content-Disposition', content_disposition(filename)) |
||||
|
response.set_cookie('fileToken', token) |
||||
|
return response |
||||
|
elif type =='controller': |
||||
|
reqheaders = Headers(request.httprequest.headers) |
||||
|
response = Client(request.httprequest.app, BaseResponse).get(url, headers=reqheaders, follow_redirects=True) |
||||
|
response.set_cookie('fileToken', token) |
||||
|
return response |
||||
|
else: |
||||
|
return |
||||
|
except Exception, e: |
||||
|
se = _serialize_exception(e) |
||||
|
error = { |
||||
|
'code': 200, |
||||
|
'message': "Odoo Server Error", |
||||
|
'data': se |
||||
|
} |
||||
|
return request.make_response(html_escape(json.dumps(error))) |
@ -0,0 +1,10 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<data noupdate="1"> |
||||
|
<record model="res.partner" id="commande_beescoop"> |
||||
|
<field name="name">commande@bees-coop.be</field> |
||||
|
<field name="email">commande@bees-coop.be</field> |
||||
|
<field name="active">True</field> |
||||
|
</record> |
||||
|
</data> |
||||
|
</odoo> |
@ -0,0 +1,321 @@ |
|||||
|
# Translation of Odoo Server. |
||||
|
# This file contains the translation of the following modules: |
||||
|
# * beesdoo_base |
||||
|
# |
||||
|
msgid "" |
||||
|
msgstr "" |
||||
|
"Project-Id-Version: Odoo Server 9.0c\n" |
||||
|
"Report-Msgid-Bugs-To: \n" |
||||
|
"POT-Creation-Date: 2016-11-13 15:16+0000\n" |
||||
|
"PO-Revision-Date: 2016-11-13 15:16+0000\n" |
||||
|
"Last-Translator: <>\n" |
||||
|
"Language-Team: \n" |
||||
|
"MIME-Version: 1.0\n" |
||||
|
"Content-Type: text/plain; charset=UTF-8\n" |
||||
|
"Content-Transfer-Encoding: \n" |
||||
|
"Plural-Forms: \n" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_member_card_valid |
||||
|
msgid "Active" |
||||
|
msgstr "Actif" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_member_card_barcode |
||||
|
msgid "Barcode" |
||||
|
msgstr "Code Barre" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:res.groups,name:beesdoo_base.group_force_barcode |
||||
|
msgid "Bees Card Force Barcode" |
||||
|
msgstr "Bees Card Force Barcode" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.ui.view,arch_db:beesdoo_base.Eater Wizard |
||||
|
#: model:ir.ui.view,arch_db:beesdoo_base.MemberCard Wizard |
||||
|
#: model:ir.ui.view,arch_db:beesdoo_base.membercard_set_as_printed_wizard |
||||
|
#: model:ir.ui.view,arch_db:beesdoo_base.printing_membercard_request_wizard |
||||
|
msgid "Cancel" |
||||
|
msgstr "Annuler" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.ui.view,arch_db:beesdoo_base.beesdoo_partner_form_view |
||||
|
msgid "Cards" |
||||
|
msgstr "Cards" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_res_partner_child_eater_ids |
||||
|
msgid "Child eater ids" |
||||
|
msgstr "Child eater ids" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.ui.view,arch_db:beesdoo_base.Eater Wizard |
||||
|
#: model:ir.ui.view,arch_db:beesdoo_base.MemberCard Wizard |
||||
|
msgid "Create" |
||||
|
msgstr "Créer" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.ui.view,arch_db:beesdoo_base.Eater Wizard |
||||
|
msgid "Create a new eater" |
||||
|
msgstr "Create a new eater" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_eater_new_wizard_create_uid |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_member_card_create_uid |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_new_wizard_create_uid |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_requestprinting_wizard_create_uid |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_set_as_printed_wizard_create_uid |
||||
|
msgid "Created by" |
||||
|
msgstr "Créé par" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_eater_new_wizard_create_date |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_member_card_create_date |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_new_wizard_create_date |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_requestprinting_wizard_create_date |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_set_as_printed_wizard_create_date |
||||
|
msgid "Created on" |
||||
|
msgstr "Créé le" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_eater_new_wizard_display_name |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_member_card_display_name |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_new_wizard_display_name |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_requestprinting_wizard_display_name |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_set_as_printed_wizard_display_name |
||||
|
msgid "Display Name" |
||||
|
msgstr "Nom affiché" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: selection:res.partner,eater:0 |
||||
|
msgid "Eater" |
||||
|
msgstr "Eater" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_res_partner_eater |
||||
|
msgid "Eater/Worker" |
||||
|
msgstr "Eater/Worker" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.ui.view,arch_db:beesdoo_base.beesdoo_partner_form_view |
||||
|
msgid "Eaters" |
||||
|
msgstr "Eaters" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_eater_new_wizard_email |
||||
|
msgid "Email" |
||||
|
msgstr "Courriel" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_member_card_end_date |
||||
|
msgid "Expiration Date" |
||||
|
msgstr "Date d'expiration" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_eater_new_wizard_first_name |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_res_partner_first_name |
||||
|
#: model:ir.ui.view,arch_db:beesdoo_base.beesdoo_partner_form_view |
||||
|
msgid "First Name" |
||||
|
msgstr "Prénom" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_new_wizard_force_barcode |
||||
|
msgid "Force Barcode" |
||||
|
msgstr "Force Barcode" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_eater_new_wizard_id |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_member_card_id |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_new_wizard_id |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_requestprinting_wizard_id |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_set_as_printed_wizard_id |
||||
|
msgid "ID" |
||||
|
msgstr "ID" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_eater_new_wizard___last_update |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_member_card___last_update |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_new_wizard___last_update |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_requestprinting_wizard___last_update |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_set_as_printed_wizard___last_update |
||||
|
msgid "Last Modified on" |
||||
|
msgstr "Dernière modification le" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_eater_new_wizard_last_name |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_res_partner_last_name |
||||
|
#: model:ir.ui.view,arch_db:beesdoo_base.beesdoo_partner_form_view |
||||
|
msgid "Last Name" |
||||
|
msgstr "Nom" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_eater_new_wizard_write_uid |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_member_card_write_uid |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_new_wizard_write_uid |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_requestprinting_wizard_write_uid |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_set_as_printed_wizard_write_uid |
||||
|
msgid "Last Updated by" |
||||
|
msgstr "Mis à jour par" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_eater_new_wizard_write_date |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_member_card_write_date |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_new_wizard_write_date |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_requestprinting_wizard_write_date |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_set_as_printed_wizard_write_date |
||||
|
msgid "Last Updated on" |
||||
|
msgstr "Mis à jour le" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_res_partner_last_printed |
||||
|
msgid "Last printed on" |
||||
|
msgstr "Last printed on" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.ui.view,arch_db:beesdoo_base.beesdoo_partner_form_view |
||||
|
msgid "Member Card" |
||||
|
msgstr "Member Card" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_res_partner_member_card_ids |
||||
|
msgid "Member card ids" |
||||
|
msgstr "Member card ids" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.ui.view,arch_db:beesdoo_base.beesdoo_partner_form_view |
||||
|
msgid "New Card" |
||||
|
msgstr "New Card" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.actions.act_window,name:beesdoo_base.action_eater_wizard |
||||
|
#: model:ir.ui.view,arch_db:beesdoo_base.beesdoo_partner_form_view |
||||
|
msgid "New Eater" |
||||
|
msgstr "New Eater" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.actions.act_window,name:beesdoo_base.action_membercard_wizard |
||||
|
msgid "New Member Card" |
||||
|
msgstr "New Member Card" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_res_partner_parent_barcode |
||||
|
msgid "Parent Barcode" |
||||
|
msgstr "Parent Barcode" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_res_partner_parent_eater_id |
||||
|
msgid "Parent Worker" |
||||
|
msgstr "Parent Worker" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model,name:beesdoo_base.model_res_partner |
||||
|
msgid "Partner" |
||||
|
msgstr "Partenaire" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_eater_new_wizard_partner_id |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_member_card_partner_id |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_new_wizard_partner_id |
||||
|
msgid "Partner id" |
||||
|
msgstr "Partner id" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_requestprinting_wizard_partner_ids |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_set_as_printed_wizard_partner_ids |
||||
|
msgid "Partner ids" |
||||
|
msgstr "Partner ids" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_res_partner_member_card_to_be_printed |
||||
|
msgid "Print BEES card?" |
||||
|
msgstr "Print BEES card?" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.ui.view,arch_db:beesdoo_base.beesdoo_partner_form_view |
||||
|
msgid "Printing" |
||||
|
msgstr "Printing" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_member_card_comment |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_membercard_new_wizard_new_comment |
||||
|
#: model:ir.ui.view,arch_db:beesdoo_base.MemberCard Wizard |
||||
|
msgid "Reason" |
||||
|
msgstr "Motif" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.actions.act_window,name:beesdoo_base.beesdoo_base_action_request_membercard_printing |
||||
|
msgid "Request BEES card printing" |
||||
|
msgstr "Request BEES card printing" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.ui.view,arch_db:beesdoo_base.printing_membercard_request_wizard |
||||
|
msgid "Request Beescard Printing" |
||||
|
msgstr "Request Beescard Printing" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.ui.view,arch_db:beesdoo_base.printing_membercard_request_wizard |
||||
|
msgid "Request Printing for" |
||||
|
msgstr "Request Printing for" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model.fields,field_description:beesdoo_base.field_member_card_responsible_id |
||||
|
msgid "Responsible" |
||||
|
msgstr "Responsable" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.actions.act_window,name:beesdoo_base.beesdoo_base_action_set_membercard_as_printed |
||||
|
msgid "Set BEES card as printed" |
||||
|
msgstr "Set BEES card as printed" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.ui.view,arch_db:beesdoo_base.membercard_set_as_printed_wizard |
||||
|
msgid "Set as Printed" |
||||
|
msgstr "Set as Printed" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.ui.view,arch_db:beesdoo_base.membercard_set_as_printed_wizard |
||||
|
msgid "Set as Printed for" |
||||
|
msgstr "Set as Printed for" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: selection:res.partner,eater:0 |
||||
|
msgid "Worker and Eater" |
||||
|
msgstr "Worker and Eater" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: code:addons/beesdoo_base/models/partner.py:42 |
||||
|
#, python-format |
||||
|
msgid "You can only set two additional eaters per worker" |
||||
|
msgstr "You can only set two additional eaters per worker" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: code:addons/beesdoo_base/models/partner.py:47 |
||||
|
#, python-format |
||||
|
msgid "You try to assign a eater to a worker but this easer is alread assign to %s please remove it before" |
||||
|
msgstr "You try to assign a eater to a worker but this easer is alread assign to %s please remove it before" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model,name:beesdoo_base.model_eater_new_wizard |
||||
|
msgid "eater.new.wizard" |
||||
|
msgstr "eater.new.wizard" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model,name:beesdoo_base.model_member_card |
||||
|
msgid "member.card" |
||||
|
msgstr "member.card" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model,name:beesdoo_base.model_membercard_new_wizard |
||||
|
msgid "membercard.new.wizard" |
||||
|
msgstr "membercard.new.wizard" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model,name:beesdoo_base.model_membercard_requestprinting_wizard |
||||
|
msgid "membercard.requestprinting.wizard" |
||||
|
msgstr "membercard.requestprinting.wizard" |
||||
|
|
||||
|
#. module: beesdoo_base |
||||
|
#: model:ir.model,name:beesdoo_base.model_membercard_set_as_printed_wizard |
||||
|
msgid "membercard.set_as_printed.wizard" |
||||
|
msgstr "membercard.set_as_printed.wizard" |
||||
|
|
@ -0,0 +1 @@ |
|||||
|
import partner, membercard |
@ -0,0 +1,24 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
from openerp import models, fields, api |
||||
|
import uuid |
||||
|
|
||||
|
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] |
||||
|
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)) |
||||
|
|
||||
|
_name = 'member.card' |
||||
|
_order = 'create_date desc' |
||||
|
|
||||
|
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") |
||||
|
end_date = fields.Date(readonly=True, string="Expiration Date") |
||||
|
comment = fields.Char("Reason", required=True) |
@ -0,0 +1,91 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
from openerp import models, fields, api, _ |
||||
|
from openerp.exceptions import ValidationError |
||||
|
|
||||
|
class Partner(models.Model): |
||||
|
|
||||
|
_inherit = 'res.partner' |
||||
|
|
||||
|
eater = fields.Selection([('eater', 'Eater'), ('worker_eater', 'Worker and Eater')], string="Eater/Worker") |
||||
|
child_eater_ids = fields.One2many("res.partner", "parent_eater_id", domain=[('customer', '=', True), |
||||
|
('eater', '=', 'eater')]) |
||||
|
parent_eater_id = fields.Many2one("res.partner", string="Parent Worker", readonly=True) |
||||
|
barcode = fields.Char(compute="_get_bar_code", string='Barcode', store=True) |
||||
|
parent_barcode = fields.Char(compute="_get_bar_code", string='Parent Barcode', store=True) |
||||
|
member_card_ids = fields.One2many('member.card', 'partner_id') |
||||
|
country_id = fields.Many2one(required=True, default=lambda self: self.env.ref('base.be')) |
||||
|
|
||||
|
member_card_to_be_printed = fields.Boolean('Print BEES card?') |
||||
|
last_printed = fields.Datetime('Last printed on') |
||||
|
cooperator_type = fields.Selection([('share_a', 'Share A'), ('share_b', 'Share B'), ('share_c', 'Share C')], store=True, compute=None) |
||||
|
|
||||
|
|
||||
|
@api.one |
||||
|
@api.depends('parent_eater_id', 'parent_eater_id.barcode', 'eater', 'member_card_ids') |
||||
|
def _get_bar_code(self): |
||||
|
if self.eater == 'eater': |
||||
|
self.parent_barcode = self.parent_eater_id.barcode |
||||
|
elif self.member_card_ids: |
||||
|
for c in self.member_card_ids: |
||||
|
if c.valid: |
||||
|
self.barcode = c.barcode |
||||
|
|
||||
|
@api.one |
||||
|
@api.constrains('child_eater_ids', 'parent_eater_id') |
||||
|
def _check_number_of_eaters(self): |
||||
|
"""The owner of an A share can have a maximum of two eaters but |
||||
|
the owner of a B share can have a maximum of three eaters. |
||||
|
""" |
||||
|
# Get the default_code of the share for the current eater and his parent |
||||
|
share_type_code = self.cooperator_type |
||||
|
parent_share_type_code = self.parent_eater_id.cooperator_type |
||||
|
# Raise exception |
||||
|
if share_type_code == 'share_b' or parent_share_type_code == 'share_b': |
||||
|
if len(self.child_eater_ids) > 3 or len(self.parent_eater_id.child_eater_ids) > 3: |
||||
|
raise ValidationError(_('You can only set three additional eaters per worker')) |
||||
|
else: |
||||
|
if len(self.child_eater_ids) > 2 or len(self.parent_eater_id.child_eater_ids) > 2: |
||||
|
raise ValidationError(_('You can only set two additional eaters per worker')) |
||||
|
|
||||
|
|
||||
|
@api.multi |
||||
|
def write(self, values): |
||||
|
if values.get('parent_eater_id') and self.parent_eater_id: |
||||
|
raise ValidationError(_('You try to assign a eater to a worker but this easer is alread assign to %s please remove it before') % self.parent_eater_id.name) |
||||
|
# replace many2many command when writing on child_eater_ids to just remove the link |
||||
|
if 'child_eater_ids' in values: |
||||
|
for command in values['child_eater_ids']: |
||||
|
if command[0] == 2: |
||||
|
command[0] = 3 |
||||
|
return super(Partner, self).write(values) |
||||
|
|
||||
|
@api.one |
||||
|
def _deactivate_active_cards(self): |
||||
|
for card in self.member_card_ids.filtered('valid'): |
||||
|
card.valid = False |
||||
|
card.end_date = fields.Date.today() |
||||
|
|
||||
|
@api.multi |
||||
|
def _new_card(self, reason, user_id, barcode=False): |
||||
|
card_data = { |
||||
|
'partner_id' : self.id, |
||||
|
'responsible_id' : user_id, |
||||
|
'comment' : reason, |
||||
|
} |
||||
|
if barcode: |
||||
|
card_data['barcode'] = barcode |
||||
|
self.env['member.card'].create(card_data) |
||||
|
|
||||
|
@api.multi |
||||
|
def _new_eater(self, surname, name, email): |
||||
|
partner_data = { |
||||
|
|
||||
|
'lastname' : name, |
||||
|
'firstname' : surname, |
||||
|
'is_customer' : True, |
||||
|
'eater' : 'eater', |
||||
|
'parent_eater_id' : self.id, |
||||
|
'email' : email, |
||||
|
'country_id' : self.country_id.id |
||||
|
} |
||||
|
return self.env['res.partner'].create(partner_data) |
@ -0,0 +1,177 @@ |
|||||
|
<odoo> |
||||
|
|
||||
|
<report id="report_beescard_cm" string="Beescaard" model="res.partner" |
||||
|
report_type="qweb-html" file="beesdoo_base.beescard_template_cm" |
||||
|
name="beesdoo_base.beescard_template_cm" /> |
||||
|
|
||||
|
<!-- Use paper format a4 low margin --> |
||||
|
|
||||
|
<template id="beescard_template_cm"> |
||||
|
<head> |
||||
|
<style type="text/css"> |
||||
|
/* Roboto Regular */ |
||||
|
@font-face { |
||||
|
font-family: 'Roboto-Regular'; |
||||
|
font-style: normal; |
||||
|
src: local('Roboto Regular'), |
||||
|
url('/beesdoo_base/static/font/Roboto-Regular.ttf') |
||||
|
format('truetype'); |
||||
|
} |
||||
|
/* Roboto Bold */ |
||||
|
@font-face { |
||||
|
font-family: 'Roboto-Bold'; |
||||
|
font-style: normal; |
||||
|
src: local('Roboto Bold'), |
||||
|
url('/beesdoo_base/static/font/Roboto-Bold.ttf') |
||||
|
format('truetype'); |
||||
|
} |
||||
|
</style> |
||||
|
</head> |
||||
|
|
||||
|
<!-- X1.133 --> |
||||
|
<t t-call="report.html_container"> |
||||
|
<div class="page"> |
||||
|
|
||||
|
|
||||
|
<t t-foreach="docs" t-as="partner"> |
||||
|
<table |
||||
|
style="width: 14.02cm;height: 9.39cm;table-layout:fixed;display: inline-block;"> |
||||
|
<tr> |
||||
|
<td |
||||
|
style="border-bottom: 1px solid black;width: 0.66cm;height: 0.66cm;"></td> |
||||
|
<td |
||||
|
style="border-left: 1px solid black;border-right: 1px solid black;" |
||||
|
colspan="2"></td> |
||||
|
<td |
||||
|
style="border-bottom: 1px solid black;width: 0.66cm;height: 0.66cm;"></td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td></td> |
||||
|
<td |
||||
|
style="width: 4.98cm;vertical-align:bottom;height: 6.87cm;"> |
||||
|
<div |
||||
|
style="padding-top:0.2cm;padding-left:0.1cm;padding-bottom:0.2cm;"> |
||||
|
<img alt="Embedded Image" |
||||
|
t-att-src="'data:image/png;base64,' + partner.image" |
||||
|
style="width:4.7cm;height:6.4cm" /> |
||||
|
</div> |
||||
|
</td> |
||||
|
<td |
||||
|
style="vertical-align:top;width:7.72cm;height: 6.87cm;position: relative;"> |
||||
|
<p style="text-align: left;padding-top: 0.2cm;font-size: 1.2em;"> |
||||
|
<span t-raw="partner.firstname and partner.firstname[:30] or ''" style="font-family:Roboto-Regular" /> |
||||
|
<br /> |
||||
|
<span t-raw="partner.lastname and partner.lastname[:26] or ''" style="font-family:Roboto-Bold;" /> |
||||
|
<br /> |
||||
|
</p> |
||||
|
<p style="text-align: left;padding-top: 0.2cm;font-size: 1em;"> |
||||
|
|
||||
|
<t t-if="partner.parent_eater_id and partner.eater == 'eater'"> |
||||
|
<!--fix here --> |
||||
|
<span t-raw="partner.parent_eater_id.firstname and partner.parent_eater_id.firstname[:30] or ''" style="font-family:Roboto-Regular;" /> |
||||
|
<span t-raw="partner.parent_eater_id.lastname and partner.parent_eater_id.lastname[:26] or ''" style="font-family:Roboto-Regular;" /> |
||||
|
</t> |
||||
|
|
||||
|
<t t-if="partner.parent_eater_id and partner.parent_eater_id.cooperator_type == 'share_b'"> |
||||
|
<!--fix here never true--> |
||||
|
<span |
||||
|
t-raw="'[' + (partner.parent_eater_id.name[:60] or '') + ']'" |
||||
|
style="font-family:Roboto-Regular" /> |
||||
|
</t> |
||||
|
|
||||
|
</p> |
||||
|
<div style="position: absolute;bottom: 0;"> |
||||
|
<div style="padding-top:0.3cm"> |
||||
|
<img |
||||
|
t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s&humanreadable=%s'%('EAN13', partner.barcode if not partner.parent_eater_id else partner.parent_barcode, 340, 70, 1)" |
||||
|
style="width:7.2cm;height:2.52cm" /> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div |
||||
|
style="padding-top:0.2cm;padding-bottom:0.2cm;"> |
||||
|
<t t-if="partner.cooperator_type == 'share_a' or partner.parent_eater_id.cooperator_type == 'share_a'"> |
||||
|
<img |
||||
|
src="/beesdoo_base/static/src/img/redline.png" |
||||
|
style="width:7.2cm;height:0.2cm" /> |
||||
|
</t> |
||||
|
<t t-if="partner.cooperator_type == 'share_b' or partner.parent_eater_id.cooperator_type == 'share_b'"> |
||||
|
<img |
||||
|
src="/beesdoo_base/static/src/img/blueline.png" |
||||
|
style="width:7.2cm;height:0.2cm" /> |
||||
|
</t> |
||||
|
</div> |
||||
|
</div> |
||||
|
</td> |
||||
|
<td></td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td></td> |
||||
|
<td colspan="2" |
||||
|
style="vertical-align:center;height: 1.20cm;"> |
||||
|
<p |
||||
|
style="text-align:center;font-size:0.8em;font-family:Roboto-Regular">En cas de perte, |
||||
|
prévenez-nous via |
||||
|
membre@bees-coop.be |
||||
|
</p> |
||||
|
</td> |
||||
|
<td></td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td |
||||
|
style="border-top: 1px solid black;width: 0.66cm;height: 0.66cm;"></td> |
||||
|
<td |
||||
|
style="border-left: 1px solid black;border-right: 1px solid black;" |
||||
|
colspan="2"></td> |
||||
|
<td |
||||
|
style="border-top: 1px solid black;width: 0.66cm;height: 0.66cm;"></td> |
||||
|
</tr> |
||||
|
</table> |
||||
|
|
||||
|
<table |
||||
|
style="width: 14.02cm;height: 9.39cm;table-layout:fixed;display: inline-block;"> |
||||
|
<tr> |
||||
|
<td |
||||
|
style="border-bottom: 1px solid black;width: 0.66cm;height: 0.66cm;"></td> |
||||
|
<td |
||||
|
style="border-left: 1px solid black;border-right: 1px solid black;" |
||||
|
colspan="2"></td> |
||||
|
<td |
||||
|
style="border-bottom: 1px solid black;width: 0.66cm;height: 0.66cm;"></td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td></td> |
||||
|
<td style="width: 12.7cm;height: 6.87cm;"> |
||||
|
|
||||
|
<img |
||||
|
src="/beesdoo_base/static/src/img/logo.png" |
||||
|
style="display: block;margin-left: auto;margin-right: auto;margin-top:0.2cm;margin-bottom:0.2cm;width:6.46cm;height:6.46cm" /> |
||||
|
</td> |
||||
|
<td></td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td></td> |
||||
|
<td style="height: 1.20cm;"> |
||||
|
<p |
||||
|
style="text-align:center;font-family:Roboto-Regular;font-size:1.1em;">www.bees-coop.be |
||||
|
</p> |
||||
|
</td> |
||||
|
<td></td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td |
||||
|
style="border-top: 1px solid black;width: 0.66cm;height: 0.66cm;"></td> |
||||
|
<td |
||||
|
style="border-left: 1px solid black;border-right: 1px solid black;" |
||||
|
colspan="2"></td> |
||||
|
<td |
||||
|
style="border-top: 1px solid black;width: 0.66cm;height: 0.66cm;"></td> |
||||
|
</tr> |
||||
|
</table> |
||||
|
<br /> |
||||
|
</t> |
||||
|
</div> |
||||
|
</t> |
||||
|
</template> |
||||
|
|
||||
|
</odoo> |
@ -0,0 +1,6 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<record id="group_force_barcode" model="res.groups"> |
||||
|
<field name="name">Bees Card Force Barcode</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +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" |
After Width: 430 | Height: 12 | Size: 225 B |
After Width: 567 | Height: 567 | Size: 42 KiB |
After Width: 430 | Height: 12 | Size: 223 B |
@ -0,0 +1,120 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<record model="ir.actions.act_window" id="action_membercard_wizard"> |
||||
|
<field name="name">New Member Card</field> |
||||
|
<field name="res_model">membercard.new.wizard</field> |
||||
|
<field name="view_mode">form</field> |
||||
|
<field name="target">new</field> |
||||
|
</record> |
||||
|
|
||||
|
<record model="ir.actions.act_window" id="action_eater_wizard"> |
||||
|
<field name="name">New Eater</field> |
||||
|
<field name="res_model">eater.new.wizard</field> |
||||
|
<field name="view_mode">form</field> |
||||
|
<field name="target">new</field> |
||||
|
</record> |
||||
|
|
||||
|
<record model="ir.ui.view" id="beesdoo_partner_form_view"> |
||||
|
<field name="name">beesdoo.partner.form.view</field> |
||||
|
<field name="model">res.partner</field> |
||||
|
<field name="inherit_id" ref="point_of_sale.view_partner_property_form" /> |
||||
|
<field name="arch" type="xml"> |
||||
|
<field name="type" position="before"> |
||||
|
<field name="cooperator_type" /> |
||||
|
</field> |
||||
|
<field name="website" position="after"> |
||||
|
<field name="eater" |
||||
|
attrs="{'invisible': [('customer', '=', False)]}" /> |
||||
|
<field name="parent_eater_id" |
||||
|
attrs="{'invisible' : [('eater', '!=', 'eater')]}" /> |
||||
|
</field> |
||||
|
<xpath expr="//notebook/page[1]" position="attributes"> |
||||
|
<attribute name="attrs">{'invisible': |
||||
|
[('cooperator_type', '=', 'share_a')]}</attribute> |
||||
|
</xpath> |
||||
|
<xpath expr="//notebook" position="inside"> |
||||
|
<page string="Worker information" |
||||
|
attrs="{'invisible': [('cooperator_type', '!=', 'share_a')]}" |
||||
|
name="work"> |
||||
|
<group name="info_session" /> |
||||
|
</page> |
||||
|
<page string="Member Card" |
||||
|
attrs="{'invisible': ['|', ('customer', '=', False), ('eater', 'not in', ('worker_eater', 'eater'))]}"> |
||||
|
<group> |
||||
|
<group> |
||||
|
<field name="member_card_to_be_printed" /> |
||||
|
<field name="last_printed" /> |
||||
|
</group> |
||||
|
</group> |
||||
|
|
||||
|
<group attrs="{'invisible': ['|', ('customer', '=', False), ('eater', '!=', 'worker_eater')]}"> |
||||
|
<separator string="Eaters" /> |
||||
|
<field name="child_eater_ids" widget="many2many_tags" |
||||
|
options="{'no_create': True}" |
||||
|
context="{'default_eater' : 'eater', 'default_customer' : True}" /> |
||||
|
<group> |
||||
|
<button string="New Eater" name="%(action_eater_wizard)d" |
||||
|
type="action" /> |
||||
|
</group> |
||||
|
<separator string="Cards" /> |
||||
|
<field string="Cards" name="member_card_ids"> |
||||
|
<tree editable="bottom"> |
||||
|
<field name="barcode" /> |
||||
|
<field name="create_date" /> |
||||
|
<field name="end_date" /> |
||||
|
<field name="responsible_id" /> |
||||
|
<field name="comment" /> |
||||
|
<field name="valid" /> |
||||
|
</tree> |
||||
|
</field> |
||||
|
<group> |
||||
|
<button string="New Card" |
||||
|
name="%(action_membercard_wizard)d" type="action" /> |
||||
|
</group> |
||||
|
</group> |
||||
|
</page> |
||||
|
|
||||
|
</xpath> |
||||
|
<field name="barcode" position="attributes"> |
||||
|
<attribute name="attrs">{'invisible' : [('eater', |
||||
|
'!=', |
||||
|
'worker_eater')]} |
||||
|
</attribute> |
||||
|
</field> |
||||
|
<field name="barcode" position="after"> |
||||
|
<field name="parent_barcode" |
||||
|
attrs="{'invisible' : [('eater', '!=', 'eater')]}" /> |
||||
|
</field> |
||||
|
<!-- Temporary fix for the partner_view --> |
||||
|
<xpath expr="//field[@name='customer']" position='before'> |
||||
|
<field name="is_company" invisible="True" /> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<record model="ir.ui.view" id="beesdoo_partner_search_view"> |
||||
|
<field name="name">beesdoo.partner.search.view</field> |
||||
|
<field name="model">res.partner</field> |
||||
|
<field name="inherit_id" ref="base.view_res_partner_filter" /> |
||||
|
<field name="arch" type="xml"> |
||||
|
<filter name="type_person" position="after"> |
||||
|
<filter name="type_a" string="Cooperator type A" domain="[('cooperator_type', '=', 'share_a')]" /> |
||||
|
<filter name="type_b" string="Cooperator type B" domain="[('cooperator_type', '=', 'share_b')]" /> |
||||
|
<filter name="type_c" string="Cooperator type C" domain="[('cooperator_type', '=', 'share_c')]" /> |
||||
|
</filter> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
|
||||
|
<!-- S022 : By default a supplier should be a company --> |
||||
|
<record id="base.action_partner_supplier_form" model="ir.actions.act_window"> |
||||
|
<field name="context">{ |
||||
|
'search_default_supplier': 1, |
||||
|
'default_customer': 0, |
||||
|
'default_supplier': 1, |
||||
|
'default_is_company' : True, |
||||
|
'default_company_type' : 'company', |
||||
|
} |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,2 @@ |
|||||
|
import member_card, partner, portal_wizard |
||||
|
|
@ -0,0 +1,52 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
from openerp import models, fields, api |
||||
|
|
||||
|
class NewMemberCardWizard(models.TransientModel): |
||||
|
""" |
||||
|
A transient model for the creation of a new card. |
||||
|
The user can only define the raison why a new card is |
||||
|
needed and the eater/worker that is concerned. |
||||
|
""" |
||||
|
_name = 'membercard.new.wizard' |
||||
|
|
||||
|
def _get_default_partner(self): |
||||
|
return self.env.context['active_id'] |
||||
|
|
||||
|
new_comment = fields.Char('Reason', required=True) |
||||
|
partner_id = fields.Many2one('res.partner', default=_get_default_partner) |
||||
|
force_barcode = fields.Char('Force Barcode', groups="beesdoo_base.group_force_barcode") |
||||
|
|
||||
|
@api.one |
||||
|
def create_new_card(self): |
||||
|
client = self.partner_id.sudo() |
||||
|
client._deactivate_active_cards() |
||||
|
client._new_card(self.new_comment, self.env.uid, barcode=self.force_barcode) |
||||
|
client.member_card_to_be_printed = True |
||||
|
|
||||
|
class RequestMemberCardPrintingWizard(models.TransientModel): |
||||
|
|
||||
|
_name = 'membercard.requestprinting.wizard' |
||||
|
|
||||
|
def _get_selected_partners(self): |
||||
|
return self.env.context['active_ids'] |
||||
|
|
||||
|
partner_ids = fields.Many2many('res.partner', default=_get_selected_partners) |
||||
|
|
||||
|
|
||||
|
@api.one |
||||
|
def request_printing(self): |
||||
|
self.partner_ids.write({'member_card_to_be_printed' : True}) |
||||
|
|
||||
|
class SetAsPrintedWizard(models.TransientModel): |
||||
|
|
||||
|
_name = 'membercard.set_as_printed.wizard' |
||||
|
|
||||
|
def _get_selected_partners(self): |
||||
|
return self.env.context['active_ids'] |
||||
|
|
||||
|
partner_ids = fields.Many2many('res.partner', default=_get_selected_partners) |
||||
|
|
||||
|
@api.one |
||||
|
def set_as_printed(self): |
||||
|
self.partner_ids.write({'member_card_to_be_printed' : False, |
||||
|
'last_printed' : fields.Datetime.now()}) |
@ -0,0 +1,21 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
from openerp import models, fields, api |
||||
|
|
||||
|
class NewEaterWizard(models.TransientModel): |
||||
|
""" |
||||
|
A transient model for the creation of a eater related to a worker. |
||||
|
""" |
||||
|
_name = 'eater.new.wizard' |
||||
|
|
||||
|
def _get_default_partner(self): |
||||
|
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') |
||||
|
|
||||
|
partner_id = fields.Many2one('res.partner', default=_get_default_partner) |
||||
|
|
||||
|
@api.one |
||||
|
def create_new_eater(self): |
||||
|
self.partner_id._new_eater(self.first_name, self.last_name, self.email) |
@ -0,0 +1,26 @@ |
|||||
|
from openerp import models, fields, api |
||||
|
from openerp import SUPERUSER_ID |
||||
|
|
||||
|
class BeesdooWizard(models.TransientModel): |
||||
|
|
||||
|
_inherit = 'portal.wizard' |
||||
|
|
||||
|
@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', []) |
||||
|
|
||||
|
contact_ids = set() |
||||
|
for partner in res_partner.browse(partner_ids): |
||||
|
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, |
||||
|
}) |
||||
|
|
@ -0,0 +1,82 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<!-- New card generation wizard --> |
||||
|
<record id="MemberCard Wizard" model="ir.ui.view"> |
||||
|
<field name="name">New MemberCard Wizard</field> |
||||
|
<field name="model">membercard.new.wizard</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<form> |
||||
|
<group groups="beesdoo_base.group_force_barcode"> |
||||
|
<field name="force_barcode" /> |
||||
|
</group> |
||||
|
<separator string="Reason" /> |
||||
|
<field name="new_comment" string="Reason" editable="True" /> |
||||
|
<field name="partner_id" invisible="1" /> |
||||
|
<footer> |
||||
|
<button type="object" name="create_new_card" string="Create" |
||||
|
class="oe_highlight" /> |
||||
|
<button special="cancel" string="Cancel" /> |
||||
|
</footer> |
||||
|
</form> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
|
||||
|
<record id="printing_membercard_request_wizard" model="ir.ui.view"> |
||||
|
<field name="name">Request Membercard Printing Wizard</field> |
||||
|
<field name="model">membercard.requestprinting.wizard</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<form> |
||||
|
<separator string="Request Printing for" /> |
||||
|
<field name="partner_ids" /> |
||||
|
<footer> |
||||
|
<button |
||||
|
type="object" |
||||
|
name="request_printing" |
||||
|
string="Request Beescard Printing" |
||||
|
class="oe_highlight" /> |
||||
|
<button special="cancel" string="Cancel" /> |
||||
|
</footer> |
||||
|
</form> |
||||
|
|
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<act_window name="Request BEES card printing" |
||||
|
res_model="membercard.requestprinting.wizard" |
||||
|
src_model="res.partner" |
||||
|
view_mode="form" |
||||
|
target="new" |
||||
|
key2="client_action_multi" |
||||
|
id="beesdoo_base_action_request_membercard_printing" |
||||
|
/> |
||||
|
|
||||
|
|
||||
|
<record id="membercard_set_as_printed_wizard" model="ir.ui.view"> |
||||
|
<field name="name">Set Membercard as Printed Wizard</field> |
||||
|
<field name="model">membercard.set_as_printed.wizard</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<form> |
||||
|
<separator string="Set as Printed for" /> |
||||
|
<field name="partner_ids" /> |
||||
|
<footer> |
||||
|
<button |
||||
|
type="object" |
||||
|
name="set_as_printed" |
||||
|
string="Set as Printed" |
||||
|
class="oe_highlight" /> |
||||
|
<button special="cancel" string="Cancel" /> |
||||
|
</footer> |
||||
|
</form> |
||||
|
|
||||
|
</field> |
||||
|
</record> |
||||
|
<act_window name="Set BEES card as printed" |
||||
|
res_model="membercard.set_as_printed.wizard" |
||||
|
src_model="res.partner" |
||||
|
view_mode="form" |
||||
|
target="new" |
||||
|
key2="client_action_multi" |
||||
|
id="beesdoo_base_action_set_membercard_as_printed" |
||||
|
/> |
||||
|
</odoo> |
@ -0,0 +1,34 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<!-- New eater generation wizard --> |
||||
|
<record id="Eater Wizard" model="ir.ui.view"> |
||||
|
<field name="name">New Eater Wizard</field> |
||||
|
<field name="model">eater.new.wizard</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<form string="Create a new eater"> |
||||
|
<group> |
||||
|
<field name="first_name" /> |
||||
|
<field name="last_name" /> |
||||
|
<field name="email" /> |
||||
|
</group> |
||||
|
<footer> |
||||
|
<button type="object" name="create_new_eater" |
||||
|
string="Create" class="oe_highlight" /> |
||||
|
<button special="cancel" string="Cancel" /> |
||||
|
</footer> |
||||
|
</form> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<record id="beesdoo_portal_wizard_view" model="ir.ui.view"> |
||||
|
<field name="name">Unfuck Portal Wizard</field> |
||||
|
<field name="model">portal.wizard</field> |
||||
|
<field name="inherit_id" ref="portal.wizard_view" /> |
||||
|
<field name="arch" type="xml"> |
||||
|
<field name="portal_id" position="attributes"> |
||||
|
<attribute name="on_change" /> |
||||
|
</field> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue