first import

This commit is contained in:
Valentin Lab
2015-01-28 11:59:35 +07:00
commit 36902ec12b
23 changed files with 489 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.*~

23
LICENSE Normal file
View File

@@ -0,0 +1,23 @@
Copyright (c) 2012-2015, Valentin Lab
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

113
README.rst Normal file
View File

@@ -0,0 +1,113 @@
=================
cookiecutter-odoo
=================
A modified cookiecutter_ template for OpenERP/Odoo.
.. _cookiecutter: https://github.com/audreyr/cookiecutter
Maturity
--------
Alpha release. Uses a modified version of cookiecutter_ templating
system. To install this version do::
pip install git+https://github.com/0k/cookiecutter
We plan to have v7 and v8 template in the same repository with sane
branch naming.
We intend to produce compatible and full project for corresponding
`branch in the odoo github repository`_.
.. _branch in the odoo github repository: https://github.com/odoo/odoo/branches
Features
--------
* OpenERP/Odoo version:
- Odoo 8.0
* Include:
- report
- security
- web (xml, css, js)
- views
- models
Usage
-----
First install `cookiecutter`_ from our repositories::
$ pip install git+https://github.com/0k/cookiecutter
Now run with this repo::
$ cookiecutter gh:0k/cookiecutter-odoo
Branch selection can be done with ``--checkout``::
$ cookiecutter gh:0k/cookiecutter-odoo --checkout 8.0
For more info about cookiecutter_ options and usage, please check `cookiecutter documentation`_.
Please bear in mind that we are using a fork.
.. _cookiecutter documentation: http://cookiecutter.readthedocs.org/
Contributing
============
Any suggestion or issue is welcome. Push request are very welcome,
please check out the guidelines.
Push Request Guidelines
-----------------------
You can send any code. I'll look at it and will integrate it myself in
the code base and leave you as the author. This process can take time and
it'll take less time if you follow the following guidelines:
- check your python code with PEP8 or pylint. Try to stick to 80 columns wide.
- avoid tabs
- separate your commits per smallest concern.
- each commit should pass the tests (to allow easy bisect)
- each functionality/bugfix commit should contain the code, tests,
and doc.
- prior minor commit with typographic or code cosmetic changes are
very welcome. These should be tagged thanks to an ending ``!minor``
in their commit summary.
- the commit message should follow gitchangelog rules (check the git
log to get examples)
- if the commit fixes an issue or finished the implementation of a
feature, please mention it in the summary.
If you have some questions about guidelines which is not answered here,
please check the current ``git log``, you might find previous commit that
would show you how to deal with your issue.
License
=======
Copyright (c) 2012-2015 Valentin Lab.
Licensed under the `BSD License`_.
.. _BSD License: http://raw.github.com/0k/cookiecutter-odoo/master/LICENSE
Thanks
======
- `sudokeys`_ funding this package and providing great `OpenERP/Odoo`_ solutions.
.. _sudokeys: http://www.sudokeys.com
.. _OpenERP/Odoo: http://www.odoo.com

27
cookiecutter.yml Normal file
View File

@@ -0,0 +1,27 @@
context:
name:
help: "Module name (ie: sale_trinkets)"
regex: '[a-zA-Z0-9_]+'
email:
help: "Author email (ie: john.doe@example.com)"
regex: '[a-zA-Z0-9_.]+@[a-zA-Z0-9_.-]+\.[a-zA-Z0-9_.-]+'
author:
help: "Author Name (ie: John Doe)"
regex: '.+'
website:
help: "Website (ie: http://www.yourwebsite.com)"
default:
regex: '[^ ]+'
description:
help: Short description of your module
default: "{{name}} OpenERP/Odoo module."
category:
help: "Module category (ie: Hidden, Tools, Website, ...)"
default: Tools
license_years:
help: "License Years (ie: 2015, or 2012-2014)"
regexp: '[0-9,- ]+'
version:
help: "Module Version (ie: 0.1)"
default: "0.1"

23
{{name}}/LICENSE Normal file
View File

@@ -0,0 +1,23 @@
Copyright (c) {{license_years}}, {{author}}
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

7
{{name}}/README.rst Normal file
View File

@@ -0,0 +1,7 @@
=====================
{{name}}
=====================
{{description}}
This is an OpenERP/Odoo addons.

6
{{name}}/__init__.py Normal file
View File

@@ -0,0 +1,6 @@
## package holder
import models
import wizard
import test

31
{{name}}/__openerp__.py Normal file
View File

@@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
{
'name': '{{name}}',
'version': '{{version}}',
'author': '{{author}}',
'category': '{{category}}',
'complexity': 'normal',
{%- if website %}
'website': '{{ website }}',
{%- endif %}
'data': [
'data/templates.xml',
'security/security.xml',
'security/ir.model.access.csv',
'views/view.xml',
'actions/act_window.xml',
'menu.xml',
'data/data.xml',
],
'depends': [
'base',
],
'qweb': [
"static/src/xml/*.xml",
],
'test': [
],
'installable': True,
'auto_install': False,
}

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<!-- This file should contain only records from model ir.actions.act_window -->
<!-- Example:
<record id="action_orders" model="ir.actions.act_window">
<field name="name">Sales Orders</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sale.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar,graph</field>
<field name="search_view_id" ref="view_sales_order_filter"/>
<field name="context">{
'search_default_my_sale_orders_filter': 1
}
</field>
<field name="domain">[('state', 'not in', ('draft', 'sent', 'cancel'))]</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a quotation that can be converted into a sales
order.
</p><p>
Odoo will help you efficiently handle the complete sales flow:
quotation, sales order, delivery, invoicing and payment.
</p>
</field>
</record>
-->
</data>
</openerp>

