← Back to team overview

openerp-community-reviewer team mailing list archive

lp:~camptocamp/carriers-deliveries/7.0-add-base_delivery_carrier_label-yvr into lp:carriers-deliveries

 

Yannick Vaucher @ Camptocamp has proposed merging lp:~camptocamp/carriers-deliveries/7.0-add-base_delivery_carrier_label-yvr into lp:carriers-deliveries.

Commit message:
Port of delivery_base and deliver_shipping_label removing direct print logic

Requested reviews:
  Guewen Baconnier @ Camptocamp (gbaconnier-c2c)

For more details, see:
https://code.launchpad.net/~camptocamp/carriers-deliveries/7.0-add-base_delivery_carrier_label-yvr/+merge/196753


-- 
https://code.launchpad.net/~camptocamp/carriers-deliveries/7.0-add-base_delivery_carrier_label-yvr/+merge/196753
Your team Stock and Logistic Core Editors is subscribed to branch lp:carriers-deliveries.
=== added directory 'base_delivery_carrier_label'
=== added file 'base_delivery_carrier_label/__init__.py'
--- base_delivery_carrier_label/__init__.py	1970-01-01 00:00:00 +0000
+++ base_delivery_carrier_label/__init__.py	2013-12-06 13:20:36 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Yannick Vaucher
+#    Copyright 2013 Camptocamp SA
+#
+#    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/>.
+#
+##############################################################################
+from . import delivery
+from . import stock

=== added file 'base_delivery_carrier_label/__openerp__.py'
--- base_delivery_carrier_label/__openerp__.py	1970-01-01 00:00:00 +0000
+++ base_delivery_carrier_label/__openerp__.py	2013-12-06 13:20:36 +0000
@@ -0,0 +1,61 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Yannick Vaucher
+#    Copyright 2013 Camptocamp SA
+#
+#    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': 'Base module for carrier labels',
+ 'version': '1.0',
+ 'author': 'Camptocamp',
+ 'maintainer': 'Camptocamp',
+ 'category': 'version',
+ 'complexity': 'normal',
+ 'depends': ['stock', 'delivery'],
+ 'description': """
+Base module for carrier labels
+==============================
+
+This module adds a button on delivery orders to generate a label as an
+attachement.
+
+.. tip::
+   It doesn't implement a label. To add a default label, you can install
+   the module `delivery_carrier_label_default_webkit`
+
+It can be used to print specific labels per carrier.
+
+.. note::
+   Inspired by Akretion module delivery_base and delivery_shipping_label
+
+Contributors
+------------
+
+* David BEAL <david.beal@xxxxxxxxxxxx>
+* Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
+* Yannick Vaucher <yannick.vaucher@xxxxxxxxxxxxxx>
+
+ """,
+ 'website': 'http://www.camptocamp.com/',
+ 'data': [
+     'delivery_view.xml',
+     'stock_view.xml',
+     ],
+ 'tests': [],
+ 'installable': True,
+ 'auto_install': False,
+ 'license': 'AGPL-3',
+ 'application': True}

