ADD module carrier_environment

This commit is contained in:
David Beal 2019-05-13 19:12:58 +02:00
parent 13a319add3
commit 15fe7fe641
9 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1 @@
from . import models

View File

@ -0,0 +1,16 @@
# Copyright 2019 David BEAL @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Carrier configuration with server_environment',
'version': '12.0.1.0.0',
'category': 'Tools',
'summary': 'Configure carriers with server_environment_files',
'author': "Akretion, Camptocamp, Odoo Community Association (OCA)",
'license': 'AGPL-3',
'website': 'https://github.com/OCA/server-env',
'depends': [
'server_environment',
'base_delivery_carrier_label',
],
}

View File

@ -0,0 +1 @@
from . import carrier_account

View File

@ -0,0 +1,28 @@
# Copyright 2019 David BEAL @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, models
class CarrierAccount(models.Model):
_name = "carrier.account"
_inherit = ["carrier.account", "server.env.mixin"]
@property
def _server_env_fields(self):
carrier_fields = super()._server_env_fields
carrier_fields.update({
"name": {},
"account": {},
"password": {},
"file_format": {},
})
return carrier_fields
@api.model
def _server_env_global_section_name(self):
"""Name of the global section in the configuration files
Can be customized in your model
"""
return 'carrier_account'

View File

@ -0,0 +1,30 @@
With this module installed, the delivery carrier are
configured in the `server_environment_files` module (which is a module
you should provide, see the documentation of `server_environment` for
more information).
In the configuration file of each environment, you may first use the
section `[carrier_account]`.
Then for each server, you can define additional values or override the
default values with a section named `[carrier_account.resource_name]` where "resource_name" is the name of the server.
Example of config file ::
[carrier_account]
# here is the default format
file_format = 'ZPL'
[carrier_account.mycarrier]
name = mycarrier
account = 587
password = 123promenons-nous-dans-les-bois456cueillir-des-saucisses
[carrier_account.mycarrier2]
name = mycarrier2
account = 666
password = wazaaaaa
file_format = PDF

View File

@ -0,0 +1,2 @@
* David Béal <david.beal@akretion.com>
* Guewen Baconnier <guewen.baconnier@camptocamp.com>

View File

@ -0,0 +1,3 @@
This module allows to configure carrier informations
using the `server_environment` mechanism: you can then have different
servers for the production and the test environment.

View File

@ -0,0 +1,3 @@
Once configured, Odoo will read the carrier values from the
configuration file related to each environment defined in the main
Odoo file or in carrier.account model.

1
oca_dependencies.txt Normal file
View File

@ -0,0 +1 @@
delivery-carrier https://github.com/Timo17100-c2c/delivery-carrier 12.0-mig-base_delivery_carrier_label