← Back to team overview

openerp-community-reviewer team mailing list archive

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

 

Yannick Vaucher @ Camptocamp has proposed merging lp:~camptocamp/carriers-deliveries/7.0-add-delivery_carrier_label_postlogistics_shop_logo-yvr into lp:carriers-deliveries with lp:~camptocamp/carriers-deliveries/7.0-add-delivery_carrier_label_postlogistics-yvr as a prerequisite.

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

For more details, see:
https://code.launchpad.net/~camptocamp/carriers-deliveries/7.0-add-delivery_carrier_label_postlogistics_shop_logo-yvr/+merge/196859
-- 
https://code.launchpad.net/~camptocamp/carriers-deliveries/7.0-add-delivery_carrier_label_postlogistics_shop_logo-yvr/+merge/196859
Your team Stock and Logistic Core Editors is subscribed to branch lp:carriers-deliveries.
=== added directory 'delivery_carrier_label_postlogistics_shop_logo'
=== added file 'delivery_carrier_label_postlogistics_shop_logo/__init__.py'
--- delivery_carrier_label_postlogistics_shop_logo/__init__.py	1970-01-01 00:00:00 +0000
+++ delivery_carrier_label_postlogistics_shop_logo/__init__.py	2013-12-03 14:51:01 +0000
@@ -0,0 +1,23 @@
+# -*- 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 postlogistics
+from . import sale
+from . import stock

=== added file 'delivery_carrier_label_postlogistics_shop_logo/__openerp__.py'
--- delivery_carrier_label_postlogistics_shop_logo/__openerp__.py	1970-01-01 00:00:00 +0000
+++ delivery_carrier_label_postlogistics_shop_logo/__openerp__.py	2013-12-03 14:51:01 +0000
@@ -0,0 +1,47 @@
+# -*- 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': 'PostLogistics labels - logo per Shop',
+ 'version': '1.0',
+ 'author': 'Camptocamp',
+ 'maintainer': 'Camptocamp',
+ 'category': 'version',
+ 'complexity': 'normal',
+ 'depends': ['delivery_carrier_label_postlogistics'],
+ 'description': """
+PostLogistics labels - logo per Shop
+===================================
+
+Add an option to define a logo per shop.
+If no shop logo is defined uses company logo.
+
+Contributors
+------------
+
+* Yannick Vaucher <yannick.vaucher@xxxxxxxxxxxxxx>
+
+""",
+ 'website': 'http://www.camptocamp.com/',
+ 'data': ['sale_view.xml'],
+ 'test': [],
+ 'installable': True,
+ 'auto_install': False,
+ 'application': True,
+ }

=== added directory 'delivery_carrier_label_postlogistics_shop_logo/i18n'
=== added directory 'delivery_carrier_label_postlogistics_shop_logo/postlogistics'
=== added file 'delivery_carrier_label_postlogistics_shop_logo/postlogistics/__init__.py'
--- delivery_carrier_label_postlogistics_shop_logo/postlogistics/__init__.py	1970-01-01 00:00:00 +0000
+++ delivery_carrier_label_postlogistics_shop_logo/postlogistics/__init__.py	2013-12-03 14:51:01 +0000
@@ -0,0 +1,21 @@
+# -*- 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 web_service

=== added file 'delivery_carrier_label_postlogistics_shop_logo/postlogistics/web_service.py'
--- delivery_carrier_label_postlogistics_shop_logo/postlogistics/web_service.py	1970-01-01 00:00:00 +0000
+++ delivery_carrier_label_postlogistics_shop_logo/postlogistics/web_service.py	2013-12-03 14:51:01 +0000
@@ -0,0 +1,48 @@
+# -*- 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 PIL import Image
+from StringIO import StringIO
+
+from openerp.addons.delivery_carrier_label_postlogistics.postlogistics import (
+    web_service
+)
+
+
+class PostlogisticsWebServiceShop(web_service.PostlogisticsWebService):
+    """ Use picking information to get shop logo """
+
+    def _get_shop_label_logo(self, picking):
+        shop_logo = {}
+        shop = picking.sale_id.shop_id
+        if shop and shop.postlogistics_logo:
+            logo = shop.postlogistics_logo
+            logo_image = Image.open(StringIO(logo.decode('base64')))
+            logo_format = logo_image.format
+            shop_logo['Logo'] = logo
+            shop_logo['LogoFormat'] = logo_format
+        return shop_logo
+
+    def _prepare_envelope(self, picking, post_customer, data):
+        """ Replace company label logo by shop label logo in customer data """
+        shop_logo = self._get_shop_label_logo(picking)
+        post_customer.update(shop_logo)
+        return super(PostlogisticsWebServiceShop, self
+                     )._prepare_envelope(picking, post_customer, data)

=== added file 'delivery_carrier_label_postlogistics_shop_logo/sale.py'
--- delivery_carrier_label_postlogistics_shop_logo/sale.py	1970-01-01 00:00:00 +0000
+++ delivery_carrier_label_postlogistics_shop_logo/sale.py	2013-12-03 14:51:01 +0000
@@ -0,0 +1,29 @@
+# -*- 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 openerp.osv import orm, fields
+
+
+class SaleShop(orm.Model):
+    _inherit = 'sale.shop'
+
+    _columns = {
+        'postlogistics_logo': fields.binary('Shop logo for PostLogistics'),
+        }

=== added file 'delivery_carrier_label_postlogistics_shop_logo/sale_view.xml'
--- delivery_carrier_label_postlogistics_shop_logo/sale_view.xml	1970-01-01 00:00:00 +0000
+++ delivery_carrier_label_postlogistics_shop_logo/sale_view.xml	2013-12-03 14:51:01 +0000
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+  <data>
+    <!-- INHERIT of sale.shop form view -->
+    <record id="view_shop_form" model="ir.ui.view">
+      <field name="name">sale.shop</field>
+      <field name="model">sale.shop</field>
+      <field name="inherit_id" ref="sale.view_shop_form"/>
+      <field name="arch" type="xml">
+        <group name="shop" position="inside">
+            <group>
+              <field name="postlogistics_logo" widget="image"/>
+            </group>
+        </group>
+      </field>
+    </record>
+  </data>
+</openerp>

=== added directory 'delivery_carrier_label_postlogistics_shop_logo/security'
=== added file 'delivery_carrier_label_postlogistics_shop_logo/stock.py'
--- delivery_carrier_label_postlogistics_shop_logo/stock.py	1970-01-01 00:00:00 +0000
+++ delivery_carrier_label_postlogistics_shop_logo/stock.py	2013-12-03 14:51:01 +0000
@@ -0,0 +1,35 @@
+# -*- 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 openerp.osv import orm
+
+from postlogistics.web_service import PostlogisticsWebServiceShop
+
+
+class stock_picking_out(orm.Model):
+    _inherit = 'stock.picking.out'
+
+    def _generate_postlogistics_label(self, cr, uid, picking,
+                                      webservice_class=None, context=None):
+        """ Generate post label using shop label """
+        return super(stock_picking_out, self)._generate_postlogistics_label(
+            cr, uid, picking,
+            webservice_class=PostlogisticsWebServiceShop,
+            context=context)


Follow ups