View File

@@ -0,0 +1,4 @@
## package holder
import main

View File

@@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
import logging
import openerp
import openerp.modules.registry
from openerp.modules import get_module_resource
from openerp.tools.translate import _
from openerp import http
from openerp.http import request, serialize_exception as _serialize_exception
_logger = logging.getLogger(__name__)
##
## Web Controllers
##
# class Main(http.Controller):
#
# @http.route('/{{name}}', type='http', auth="none")
# def index(self, s_action=None, db=None, **kw):
# return http.local_redirect('/web', query=request.params, keep_hash=True)
#
# @http.route([
# '/{{name}}/<xmlid>',
# '/{{name}}/<xmlid>/<version>',
# ], type='json', auth="user")
# def load_needaction(self, menu_ids):
# """ Loads needaction counters for specific menu ids.
#
# :return: needaction data
# :rtype: dict(menu_id: {'needaction_enabled': boolean, 'needaction_counter': int})
# """
# return request.session.model('ir.ui.menu').get_needaction_data(menu_ids, request.context)
#

6
{{name}}/data/data.xml Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
</data>
</openerp>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- vim:fdn=3:
-->
<openerp>
<data>
<template id="assets_backend" name="{{name}} assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/{{name}}/static/src/css/main.css"/>
<script type="text/javascript" src="/{{name}}/static/src/js/main.js"></script>
</xpath>
</template>
</data>
</openerp>

1
{{name}}/i18n/README Normal file
View File

@@ -0,0 +1 @@
This directory should contain the *.po for OpenERP/Odoo translation.

18
{{name}}/menu.xml Normal file
View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<!-- This file should contain only menuitem elements -->
<!-- Example:
<menuitem action="action_order_report_all"
id="menu_report_product_all"
parent="base.next_id_64"
sequence="10"/>
-->
</data>
</openerp>

28
{{name}}/models.py Normal file
View File

@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
import logging
from openerp.osv import orm, fields
from openerp.tools.translate import _
_logger = logging.getLogger(__name__)
##
## Models
##
# class mymodel(orm.Model):
#
# _name = '{{name}}.mymodel'
# _inherit = "res.company"
#
# _columns = {
# 'res_model': fields.char('Model'),
# 'file': fields.binary(i
# 'File', help="File to check"),
# 'partner_id': fields.many2one(
# 'res.partner',
# string="Attached Partner",
# domain="[('type', '=', 'other')]",),
# }
#

View File

@@ -0,0 +1 @@
id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
1 id name model_id/id group_id/id perm_read perm_write perm_create perm_unlink

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data noupdate="1">
<!-- This file should contain only security objects
<record model="res.groups" id="base.group_{{name}}_user">
<field name="name">{{name}} / User</field>
</record>
<record model="res.groups" id="base.group_{{toto}}_manager">
<field name="name">{{toto}} / Manager</field>
<field name="implied_ids" eval="[(4, ref('base.group_{{name}}_user'))]"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
<record id="{{name}}_users_access" model="ir.rule">
<field name="name">Access to {{name}} for regular users</field>
<field name="model_id" ref="{{name}}.model_{{name}}_{{name}}"/>
<field name="domain_force">[('stage_id.closed', '=', False)]</field>
<field name="groups" eval="[(4, ref('base.group_{{name}}_user'))]"/>
<field eval="0" name="perm_unlink"/>
<field eval="0" name="perm_write"/>
<field eval="1" name="perm_read"/>
<field eval="0" name="perm_create"/>
</record>
-->
</data>
</openerp>

View File

@@ -0,0 +1,11 @@
/**
* Main css of {{name}} addon.
*/
/*
.oe-{{name}} {
color: black
}
*/

View File

@@ -0,0 +1,22 @@
openerp.{{name}} = function (instance) {
var _t = instance.web._t,
_lt = instance.web._lt;
var QWeb = instance.web.qweb;
// instance.web.views.add('kanban', 'instance.{{name}}.MyView');
// instance.{{name}}.MyView = instance.web.View.extend({
// template: "MyView",
// display_name: _lt('MyView'),
// default_nr_columns: 1,
// view_type: "myview",
// quick_create_class: "instance.{{name}}.QuickCreate",
// number_of_color_schemes: 10,
// init: function (parent, dataset, view_id, options) {
// this._super(parent, dataset, view_id, options);
// }
// });
};

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<!-- QWEB Templates for UI Widgets and views -->
<!--
<t t-name="{{name}}View">
<div class="oe_{{name}}_view">
<div class="oe_{{name}}_buttons"/>>
<table class="oe_{{name}}_groups">
<tr class="oe_{{name}}_groups_headers">
<td class="oe_{{name}}_dummy_cell"><div/></td>
</tr>
<tr class="oe_{{name}}_dummy_row">
</tr>
</table>
</div>
</t>
-->
</templates>

24
{{name}}/views/view.xml Normal file
View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<!-- This file should contain only records from model ir.ui.view -->
<!-- Example:
<record id="view_sale_order_calendar" model="ir.ui.view">
<field name="name">sale.order.calendar</field>
<field name="model">sale.order</field>
<field name="arch" type="xml">
<calendar string="Sales Orders" color="state" date_start="date_order">
<field name="partner_id"/>
<field name="amount_total"/>
</calendar>
</field>
</record>
-->
</data>
</openerp>

View File