=== added file 'base_delivery_carrier_label/delivery.py'
--- base_delivery_carrier_label/delivery.py	1970-01-01 00:00:00 +0000
+++ base_delivery_carrier_label/delivery.py	2013-12-06 13:20:36 +0000
@@ -0,0 +1,84 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
+#    Copyright (C) 2012-TODAY Akretion <http://www.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/>.
+#
+##############################################################################
+from openerp.osv import orm, fields
+
+
+class DeliveryCarrierTemplateOption(orm.Model):
+    """ Available options for a carrier (partner) """
+    _name = 'delivery.carrier.template.option'
+    _description = 'Delivery carrier template option'
+
+    _columns = {
+        'partner_id': fields.many2one('res.partner', 'Partner Carrier'),
+        'name': fields.char('Name', size=64),
+        'code': fields.char('Code', size=64),
+    }
+
+
+class DeliveryCarrierOption(orm.Model):
+    """ Option selected for a carrier method
+
+    Those options define the list of available pre-added and available
+    to be added on delivery orders
+
+    """
+    _name = 'delivery.carrier.option'
+    _description = 'Delivery carrier option'
+    _inherits = {'delivery.carrier.template.option': 'tmpl_option_id'}
+
+    _columns = {
+        'state': fields.selection(
+            (('mandatory', 'Mandatory'),
+             ('default_option', 'Optional by Default'),
+             ('option', 'Optional'),
+             ),
+            string='Option Configuration',
+            help="Ensure you add and define correctly all your options or those won't "
+                 "be available for the packager\n"
+                 "- Mandatory: This option will be copied on carrier and cannot be removed\n"
+                 "- Optional by Default: This option will be copied but can be removed\n"
+                 "- Optional: This option can be added later by the user on the Delivery Order."),
+        'tmpl_option_id': fields.many2one(
+            'delivery.carrier.template.option',
+            string='Option', required=True, ondelete="cascade"),
+        'carrier_id': fields.many2one('delivery.carrier', 'Carrier'),
+    }
+
+
+class DeliveryCarrier(orm.Model):
+    _inherit = 'delivery.carrier'
+
+    def _get_carrier_type_selection(self, cr, uid, context=None):
+        """ To inherit to add carrier type """
+        return []
+
+    _columns = {
+        'type': fields.selection(
+            _get_carrier_type_selection, 'Type',
+            help="Carrier type (combines several delivery methods)"),
+        'code': fields.char(
+            'Code', size=10,
+            help="Delivery Method Code (according to carrier)"),
+        'description': fields.text('Description'),
+        'available_option_ids': fields.one2many(
+            'delivery.carrier.option',
+            'carrier_id', 'Option'),
+    }

=== added file 'base_delivery_carrier_label/delivery_view.xml'
--- base_delivery_carrier_label/delivery_view.xml	1970-01-01 00:00:00 +0000
+++ base_delivery_carrier_label/delivery_view.xml	2013-12-06 13:20:36 +0000
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+  <data>
+
+    <!-- VIEW FOR THE OBJECT : delivery_carrier_template_option -->
+    <record id="delivery_carrier_template_option_view_form" model="ir.ui.view">
+      <field name="name">delivery_base.delivery_carrier_option.view_form</field>
+      <field name="model">delivery.carrier.template.option</field>
+      <field name="arch" type="xml">
+        <form string="delivery_carrier_option">
+          <field name="partner_id" />
+          <field name="code"/>
+          <field name="name"/>
+        </form>
+      </field>
+    </record>
+
+    <record id="delivery_carrier_template_option_view_tree" model="ir.ui.view">
+      <field name="name">delivery_base.delivery_carrier_template_option.view_tree</field>
+      <field name="model">delivery.carrier.template.option</field>
+      <field name="arch" type="xml">
+        <tree string="delivery_carrier_option">
+          <field name="partner_id" />
+          <field name="code"/>
+          <field name="name"/>
+        </tree>
+      </field>
+    </record>
+
+    <!-- VIEW FOR THE OBJECT : delivery_carrier_option -->
+    <record id="delivery_carrier_option_view_form" model="ir.ui.view">
+      <field name="name">delivery_base.delivery_carrier_option.view_form</field>
+      <field name="model">delivery.carrier.option</field>
+      <field name="arch" type="xml">
+        <form string="delivery_carrier_option">
+          <field name="state"/>
+          <field name="tmpl_option_id"/>
+        </form>
+      </field>
+    </record>
+
+    <record id="delivery_carrier_option_view_tree" model="ir.ui.view">
+      <field name="name">delivery_base.delivery_carrier_option.view_tree</field>
+      <field name="model">delivery.carrier.option</field>
+      <field name="type">tree</field>
+      <field name="arch" type="xml">
+        <tree string="delivery_carrier_option">
+          <field name="state" />
+          <field name="tmpl_option_id" />
+          <field name="code" readonly="1"/>
+        </tree>
+      </field>
+    </record>
+
+    <!-- INHERITED VIEW FOR THE OBJECT : delivery.carrier -->
+
+    <record id="view_delivery_carrier_form" model="ir.ui.view">
+      <field name="name">delivery_base.delivery.carrier.view_form</field>
+      <field name="model">delivery.carrier</field>
+      <field name="inherit_id" ref="delivery.view_delivery_carrier_form"/>
+      <field name="arch" type="xml">
+        <field name="pricelist_ids" position="after">
+          <separator string="Options" colspan="4"/>
+          <field name="available_option_ids" nolabel="1" colspan="4"/>
+        </field>
+        <field name="active" position="after">
+          <field name="type"/>
+          <field name="code"/>
+          <separator name='description' colspan="4" string="Description"/>
+          <field name="description" colspan="4" nolabel="1"/>
+        </field>
+      </field>
+    </record>
+
+    <record id="view_delivery_carrier_tree" model="ir.ui.view">
+      <field name="name">delivery_carrier_base.tree</field>
+      <field name="model">delivery.carrier</field>
+      <field name="inherit_id" ref="delivery.view_delivery_carrier_tree"/>
+      <field name="arch" type="xml">
+        <field name="name" position="after">
+          <field name="type"/>
+          <field name="code"/>
+        </field>
+      </field>
+    </record>
+
+  </data>
+</openerp>

