Browse Source

Merge branch '9.0' of https://github.com/beescoop/Obeesdoo into 9.0-S0025-Elise

# Conflicts:
#	beesdoo_base/__openerp__.py
pull/14/head
EliseDup 9 years ago
parent
commit
f0b6ff4fd9
  1. 6
      beesdoo_base/security/groups.xml
  2. 52
      beesdoo_base/wizard/member_card.py
  3. 82
      beesdoo_base/wizard/views/member_card.xml
  4. 3
      beesdoo_coda/__init__.py
  5. 22
      beesdoo_coda/__openerp__.py
  6. 1
      beesdoo_coda/models/__init__.py
  7. 12
      beesdoo_coda/models/bank_statement.py
  8. 6
      beesdoo_coda/wizard/__init__.py
  9. 77
      beesdoo_coda/wizard/import_coda.py
  10. 1
      beesdoo_product/wizard/__init__.py
  11. 21
      beesdoo_product/wizard/label_printing_utils.py
  12. 55
      beesdoo_product/wizard/views/label_printing_utils.xml
  13. 69
      web_environment_ribbon/README.rst
  14. 20
      web_environment_ribbon/__init__.py
  15. 40
      web_environment_ribbon/__openerp__.py
  16. 12
      web_environment_ribbon/data/ribbon_data.xml
  17. BIN
      web_environment_ribbon/static/description/icon.png
  18. BIN
      web_environment_ribbon/static/description/screenshot.png
  19. 24
      web_environment_ribbon/static/src/css/ribbon.css
  20. 35
      web_environment_ribbon/static/src/js/ribbon.js
  21. 21
      web_environment_ribbon/view/base_view.xml

6
beesdoo_base/security/groups.xml

@ -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>

52
beesdoo_base/wizard/member_card.py

@ -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.Text('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)
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()})

82
beesdoo_base/wizard/views/member_card.xml

@ -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="Raison" editable="True" />
<field name="partner_id" invisible="1" />
<footer>
<button type="object" name="create_new_card" string="Créer"
class="oe_highlight" />
<button special="cancel" string="Annuler" />
</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>

3
beesdoo_coda/__init__.py

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

22
beesdoo_coda/__openerp__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
{
'name': "Beescoop Coda Import module",
'summary': """
Import coda Wizard based on https://github.com/acsone/pycoda
""",
'description': """
""",
'author': "Beescoop - Cellule IT",
'website': "https://github.com/beescoop/Obeesdoo",
'category': 'Accounting & Finance',
'version': '0.1',
'depends': ['account_bank_statement_import'],
'data': [
],
}

1
beesdoo_coda/models/__init__.py

@ -0,0 +1 @@
import bank_statement

12
beesdoo_coda/models/bank_statement.py

@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
'''
Created on 16 mai 2016
@author: Thibault Francois (thibault@françois.be)
'''
from openerp import models, fields
class BankStatement(models.Model):
_inherit = 'account.bank.statement'
coda_note = fields.Text()

6
beesdoo_coda/wizard/__init__.py

@ -0,0 +1,6 @@
'''
Created on 19 mai 2016
@author: mythrys
'''
import import_coda

77
beesdoo_coda/wizard/import_coda.py

