[ADD] delivery: environment field
This field is used in all delivery carriers to determine if they call the test or the production API.
This commit is contained in:
@@ -51,6 +51,11 @@ class DeliveryCarrier(models.Model):
|
||||
price_rule_ids = fields.One2many('delivery.price.rule', 'carrier_id', 'Pricing Rules', copy=True)
|
||||
fixed_price = fields.Float(compute='_compute_fixed_price', inverse='_set_product_fixed_price', store=True, string='Fixed Price',help="Keep empty if the pricing depends on the advanced pricing per destination")
|
||||
shipping_enabled = fields.Boolean(string="Shipping enabled", default=True, help="Uncheck this box to disable package shipping while validating Delivery Orders")
|
||||
prod_environment = fields.Boolean("Environment", help="Set to True if your credentials are certified for production.")
|
||||
|
||||
@api.one
|
||||
def toggle_prod_environment(self):
|
||||
self.prod_environment = not self.prod_environment
|
||||
|
||||
@api.multi
|
||||
def name_get(self):
|
||||
|
||||
@@ -23,6 +23,14 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Carrier">
|
||||
<sheet>
|
||||
<div class="oe_button_box" name="button_box">
|
||||
<button name="toggle_active" type="object" class="oe_stat_button" icon="fa-archive">
|
||||
<field name="active" widget="boolean_button" options='{"terminology": "archive"}'/>
|
||||
</button>
|
||||
<button name="toggle_prod_environment" type="object" class="oe_stat_button" icon="fa-check-square" attrs="{'invisible': ['|', ('delivery_type', '=', 'fixed'), ('delivery_type', '=', 'base_on_rule')]}">
|
||||
<field name="prod_environment" widget="boolean_button" options='{"terminology": "prod_environment"}'/>
|
||||
</button>
|
||||
</div>
|
||||
<div class="oe_title" name="title">
|
||||
<label for="name" string="Name" class="oe_edit_only"/>
|
||||
<h1>
|
||||
|
||||
@@ -665,6 +665,12 @@ var FieldBooleanButton = common.AbstractField.extend({
|
||||
this.string_false = _t("Archived");
|
||||
this.hover_false = _t("Unarchive");
|
||||
break;
|
||||
case "prod_environment":
|
||||
this.string_true = _t("Production Environment");
|
||||
this.hover_true = _t("Switch to test environment");
|
||||
this.string_false = _t("Test Environment");
|
||||
this.hover_false = _t("Switch to production environment");
|
||||
break;
|
||||
default:
|
||||
this.string_true = _t("On");
|
||||
this.hover_true = _t("Switch Off");
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record model="ir.ui.view" id="view_delivery_carrier_form">
|
||||
<record model="ir.ui.view" id="view_delivery_carrier_form_website_delivery">
|
||||
<field name="name">delivery.carrier.website.form</field>
|
||||
<field name="model">delivery.carrier</field>
|
||||
<field name="inherit_id" ref="delivery.view_delivery_carrier_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<div name="title" position="before">
|
||||
<div class="oe_button_box" name="button_box">
|
||||
<button class="oe_stat_button" name="website_publish_button"
|
||||
type="object" icon="fa-globe">
|
||||
<field name="website_published" widget="website_button"/>
|
||||
</button>
|
||||
</div>
|
||||
<div name="button_box" position="inside">
|
||||
<button class="oe_stat_button" name="website_publish_button" type="object" icon="fa-globe">
|
||||
<field name="website_published" widget="website_button"/>
|
||||
</button>
|
||||
</div>
|
||||
<div name="title" position="after">
|
||||
<group>
|
||||
<group name="website">
|
||||
<field name="website_description" string="Description" placeholder="Description displayed on the eCommerce and on the Online Quotations."/>
|
||||
</group>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user