=== added directory 'base_delivery_carrier_label/i18n'
=== added file 'base_delivery_carrier_label/i18n/base_delivery_carrier_label.pot'
--- base_delivery_carrier_label/i18n/base_delivery_carrier_label.pot	1970-01-01 00:00:00 +0000
+++ base_delivery_carrier_label/i18n/base_delivery_carrier_label.pot	2013-12-06 13:20:36 +0000
@@ -0,0 +1,212 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* base_delivery_carrier_label
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-12-06 13:11+0000\n"
+"PO-Revision-Date: 2013-12-06 13:11+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: base_delivery_carrier_label
+#: view:stock.picking.out:0
+msgid "Carrier Info"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: model:ir.model,name:base_delivery_carrier_label.model_shipping_label
+msgid "Shipping Label"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: model:ir.model,name:base_delivery_carrier_label.model_delivery_carrier_option
+msgid "Delivery carrier option"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: model:ir.model,name:base_delivery_carrier_label.model_stock_picking
+msgid "Picking List"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: model:ir.model.fields,field_description:base_delivery_carrier_label.field_stock_picking_carrier_type
+#: field:stock.picking.out,carrier_type:0
+msgid "Carrier type"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: model:ir.model.fields,field_description:base_delivery_carrier_label.field_shipping_label_attachment_id
+#: field:shipping.label,attachment_id:0
+msgid "Automatically created field to link to parent ir.attachment"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: field:delivery.carrier,type:0
+#: model:ir.model.fields,field_description:base_delivery_carrier_label.field_delivery_carrier_type
+msgid "Type"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: help:delivery.carrier,type:0
+msgid "Carrier type (combines several delivery methods)"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: code:addons/base_delivery_carrier_label/stock.py:143
+#, python-format
+msgid "You can not remove a mandatory option.\n"
+"Options are reset to default."
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: view:delivery.carrier:0
+#: field:delivery.carrier,description:0
+#: model:ir.model.fields,field_description:base_delivery_carrier_label.field_delivery_carrier_description
+msgid "Description"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: model:ir.model.fields,field_description:base_delivery_carrier_label.field_shipping_label_file_type
+#: field:shipping.label,file_type:0
+msgid "File type"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: view:stock.picking.out:0
+msgid "Delivery"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: model:ir.model.fields,field_description:base_delivery_carrier_label.field_stock_picking_carrier_code
+#: field:stock.picking.out,carrier_code:0
+msgid "Delivery Method Code"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: help:delivery.carrier,code:0
+msgid "Delivery Method Code (according to carrier)"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: selection:delivery.carrier.option,state:0
+msgid "Optional"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: field:delivery.carrier.template.option,name:0
+#: model:ir.model.fields,field_description:base_delivery_carrier_label.field_delivery_carrier_template_option_name
+msgid "Name"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: code:addons/base_delivery_carrier_label/stock.py:142
+#, python-format
+msgid "User Error !"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: view:stock.picking.out:0
+msgid "Create Label"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: field:delivery.carrier.option,carrier_id:0
+#: model:ir.model,name:base_delivery_carrier_label.model_delivery_carrier
+#: model:ir.model.fields,field_description:base_delivery_carrier_label.field_delivery_carrier_option_carrier_id
+msgid "Carrier"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: field:delivery.carrier.option,state:0
+#: model:ir.model.fields,field_description:base_delivery_carrier_label.field_delivery_carrier_option_state
+msgid "Option Configuration"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: view:delivery.carrier:0
+#: model:ir.model.fields,field_description:base_delivery_carrier_label.field_stock_picking_option_ids
+#: model:ir.model.fields,field_description:base_delivery_carrier_label.field_stock_picking_option_ids_4475
+#: field:stock.picking,option_ids:0
+#: view:stock.picking.out:0
+#: field:stock.picking.out,option_ids:0
+msgid "Options"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: field:delivery.carrier,available_option_ids:0
+#: field:delivery.carrier.option,tmpl_option_id:0
+#: model:ir.model.fields,field_description:base_delivery_carrier_label.field_delivery_carrier_available_option_ids
+#: model:ir.model.fields,field_description:base_delivery_carrier_label.field_delivery_carrier_option_tmpl_option_id
+msgid "Option"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: help:stock.picking.out,carrier_code:0
+msgid "Delivery Method Code (from carrier)"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: field:delivery.carrier,code:0
+#: field:delivery.carrier.template.option,code:0
+#: model:ir.model.fields,field_description:base_delivery_carrier_label.field_delivery_carrier_code
+#: model:ir.model.fields,field_description:base_delivery_carrier_label.field_delivery_carrier_template_option_code
+msgid "Code"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: selection:delivery.carrier.option,state:0
+msgid "Mandatory"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: help:stock.picking.out,carrier_type:0
+msgid "Carrier type ('group')"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: view:delivery.carrier.option:0
+#: view:delivery.carrier.template.option:0
+msgid "delivery_carrier_option"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: model:ir.model,name:base_delivery_carrier_label.model_delivery_carrier_template_option
+msgid "Delivery carrier template option"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: help:delivery.carrier.option,state:0
+msgid "Ensure you add and define correctly all your options or those won't be available for the packager\n"
+"- Mandatory: This option will be copied on carrier and cannot be removed\n"
+"- Optional by Default: This option will be copied but can be removed\n"
+"- Optional: This option can be added later by the user on the Delivery Order."
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: field:delivery.carrier.template.option,partner_id:0
+#: model:ir.model.fields,field_description:base_delivery_carrier_label.field_delivery_carrier_template_option_partner_id
+msgid "Partner Carrier"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: model:ir.model,name:base_delivery_carrier_label.model_stock_picking_out
+msgid "Delivery Orders"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: view:stock.picking.out:0
+msgid "carrier_id_change(carrier_id, context)"
+msgstr ""
+
+#. module: base_delivery_carrier_label
+#: selection:delivery.carrier.option,state:0
+msgid "Optional by Default"
+msgstr ""
+