@ -0,0 +1,77 @@
# -*- coding: utf-8 -*-
'''
Created on 16 mai 2016
@author: Thibault Francois (thibault@françois.be)
'''
from coda.parser import Parser
from openerp import models, _
class CodaBankStatementImport(models.TransientModel):
_inherit = 'account.bank.statement.import'
def _generate_note(self, move):
notes = []
if move.counterparty_name:
notes.append("%s: %s" % (_('Counter Party Name'), move.counterparty_name))
if move.counterparty_address:
notes.append("%s: %s" % (_('Counter Party Address'), move.counterparty_address))
if move.counterparty_number:
notes.append("%s: %s" % (_('Counter Party Account'), move.counterparty_number))
if move.communication:
notes.append("%s: %s" % (_('Communication'), move.communication))
return '\n'.join(notes)
def _get_move_value(self, move, statement, sequence):
move_data = {
'name': move.communication, #ok
'note': self._generate_note(move),
'date': move.entry_date, #ok
'amount': move.transaction_amount if move.transaction_amount_sign == '0' else - move.transaction_amount, #ok
'account_number': move.counterparty_number, #ok
'partner_name': move.counterparty_name, #ok
'ref': move.ref,
'sequence': sequence, #ok
'unique_import_id' : statement.coda_seq_number + '-' + statement.old_balance_date + '-' + statement.new_balance_date + '-' + move.ref
}
return move_data
def _get_statement_data(self, statement):
statement_data = {
'name' : statement.paper_seq_number,
'date' : statement.creation_date,
'balance_start': statement.old_balance, #ok
'balance_end_real' : statement.new_balance, #ok
'coda_note' : '',
'transactions' : []
}
return statement_data
def _get_acc_number(self, acc_number):
#Check if we match the exact acc_number or the end of an acc number
journal = self.env['account.journal'].search([('bank_acc_number', '=like', '%' + acc_number)])
if not journal or len(journal) > 1: #if not found or ambiguious
return acc_number
return journal.bank_acc_number
def _parse_file(self, data_file):
parser = Parser()
try:
statements = parser.parse(data_file)
except ValueError:
return super(CodaBankStatementImport, self)._parse_file(data_file)
currency_code = False
account_number = False
stmts_vals = []
for statement in statements:
account_number = statement.acc_number
currency_code = statement.currency
statement_data = self._get_statement_data(statement)
stmts_vals.append(statement_data)
for move in statement.movements:
statement_data['transactions'].append(self._get_move_value(move, statement, len(statement_data['transactions']) + 1))
return currency_code, self._get_acc_number(account_number), stmts_vals

1
beesdoo_product/wizard/__init__.py

@ -0,0 +1 @@
import label_printing_utils

21
beesdoo_product/wizard/label_printing_utils.py

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
from openerp import models, fields, api
class RequestLabelPrintingWizard(models.TransientModel):
_name = 'label.printing.wizard'
def _get_selected_products(self):
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})
@api.one
def set_as_printed(self):
self.product_ids.write({'label_to_be_printed' : False, 'label_last_printed' : fields.Datetime.now()})

55
beesdoo_product/wizard/views/label_printing_utils.xml

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="printing_label_request_wizard" model="ir.ui.view">
<field name="name">Request Label Printing Wizard</field>
<field name="model">label.printing.wizard</field>
<field name="arch" type="xml">
<form>
<field name="product_ids" />
<footer>
<button
type="object"
name="request_printing"
string="Demander l'impression d'un label"
class="oe_highlight" />
<button special="cancel" string="Annuler" />
</footer>
</form>
</field>
</record>
<act_window name="Request label printing"
res_model="label.printing.wizard"
src_model="product.template"
view_mode="form"
target="new"
view_id="printing_label_request_wizard"
key2="client_action_multi"
id="beesdoo_product_action_request_label_printing"
/>
<record id="set_label_as_printed_wizard" model="ir.ui.view">
<field name="name">Request Label Printing Wizard</field>
<field name="model">label.printing.wizard</field>
<field name="arch" type="xml">
<form>
<field name="product_ids" />
<footer>
<button
type="object"
name="set_as_printed"
string="Marquer les labels comme imprimés"
class="oe_highlight" />
<button special="cancel" string="Annuler" />
</footer>
</form>
</field>
</record>
<act_window name="Set label as printed"
res_model="label.printing.wizard"
src_model="product.template"
view_mode="form"
view_id="set_label_as_printed_wizard"
target="new"
key2="client_action_multi"
id="beesdoo_product_action_set_label_as_printed"
/>
</odoo>

69
web_environment_ribbon/README.rst

