Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colissimo support #1

Open
wants to merge 22 commits into
base: 8.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ install:
- pip install unidecode
- pip install pycountry
- pip install suds-jurko==0.6
- pip install https://github.com/damdam-s/roulier/archive/workarounds.zip

script:
- travis_run_tests
Expand Down
6 changes: 6 additions & 0 deletions delivery_carrier_label_roulier/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-

from . import stock
from . import delivery_dummy
from . import stock_dummy
from . import tests
39 changes: 39 additions & 0 deletions delivery_carrier_label_roulier/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# licence AGPL version 3 or later
# see licence in __openerp__.py or http://www.gnu.org/licenses/agpl-3.0.txt
# Copyright (C) 2016 Akretion (https://www.akretion.com).
# @author Raphael Reverdy <raphael.reverdy@akretion.com>
#
##############################################################################
{
'name': 'Delivery Carrier Roulier',
'version': '8.0.0.0.3',
'author': 'Akretion, Camptocamp, Odoo Community Association (OCA)',
'summary': 'Integration of multiple carriers (base)',
'maintainer': 'Akretion',
'category': 'Warehouse',
'depends': [
'partner_helper',
'delivery_carrier_b2c',
],
'description': "",
'website': 'http://www.akretion.com/',
'data': [
'data/delivery.xml',
'delivery_view.xml',
],
'demo': [
],
'external_dependencies': {
'python': [
'roulier' # 'git+https://github.com/akretion/roulier.git'
],
},
'tests': [],
'installable': True,
'auto_install': False,
'license': 'AGPL-3',
'application': False,
}
39 changes: 39 additions & 0 deletions delivery_carrier_label_roulier/data/delivery.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

<!-- PRODUCT -->
<record id="product_product_dummy" model="product.product">
<field name="default_code">SHIP_DUMMY</field>
<field name="standard_price">0.0</field>
<field name="cost_method">standard</field>
<field name="type">service</field>
<field name="procure_method">make_to_stock</field>
<field name="supply_method">buy</field>
<field name="name">Test only - DUMMY</field>
<field name="categ_id">1</field>
</record>

<!-- PARTNER -->
<record id="partner_dummy" model="res.partner">
<field name="name">DUMMY</field>
<field name="customer" eval="False"/>
<field name="supplier" eval="True"/>
<field name="street">rue du colis</field>
<field name="zip">99999</field>
<field name="city">XXXXXX PFC</field>
</record>


<!-- DELIVERY CARRIER -->
<record id="delivery_carrier_dummy" model="delivery.carrier">
<field name="name">DUMMY</field>
<field name="type">dummy</field>
<field name="code">DUMMY</field>
<field name="use_detailed_pricelist" eval="1"/>
<field name="deposit_slip" eval="False"/>
<field name="partner_id" ref="delivery_carrier_label_roulier.partner_dummy"/>
<field name="product_id" ref="delivery_carrier_label_roulier.product_product_dummy"/>
</record>
</data>
</openerp>
33 changes: 33 additions & 0 deletions delivery_carrier_label_roulier/delivery_dummy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# licence AGPL version 3 or later
# see licence in __openerp__.py or http://www.gnu.org/licenses/agpl-3.0.txt
# Copyright (C) 2016 Akretion (http://www.akretion.com).
#
##############################################################################

from openerp import models, api, fields
from roulier.carriers.laposte.laposte_encoder import LAPOSTE_LABEL_FORMAT


class DeliveryCarrier(models.Model):
_inherit = 'delivery.carrier'

@api.model
def _get_carrier_type_selection(self):
"""Add Dummy carrier type."""
res = super(DeliveryCarrier, self)._get_carrier_type_selection()
res.append(('dummy', 'DUMMY'),)
return res

@api.model
def _get_label_format_selection(self):
"""Output label formats available"""
return [(x, x) for x in LAPOSTE_LABEL_FORMAT]

label_format = fields.Selection(
selection='_get_label_format_selection',
default='PDF_10x15_300dpi',
string='Type',
help="Label output format",)
30 changes: 30 additions & 0 deletions delivery_carrier_label_roulier/delivery_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>

<!-- INHERITED VIEW FOR THE OBJECT : delivery.carrier -->

<record id="view_delivery_carrier_label_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="base_delivery_carrier_label.view_delivery_carrier_form"/>
<field name="arch" type="xml">
<field name="code" position="after">
<field name="label_format"/>
</field>
</field>
</record>

<record id="view_delivery_carrier_label_tree" model="ir.ui.view">
<field name="name">delivery_carrier_base.tree</field>
<field name="model">delivery.carrier</field>
<field name="inherit_id" ref="base_delivery_carrier_label.view_delivery_carrier_tree"/>
<field name="arch" type="xml">
<field name="code" position="after">
<field name="label_format"/>
</field>
</field>
</record>

</data>
</openerp>
Loading