=== added file 'base_delivery_carrier_label/reports.xml'
--- base_delivery_carrier_label/reports.xml	1970-01-01 00:00:00 +0000
+++ base_delivery_carrier_label/reports.xml	2013-12-06 13:20:36 +0000
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+  <data>
+    <report
+      auto="False"
+      id="delivery.shipping_label"
+      model="stock.picking"
+      name="delivery.shipping.label"
+      file="base_delivery_carrier_label/report/template/shipping_label.mako"
+      string="Shipping Label"
+      attachment_use="1"
+      multi="False"
+      report_type="webkit"/>
+  </data>
+</openerp>

=== added directory 'base_delivery_carrier_label/security'
=== added file 'base_delivery_carrier_label/security/ir.model.access.csv'
--- base_delivery_carrier_label/security/ir.model.access.csv	1970-01-01 00:00:00 +0000
+++ base_delivery_carrier_label/security/ir.model.access.csv	2013-12-06 13:20:36 +0000
@@ -0,0 +1,11 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_delivery_carrier_option_salesman,delivery.carrier.option.salesman,model_delivery_carrier_option,base.group_sale_salesman,1,0,0,0
+access_delivery_carrier_option_sale_manager,delivery.carrier.option.sale.manager,model_delivery_carrier_option,base.group_sale_manager,1,1,1,1
+access_delivery_carrier_option_stock_user,delivery.carrier.option.stock.user,model_delivery_carrier_option,stock.group_stock_user,1,0,0,0
+access_delivery_carrier_option_stock_manager,delivery.carrier.option.stock.manager,model_delivery_carrier_option,stock.group_stock_manager,1,1,1,1
+access_delivery_carrier_template_option_salesman,delivery.carrier.relation.option.salesman,model_delivery_carrier_template_option,base.group_sale_salesman,1,0,0,0
+access_delivery_carrier_template_option_sales_manager,delivery.carrier.relation.option.sale.manager,model_delivery_carrier_template_option,base.group_sale_manager,1,1,1,1
+access_delivery_carrier_template_option_salesman,delivery.carrier.relation.option.stock.user,model_delivery_carrier_template_option,stock.group_stock_user,1,0,0,0
+access_delivery_carrier_template_option_sales_manager,delivery.carrier.relation.option.stock.manager,model_delivery_carrier_template_option,stock.group_stock_manager,1,1,1,1
+access_shipping_label_user,shipping.label user,model_shipping_label,stock.group_stock_user,1,1,1,0
+access_shipping_label_manager,shipping.label manager,model_shipping_label,stock.group_stock_manager,1,1,1,1