@ -0,0 +1,69 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
Web Environment Ribbon
======================
Mark a Test Environment with a red ribbon on the top left corner in every page
.. image:: /web_environment_ribbon/static/description/screenshot.png
:alt: Screenshot
Installation
============
* No special setup
Configuration
=============
* You can change the ribbon's name ("TEST") by editing
the default system parameter "ribbon.name"
(in the menu Settings > Parameters > System Parameters)
To hide the ribbon, set this parameter to "False" or
delete it.
Usage
=====
To use this module, you need only to install it. After installation, a red
ribbon will be visible on top left corner of every Odoo backend page
Known issues / Roadmap
======================
* Allow to define in some place (system parameter, configuration file...) the
ribbon color.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
`here <https://github.com/OCA/web/issues/new?body=module:%20web_environment_ribbon%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Contributors
------------
* Francesco Apruzzese <cescoap@gmail.com>
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit http://odoo-community.org.

20
web_environment_ribbon/__init__.py

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Francesco OpenCode Apruzzese (<cescoap@gmail.com>)
# All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

40
web_environment_ribbon/__openerp__.py

@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Francesco OpenCode Apruzzese (<cescoap@gmail.com>)
# All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': "Web Environment Ribbon",
'version': '8.0.0.1.0',
'category': 'Web',
'author': 'Francesco OpenCode Apruzzese,Odoo Community Association (OCA),Thibault Francois',
'website': 'https://it.linkedin.com/in/francescoapruzzese',
'license': 'AGPL-3',
"depends": [
'web',
],
"data": [
'view/base_view.xml',
'data/ribbon_data.xml',
],
"update_xml": [],
"demo_xml": [],
"auto_install": False,
'installable': True,
}

12
web_environment_ribbon/data/ribbon_data.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<!-- Add ribbon name default configuration parameter -->
<record id="default_ribbon_name" model="ir.config_parameter">
<field name="key">ribbon.name</field>
<field name="value">TEST</field>
</record>
</data>
</openerp>

BIN
web_environment_ribbon/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.1 KiB

BIN
web_environment_ribbon/static/description/screenshot.png

After

Width: 607  |  Height: 198  |  Size: 43 KiB

24
web_environment_ribbon/static/src/css/ribbon.css

@ -0,0 +1,24 @@
.test-ribbon{
width: 200px;
background: #e43;
position: absolute;
top: 50px;
left: -50px;
text-align: center;
line-height: 50px;
letter-spacing: 1px;
color: #f0f0f0;
-webkit-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transform: rotate(-45deg);
z-index: 1000;
position: fixed;
box-shadow: 0 0 3px rgba(0,0,0,.3);
background: rgba(255, 0, 0, .6);;
}
.test-ribbon b {
font-size: 20px;
}

35
web_environment_ribbon/static/src/js/ribbon.js

@ -0,0 +1,35 @@
/******************************************************************************
Copyright (C) 2015 Akretion (http://www.akretion.com)
@author Sylvain Calador <sylvain.calador@akretion.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
openerp.web_environment_ribbon = function(instance) {
var ribbon = $(document).find('.test-ribbon');
ribbon.hide();
var model = new instance.web.Model('ir.config_parameter');
var key = 'ribbon.name';
var res = model.call('get_param', [key]).then(
function (name) {
if (name && name != 'False') {
ribbon.html(name);
ribbon.show();
}
}
);
}

21
web_environment_ribbon/view/base_view.xml

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Load css for ribbons -->
<template id="assets_backend" name="ribbon_test assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/web_environment_ribbon/static/src/css/ribbon.css"/>
<script type="text/javascript" src="/web_environment_ribbon/static/src/js/ribbon.js"/>
</xpath>
</template>
<!-- Add ribbon to page -->
<template id="body_with_ribbon_test" name="ribbon_test web.webclient_bootstrap" inherit_id="web.webclient_bootstrap">
<xpath expr="//div[@class='openerp openerp_webclient_container oe_webclient']" position="before">
<div class="test-ribbon"/>
</xpath>
</template>
</data>
</openerp>
Loading…
Cancel
Save