[IMP] point_of_sale*: Improve the settings form view
This commit is contained in:
committed by
Yannick Tivisse
parent
e01729ff28
commit
6ddaaf2f8e
@@ -1,32 +1,58 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from odoo import fields, models
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class PosConfiguration(models.TransientModel):
|
||||
_inherit = 'res.config.settings'
|
||||
_name = 'pos.config.settings'
|
||||
|
||||
module_pos_restaurant = fields.Selection([
|
||||
(0, "Point of sale for shops"),
|
||||
(1, "Restaurant: activate table management")
|
||||
], string="Restaurant",
|
||||
help='This module adds several restaurant features to the Point of Sale: \n\n- Bill Printing: Allows you to print a receipt before the order is paid \n\n- Bill Splitting: Allows you to split an order into different orders \n\n- Kitchen Order Printing: allows you to print orders updates to kitchen or bar printers')
|
||||
module_pos_loyalty = fields.Boolean(
|
||||
string="Loyalty Program",
|
||||
help='Allows you to define a loyalty program in the point of sale, where the customers earn loyalty points and get rewards')
|
||||
module_pos_discount = fields.Selection([
|
||||
(0, "Allow discounts on order lines only"),
|
||||
(1, "Allow global discounts")
|
||||
], string="Discount",
|
||||
help='Allows the cashier to quickly give a percentage sale discount for all the sales order to a customer')
|
||||
module_pos_mercury = fields.Selection([
|
||||
(0, "No credit card"),
|
||||
(1, "Allows customers to pay with credit cards.")
|
||||
], string="Credit Cards",
|
||||
help='The transactions are processed by MercuryPay')
|
||||
module_pos_reprint = fields.Selection([
|
||||
(0, "No reprint"),
|
||||
(1, "Allow cashier to reprint receipts")
|
||||
], string="Reprints")
|
||||
group_multi_currency = fields.Boolean("Multi-Currencies", implied_group='base.group_multi_currency')
|
||||
group_product_variant = fields.Boolean("Attributes & Variants", implied_group='product.group_product_variant')
|
||||
group_product_pricelist = fields.Boolean("Show pricelists On Products",
|
||||
implied_group='product.group_product_pricelist')
|
||||
group_pricelist_item = fields.Boolean("Show pricelists to customers",
|
||||
implied_group='product.group_pricelist_item')
|
||||
group_sale_pricelist = fields.Boolean("Use pricelists to adapt your price per customers",
|
||||
implied_group='product.group_sale_pricelist',
|
||||
help="""Allows to manage different prices based on rules per category of customers.
|
||||
Example: 10% for retailers, promotion of 5 EUR on this product, etc.""")
|
||||
default_sale_price = fields.Boolean("A single sale price per product", default_model='pos.config.settings')
|
||||
default_pricelist_setting = fields.Selection([
|
||||
('percentage', 'Multiple prices per product (e.g. quantity, shop-specific)'),
|
||||
('formula', 'Price computed from formulas (discounts, margins, rounding)')
|
||||
], string="Pricelists", default_model='pos.config.settings')
|
||||
module_pos_restaurant = fields.Boolean(string="Restaurant")
|
||||
module_pos_loyalty = fields.Boolean(string="Loyalty Program")
|
||||
module_pos_discount = fields.Boolean(string="Global Discounts")
|
||||
module_pos_mercury = fields.Boolean(string="Credit Cards")
|
||||
module_pos_reprint = fields.Boolean(string="Reprint Receipt")
|
||||
module_pos_data_drinks = fields.Boolean(string="Import common drinks data")
|
||||
|
||||
@api.onchange('default_sale_price')
|
||||
def _onchange_fix_sale_price(self):
|
||||
if not self.default_sale_price:
|
||||
self.default_pricelist_setting = False
|
||||
if self.default_sale_price and not self.default_pricelist_setting:
|
||||
self.default_pricelist_setting = 'percentage'
|
||||
|
||||
@api.onchange('default_pricelist_setting')
|
||||
def _onchange_sale_price(self):
|
||||
if self.default_pricelist_setting == 'percentage':
|
||||
self.update({
|
||||
'group_product_pricelist': True,
|
||||
'group_sale_pricelist': True,
|
||||
'group_pricelist_item': False,
|
||||
})
|
||||
elif self.default_pricelist_setting == 'formula':
|
||||
self.update({
|
||||
'group_product_pricelist': False,
|
||||
'group_sale_pricelist': True,
|
||||
'group_pricelist_item': True,
|
||||
})
|
||||
else:
|
||||
self.update({
|
||||
'group_product_pricelist': False,
|
||||
'group_sale_pricelist': False,
|
||||
'group_pricelist_item': False,
|
||||
})
|
||||
|
||||
@@ -1,37 +1,160 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="view_sale_config_settings_form_pos" model="ir.ui.view">
|
||||
<record id="pos_config_settings_view_form" model="ir.ui.view">
|
||||
<field name="name">pos.config.settings.form</field>
|
||||
<field name="model">pos.config.settings</field>
|
||||
<field name="arch" type="xml">
|
||||
<form class="oe_form_configuration">
|
||||
<header>
|
||||
<button string="Apply" type="object" name="execute" class="oe_highlight"/>
|
||||
<button string="Save" type="object" name="execute" class="oe_highlight"/>
|
||||
<button string="Cancel" type="object" name="cancel" class="oe_link"/>
|
||||
</header>
|
||||
<group string="Importable Point of Sale Data">
|
||||
<label for="div" string="Beverages"/>
|
||||
<div>
|
||||
<div>
|
||||
<field name="module_pos_data_drinks"/>
|
||||
<label for="module_pos_data_drinks"/>
|
||||
<sheet>
|
||||
<h2>Point of Sale</h2>
|
||||
<div class="row mt16 o_settings_container">
|
||||
<div class="col-xs-12 col-md-6 o_setting_box" title="Restaurants benefit from additional features. Bill Printing allows you to print a receipt before the order is paid. Bill Splitting allows you to split an order into different orders. Kitchen Order Printing allows you to print order updates to kitchen or bar printers.">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="module_pos_restaurant"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label string="Restaurant"/>
|
||||
<div class="text-muted">
|
||||
Add table management, tips, bill printing & split, etc.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</group>
|
||||
<group string="Point of Sale">
|
||||
<field name="module_pos_restaurant" widget="radio"/>
|
||||
<field name="module_pos_discount" widget="radio"/>
|
||||
<field name="module_pos_mercury" widget="radio"/>
|
||||
<field name="module_pos_reprint" widget="radio"/>
|
||||
<label for="module_pos_loyalty"/>
|
||||
<div>
|
||||
<div>
|
||||
<field name="module_pos_loyalty" widget="upgrade_boolean"/>
|
||||
<label for="module_pos_loyalty" string="Manage loyalty program with points and rewards for customers"/>
|
||||
<a href="https://www.odoo.com/page/point-of-sale" target="_blank"> More Info</a>
|
||||
</div>
|
||||
<h2>Pricing</h2>
|
||||
<div class="row mt16 o_settings_container">
|
||||
<div class="col-xs-12 col-md-6 o_setting_box" title="Allows the cashier to quickly give a percentage sale discount for all the sales order to a customer.">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="module_pos_discount"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="module_pos_discount"/>
|
||||
<div class="text-muted">
|
||||
Allow global discounts on orders
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6 o_setting_box" title="Allows you to define a loyalty program in the point of sale, where the customers earn loyalty points and get rewards.">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="module_pos_loyalty" widget="upgrade_boolean"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="module_pos_loyalty"/>
|
||||
<div class="text-muted">
|
||||
Give customer rewards, free samples, etc.
|
||||
</div>
|
||||
<div class="content-group">
|
||||
<div class="text-warning mt16 mb4" id="msg_loyalty_program" attrs="{'invisible': [('module_pos_loyalty', '=', False)]}">
|
||||
Save this page and come back here to set up this feature.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6 o_setting_box" title="There are two ways to manage pricelists: 1) Multiple prices per product (e.g. quantity, shop-specific) : must be set in the Sales tab of the product detail form. 2) Price computed from formulas (discounts, margins, rounding) : must be set in the pricelist form.">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="default_sale_price"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="default_pricelist_setting"/>
|
||||
<div class="text-muted">
|
||||
Set shop-specific prices, seasonal discounts, etc.
|
||||
</div>
|
||||
<div class="content-group" attrs="{'invisible': [('default_sale_price','=',False)]}">
|
||||
<div class="mt16">
|
||||
<field name="group_product_pricelist" invisible="1"/>
|
||||
<field name="group_sale_pricelist" invisible="1"/>
|
||||
<field name="group_pricelist_item" invisible="1"/>
|
||||
<field name="default_pricelist_setting" widget="radio" class="o_light_label"/>
|
||||
</div>
|
||||
<div>
|
||||
<button name="%(product.product_pricelist_action2)d" icon="fa-arrow-right" type="action"
|
||||
string="Pricelists" attrs="{'invisible': [('default_pricelist_setting', '=', False)]}" class="btn-link"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="group_multi_currency"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="group_multi_currency"/>
|
||||
<div class="text-muted">
|
||||
Sell in several currencies
|
||||
</div>
|
||||
<div class="content-group" attrs="{'invisible': [('group_multi_currency','=',False)]}">
|
||||
<div class="mt16">
|
||||
<button name="%(base.action_currency_form)d" icon="fa-arrow-right" type="action" string="Currencies" class="btn-link"/>
|
||||
</div>
|
||||
<div>
|
||||
<button name="%(account.action_account_config)d" icon="fa-arrow-right" type="action" string="Advanced Currencies Setup" class="btn-link"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</group>
|
||||
<h2>Products</h2>
|
||||
<div class="row mt16 o_settings_container">
|
||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="group_product_variant"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="group_product_variant"/>
|
||||
<div class="text-muted">
|
||||
Set product attributes (e.g. color, size) to sell variants
|
||||
</div>
|
||||
<div class="content-group mt16" attrs="{'invisible': [('group_product_variant','=',False)]}">
|
||||
<button name="%(product.attribute_action)d" icon="fa-arrow-right" type="action" string="Attributes" class="btn-link"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="module_pos_data_drinks"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label string="Drinks" for="module_pos_data_drinks"/>
|
||||
<div class="text-muted">
|
||||
Get a predefined set of common drinks
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2>Payments</h2>
|
||||
<div class="row mt16 o_settings_container">
|
||||
<div class="col-xs-12 col-md-6 o_setting_box" title="The transactions are processed by MercuryPay.">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="module_pos_mercury"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="module_pos_mercury"/>
|
||||
<div class="text-muted">
|
||||
Accept payments with an integrated card reader
|
||||
</div>
|
||||
<div class="content-group">
|
||||
<div class="text-warning mt16 mb4" id="msg_pos_mercury" attrs="{'invisible': [('module_pos_mercury', '=', False)]}">
|
||||
Save this page and come back here to set up this feature.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="module_pos_reprint"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="module_pos_reprint"/>
|
||||
<div class="text-muted">
|
||||
Allow cashier to reprint receipts
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -29,6 +29,7 @@ following:
|
||||
'views/pos_mercury_templates.xml',
|
||||
'views/pos_mercury_views.xml',
|
||||
'views/pos_mercury_transaction_templates.xml',
|
||||
'views/pos_config_setting_views.xml',
|
||||
],
|
||||
'demo': [
|
||||
'data/pos_mercury_demo.xml',
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="pos_config_settings_view_form_inherit_pos_mercury" model="ir.ui.view">
|
||||
<field name="name">pos.config.settings.form.inherit.mercury</field>
|
||||
<field name="model">pos.config.settings</field>
|
||||
<field name="inherit_id" ref="point_of_sale.pos_config_settings_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<div id="msg_pos_mercury" position="replace">
|
||||
<div class="mt16" attrs="{'invisible': [('module_pos_mercury', '=', False)]}">
|
||||
<button name="%(pos_mercury.action_configuration_form)d" icon="fa-arrow-right" type="action" string="Mercury Configuration" class="btn-link"/>
|
||||
</div>
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user