=== added file 'base_delivery_carrier_label/stock.py'
--- base_delivery_carrier_label/stock.py	1970-01-01 00:00:00 +0000
+++ base_delivery_carrier_label/stock.py	2013-12-06 13:20:36 +0000
@@ -0,0 +1,168 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Authors: David BEAL <david.beal@xxxxxxxxxxxx>
+#             Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
+#    Copyright (C) 2012-TODAY Akretion <http://www.akretion.com>.
+#    Author: Yannick Vaucher <yannick.vaucher@xxxxxxxxxxxxxx>
+#    Copyright 2013 Camptocamp SA
+#
+#    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/>.
+#
+##############################################################################
+from openerp.osv import orm, fields
+from openerp.tools.translate import _
+
+
+class stock_picking(orm.Model):
+    """ Define m2m field due to inheritance to have it in stock.picking.out """
+    _inherit = 'stock.picking'
+
+    _columns = {
+        'option_ids': fields.many2many('delivery.carrier.option',
+                                       string='Options'),
+    }
+
+
+class stock_picking_out(orm.Model):
+    _inherit = 'stock.picking.out'
+
+    def _get_carrier_type_selection(self, cr, uid, context=None):
+        carrier_obj = self.pool.get('delivery.carrier')
+        return carrier_obj._get_carrier_type_selection(cr, uid, context=context)
+
+    _columns = {
+        'carrier_id': fields.many2one(
+            'delivery.carrier', 'Carrier',
+            states={'done': [('readonly', True)]}),
+        'carrier_type': fields.related(
+            'carrier_id', 'type',
+            string='Carrier type',
+            readonly=True,
+            type='selection',
+            selection=_get_carrier_type_selection,
+            help="Carrier type ('group')"),
+        'carrier_code': fields.related(
+            'carrier_id', 'code',
+            string='Delivery Method Code',
+            readonly=True,
+            type='char',
+            help="Delivery Method Code (from carrier)"),
+        'option_ids': fields.many2many('delivery.carrier.option',
+                                       string='Options'),
+    }
+
+    def generate_default_label(self, cr, uid, ids, context=None):
+        """ Abstract method
+
+        :return: (file_binary, file_type)
+
+        """
+        return NotImplementedError
+
+    def generate_single_label(self, cr, uid, ids, context=None):
+        """Generate a the single label by default
+
+        :return: (file_binary, file_type)
+
+        """
+        return self.generate_default_label(cr, uid, ids, context=None)
+
+    def action_generate_carrier_label(self, cr, uid, ids, context=None):
+        shipping_label_obj = self.pool.get('shipping.label')
+
+        pickings = self.browse(cr, uid, ids, context=context)
+
+        for pick in pickings:
+            label, file_type = pick.generate_single_label()
+            data = {
+                'name': pick.name,
+                'res_id': pick.id,
+                'res_model': 'stock.picking.out',
+                'datas': label.encode('base64'),
+                'file_type': file_type,
+            }
+            context_attachment = context.copy()
+            # remove default_type setted for stock_picking
+            # as it would try to define default value of attachement
+            if 'default_type' in context_attachment:
+                del context_attachment['default_type']
+            shipping_label_obj.create(cr, uid, data, context=context_attachment)
+        return True
+
+    def carrier_id_change(self, cr, uid, ids, carrier_id, context=None):
+        """ Inherit this method in your module """
+        carrier_obj = self.pool.get('delivery.carrier')
+        res = {}
+        if carrier_id:
+            carrier = carrier_obj.browse(cr, uid, carrier_id, context=context)
+            # This can look useless as the field carrier_code and
+            # carrier_type are related field. But it's needed to fill
+            # this field for using this fields in the view. Indeed the
+            # module that depend of delivery base can hide some field
+            # depending of the type or the code
+
+            default_option_ids = []
+            available_option_ids = []
+            for available_option in carrier.available_option_ids:
+                available_option_ids.append(available_option.id)
+                if available_option.state in ['default_option', 'mandatory']:
+                    default_option_ids.append(available_option.id)
+            res = {
+                'value': {'carrier_type': carrier.type,
+                          'carrier_code': carrier.code,
+                          'option_ids': default_option_ids,
+                          },
+                'domain': {'option_ids': [('id', 'in', available_option_ids)],
+                           },
+            }
+        return res
+
+    def option_ids_change(self, cr, uid, ids, option_ids, carrier_id, context=None):
+        carrier_obj = self.pool.get('delivery.carrier')
+        res = {}
+        if not carrier_id:
+            return res
+        carrier = carrier_obj.browse(cr, uid, carrier_id, context=context)
+        for available_option in carrier.available_option_ids:
+            if (available_option.state == 'mandatory'
+                    and not available_option.id in option_ids[0][2]):
+                res['warning'] = {
+                    'title': _('User Error !'),
+                    'message':  _("You can not remove a mandatory option."
+                                  "\nOptions are reset to default.")
+                }
+                default_value = self.carrier_id_change(cr, uid, ids,
+                                                       carrier_id,
+                                                       context=context)
+                res.update(default_value)
+        return res
+
+
+class ShippingLabel(orm.Model):
+    """ Child class of ir attachment to identify which are labels """
+    _inherits = {'ir.attachment': 'attachment_id'}
+    _name = 'shipping.label'
+    _description = "Shipping Label"
+
+    def _get_file_type_selection(self, cr, uid, context=None):
+        return [('pdf', 'PDF')]
+
+    _columns = {
+        'file_type': fields.selection(_get_file_type_selection, 'File type')
+    }
+
+    _defaults = {
+        'file_type': 'pdf'
+    }

