[IMP] point_of_sale: Back2Basics.

Allow the user to archive the payment methods and the floor plans.
Change some typo.
Allow manager to have access to the cash closing control wizard.
Allow the user to set cash in or out in the wizard.

closes odoo/odoo#45719

Task-id: 2125227
Related: odoo/enterprise#8562
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This commit is contained in:
Robin Heinz
2020-06-17 13:49:10 +00:00
committed by Pierre Masereel
parent eb5ebc804f
commit b366501148
8 changed files with 51 additions and 23 deletions
@@ -46,6 +46,7 @@ class PosPaymentMethod(models.Model):
use_payment_terminal = fields.Selection(selection=lambda self: self._get_payment_terminal_selection(), string='Use a Payment Terminal', help='Record payments with a terminal on this journal.')
hide_use_payment_terminal = fields.Boolean(compute='_compute_hide_use_payment_terminal', help='Technical field which is used to '
'hide use_payment_terminal when no payment interfaces are installed.')
active = fields.Boolean(default=True)
@api.depends('is_cash_count')
def _compute_hide_use_payment_terminal(self):
@@ -75,6 +76,6 @@ class PosPaymentMethod(models.Model):
def write(self, vals):
if self._is_write_forbidden(set(vals.keys())):
raise UserError('Kindly close and validate the following open PoS Sessions before modifying this payment method.\n'
raise UserError('Please close and validate the following open PoS Sessions before modifying this payment method.\n'
'Open sessions: %s' % (' '.join(self.open_session_ids.mapped('name')),))
return super(PosPaymentMethod, self).write(vals)
@@ -40,7 +40,7 @@ access_decimal_precision_user,decimal.precision,base.model_decimal_precision,gro
access_pos_payment_user,pos.payment user,model_pos_payment,group_pos_user,1,1,1,1
access_pos_payment_method_user,pos.payment.method user,model_pos_payment_method,group_pos_user,1,0,0,0
access_pos_payment_method_manager,pos.payment.method manager,model_pos_payment_method,group_pos_manager,1,1,1,1
access_closing_balance_confirm_wizard,access.closing.balance.confirm.wizard,model_closing_balance_confirm_wizard,point_of_sale.group_pos_manager,0,0,0,0
access_closing_balance_confirm_wizard,access.closing.balance.confirm.wizard,model_closing_balance_confirm_wizard,point_of_sale.group_pos_manager,1,1,1,0
access_pos_details_wizard,access.pos.details.wizard,model_pos_details_wizard,point_of_sale.group_pos_manager,1,1,1,0
access_pos_make_payment,access.pos.make.payment,model_pos_make_payment,point_of_sale.group_pos_manager,1,1,1,0
access_account_cash_rounding,account.cash.rounding,model_account_cash_rounding,point_of_sale.group_pos_user,1,0,0,0
access_money_in_out_wizard,access.money.in.out.wizard,model_cash_box_out,point_of_sale.group_pos_user,1,1,1,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
40 access_pos_payment_user pos.payment user model_pos_payment group_pos_user 1 1 1 1
41 access_pos_payment_method_user pos.payment.method user model_pos_payment_method group_pos_user 1 0 0 0
42 access_pos_payment_method_manager pos.payment.method manager model_pos_payment_method group_pos_manager 1 1 1 1
43 access_closing_balance_confirm_wizard access.closing.balance.confirm.wizard model_closing_balance_confirm_wizard point_of_sale.group_pos_manager 0 1 0 1 0 1 0
44 access_pos_details_wizard access.pos.details.wizard model_pos_details_wizard point_of_sale.group_pos_manager 1 1 1 0
45 access_pos_make_payment access.pos.make.payment model_pos_make_payment point_of_sale.group_pos_manager 1 1 1 0
46 access_account_cash_rounding access_money_in_out_wizard account.cash.rounding access.money.in.out.wizard model_account_cash_rounding model_cash_box_out point_of_sale.group_pos_user 1 0 1 0 1 0
@@ -578,9 +578,9 @@
<field name="search_view_id" ref="view_pos_config_search" />
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new PoS config
Create a new PoS
</p><p>
Configure at least one Point of Sale to be able to sell through the PoS interface.
Configure at least one Point of Sale.
</p>
</field>
</record>
@@ -361,7 +361,7 @@
<field name="arch" type="xml">
<xpath expr="//div[hasclass('oe_title')]" position="before">
<div class="o_notification_alert alert alert-warning" role="alert">
The Point of Sale only support the "add a rounding line" rounding strategy.
The Point of Sale only supports the "add a rounding line" rounding strategy.
</div>
</xpath>
</field>
@@ -6,6 +6,8 @@
<field name="arch" type="xml">
<form string="Payment Methods">
<sheet>
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
<field name="active" invisible="1"/>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1><field name="name" class="oe_inline"/></h1>
@@ -54,6 +56,7 @@
<group expand="1" string="Group By">
<filter name="group_by_receivable_account" string="Account" domain="[]" context="{'group_by':'receivable_account_id'}"/>
</group>
<filter string="Archived" name="active" domain="[('active', '=', False)]"/>
</search>
</field>
</record>
@@ -8,23 +8,6 @@
<field name="arch" type="xml">
<xpath expr="//div[hasclass('settings')]" position="inside">
<div class="app_settings_block" data-string="Point of sale" string="Point of Sale" data-key="point_of_sale" groups="point_of_sale.group_pos_manager">
<h2>Product</h2>
<div class="row mt16 o_settings_container" name="product_setting_container">
<div class="col-12 col-lg-6 o_setting_box" id="update_quantities_stock_setting">
<div class="o_setting_right_pane">
<div>
<label string="Inventory Management" for="update_stock_quantities"/>
<span class="fa fa-lg fa-building-o" title="Values set here are company-specific." aria-label="Values set here are company-specific." groups="base.group_multi_company" role="img"/>
<div class="text-muted">
Update quantities in stock
</div>
<div class="content-group mt16">
<field name="update_stock_quantities" colspan="4" nolabel="1" widget="radio"/>
</div>
</div>
</div>
</div>
</div>
<h2>Taxes</h2>
<div class="row mt16 o_settings_container" name="taxes_setting_container">
<div class="col-12 col-lg-6 o_setting_box"
@@ -151,6 +134,23 @@
</div>
</div>
</div>
<h2>Inventory</h2>
<div class="row mt16 o_settings_container" name="product_setting_container">
<div class="col-12 col-lg-6 o_setting_box" id="update_quantities_stock_setting">
<div class="o_setting_right_pane">
<div>
<label string="Inventory Management" for="update_stock_quantities"/>
<span class="fa fa-lg fa-building-o" title="Values set here are company-specific." aria-label="Values set here are company-specific." groups="base.group_multi_company" role="img"/>
<div class="text-muted">
Update quantities in stock
</div>
<div class="content-group mt16 o_light_label">
<field name="update_stock_quantities" colspan="4" nolabel="1" widget="radio"/>
</div>
</div>
</div>
</div>
</div>
</div>
</xpath>
</field>
@@ -16,6 +16,7 @@ class RestaurantFloor(models.Model):
background_color = fields.Char('Background Color', help='The background color of the floor layout, (must be specified in a html-compatible format)', default='rgb(210, 210, 210)')
table_ids = fields.One2many('restaurant.table', 'floor_id', string='Tables', help='The list of tables in this floor')
sequence = fields.Integer('Sequence', help='Used to sort Floors', default=1)
active = fields.Boolean(default=True)
def unlink(self):
confs = self.mapped('pos_config_id').filtered(lambda c: c.is_table_management == True)
@@ -30,6 +31,16 @@ class RestaurantFloor(models.Model):
raise UserError(error_msg)
return super(RestaurantFloor, self).unlink()
def write(self, vals):
for floor in self:
if floor.pos_config_id.has_active_session and (vals.get('pos_config_id') or vals.get('active')) :
raise UserError(
'Please close and validate the following open PoS Session before modifying this floor.\n'
'Open session: %s' % (' '.join(floor.pos_config_id.mapped('name')),))
if vals.get('pos_config_id') and floor.pos_config_id.id and vals.get('pos_config_id') != floor.pos_config_id.id:
raise UserError('The %s is already used in another Pos Config.' % floor.name)
return super(RestaurantFloor, self).write(vals)
class RestaurantTable(models.Model):
@@ -8,6 +8,8 @@
<field name="arch" type="xml">
<form string="Restaurant Floor">
<sheet>
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
<field name="active" invisible="1"/>
<group col="4">
<field name="name" />
<field name="pos_config_id" />
@@ -37,6 +39,17 @@
</field>
</record>
<record id="view_restaurant_floor_search" model="ir.ui.view">
<field name="name">restaurant.floor.search</field>
<field name="model">restaurant.floor</field>
<field name="arch" type="xml">
<search>
<field name="name"/>
<filter string="Archived" name="active" domain="[('active', '=', False)]"/>
</search>
</field>
</record>
<record id="view_restaurant_floor_kanban" model="ir.ui.view">
<field name="name">restaurant.floor.kanban</field>
<field name="model">restaurant.floor</field>