=== added file 'base_delivery_carrier_label/stock_view.xml'
--- base_delivery_carrier_label/stock_view.xml	1970-01-01 00:00:00 +0000
+++ base_delivery_carrier_label/stock_view.xml	2013-12-06 13:20:36 +0000
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+  <data>
+    <!-- From DELIVERY module on STOCK.PICKING -->
+    <!-- FORM -->
+    <record id="view_picking_out_form" model="ir.ui.view">
+      <field name="name">delivery.base.stock.picking.form</field>
+      <field name="model">stock.picking.out</field>
+      <field name="inherit_id" ref="delivery.view_picking_withcarrier_out_form"/>
+      <field name="arch" type="xml">
+        <field name="state" position="before">
+          <button name="action_generate_carrier_label" states="assigned,confirmed,draft" string="Create Label" type="object"/>
+        </field>
+        <field name="carrier_id" position="attributes">
+          <attribute name="on_change">carrier_id_change(carrier_id, context)</attribute>
+        </field>
+        <notebook position='inside'>
+          <page name="carrier" string="Carrier Info">
+            <separator string="Delivery"/>
+            <field name="carrier_type"/>
+            <field name="carrier_code"/>
+            <separator string="Options"/>
+            <field name="option_ids" nolabel="1"
+              on_change="option_ids_change(option_ids, carrier_id, context)"/>
+          </page>
+        </notebook>
+      </field>
+    </record>
+
+    <!-- TREE -->
+    <!--<record id="view_picking_out_tree" model="ir.ui.view">-->
+      <!--<field name="name">stock.picking.tree</field>-->
+      <!--<field name="model">stock.picking.out</field>-->
+      <!--<field name="inherit_id" ref="stock.view_picking_out_tree" />-->
+      <!--<field name="arch" type="xml">-->
+        <!--<field name="partner_id" position="after">-->
+          <!--[><field name="carrier_type" string="carrier"/><]-->
+          <!--<field name="carrier_code" string="code"/>-->
+        <!--</field>-->
+      <!--</field>-->
+    <!--</record>-->
+
+    <!--<record id="view_picking_internal_tree" model="ir.ui.view">-->
+      <!--<field name="name">stock.picking.tree</field>-->
+      <!--<field name="model">stock.picking</field>-->
+      <!--<field name="inherit_id" ref="stock.vpicktree" />-->
+      <!--<field name="arch" type="xml">-->
+        <!--<field name="partner_id" position="after">-->
+          <!--<field name="carrier_type"/>-->
+        <!--</field>-->
+      <!--</field>-->
+    <!--</record>-->
+
+    <!--<record id="view_picking_out_search" model="ir.ui.view">-->
+      <!--<field name="name">stock.picking.out.search</field>-->
+      <!--<field name="model">stock.picking</field>-->
+      <!--<field name="inherit_id" ref="stock.view_picking_out_search"/>-->
+      <!--<field name="arch" type="xml">-->
+        <!--<field name="name" position="before">-->
+          <!--<field name="carrier_type"/>-->
+        <!--</field>-->
+      <!--</field>-->
+    <!--</record>-->
+
+    <!--<record id="view_picking_internal_search" model="ir.ui.view">-->
+      <!--<field name="name">stock.picking.internal.search</field>-->
+      <!--<field name="model">stock.picking</field>-->
+      <!--<field name="inherit_id" ref="stock.view_picking_internal_search"/>-->
+      <!--<field name="arch" type="xml">-->
+        <!--<field name="name" position="before">-->
+          <!--[><field name="carrier_type"/><]-->
+        <!--</field>-->
+      <!--</field>-->
+    <!--</record>-->
+
+  </data>
+</openerp>


Follow ups