summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorRobin Heinz <rhe@odoo.com>2019-07-30 08:27:58 +0000
committerPierre Masereel <pim@odoo.com>2019-11-25 11:00:04 +0000
commitdaf6db970d62103510125cceea40cfbce70929ca (patch)
tree477be69872a1344fa226c1697c4a27bad1519ce8 /addons
parent67848457d0049870b8dacc33637a1d89d4c3dfa1 (diff)
[IMP] point_of_sale: cash closing difference visible
When a pos session is closed, the difference and transactions of cash control are not good anymore, because it is based on the statement linked to the cash payment method, and it is modified during the validation of the session to create a balanced account move. So we are now storing the values in fields, to keep history of the closing control closes odoo/odoo#35286 Task-id: 2032173 Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/point_of_sale/models/pos_session.py8
-rw-r--r--addons/point_of_sale/views/pos_session_view.xml19
2 files changed, 22 insertions, 5 deletions
diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py
index 64d50ef236b..7b8bc3b1c6e 100644
--- a/addons/point_of_sale/models/pos_session.py
+++ b/addons/point_of_sale/models/pos_session.py
@@ -77,9 +77,12 @@ class PosSession(models.Model):
readonly=True)
cash_register_difference = fields.Monetary(
compute='_compute_cash_balance',
- string='Difference',
+ string='Before Closing Difference',
help="Difference between the theoretical closing balance and the real closing balance.",
readonly=True)
+ cash_real_difference = fields.Monetary(string='Difference', readonly=True)
+ cash_real_transaction = fields.Monetary(string='Transaction', readonly=True)
+ cash_real_expected = fields.Monetary(string="Expected", readonly=True)
order_ids = fields.One2many('pos.order', 'session_id', string='Orders')
order_count = fields.Integer(compute='_compute_order_count')
@@ -289,6 +292,9 @@ class PosSession(models.Model):
def _validate_session(self):
self.ensure_one()
+ self.cash_real_transaction = self.cash_register_total_entry_encoding
+ self.cash_real_expected = self.cash_register_balance_end
+ self.cash_real_difference = self.cash_register_difference
self._check_if_no_draft_orders()
if self.update_stock_at_closing:
self._create_picking_at_end_of_session()
diff --git a/addons/point_of_sale/views/pos_session_view.xml b/addons/point_of_sale/views/pos_session_view.xml
index c673449663a..a0f90d1439e 100644
--- a/addons/point_of_sale/views/pos_session_view.xml
+++ b/addons/point_of_sale/views/pos_session_view.xml
@@ -77,12 +77,18 @@
<group style="margin:0;padding:0;">
<field style="text-align:right;margin:0;padding:0;" name="cash_register_balance_start" readonly="1" widget="monetary" options="{'currency_field': 'currency_id'}" string="Starting Cash"/>
</group>
- <group style="margin:0;padding:0;" attrs="{'invisible' : [('state', 'in', ['new_session', 'opening_control'])]}">
+ <group style="margin:0;padding:0;" attrs="{'invisible' : [('state', 'in', ['new_session', 'opening_control', 'closed'])]}">
<field style="text-align:right;margin:0;padding:0;" name="cash_register_total_entry_encoding" widget="monetary" options="{'currency_field': 'currency_id'}" string="+ Transactions"/>
</group>
- <group style="margin:0;padding:0;" attrs="{'invisible' : [('state', 'in', ['new_session', 'opening_control'])]}">
+ <group style="margin:0;padding:0;" attrs="{'invisible' : [('state', '!=', 'closed')]}">
+ <field style="text-align:right;margin:0;padding:0;" name="cash_real_transaction" widget="monetary" options="{'currency_field': 'currency_id'}" string="+ Transactions"/>
+ </group>
+ <group style="margin:0;padding:0;" attrs="{'invisible' : [('state', 'in', ['new_session', 'opening_control', 'closed'])]}">
<field style="text-align:right;margin:0;padding:0;" name="cash_register_balance_end" widget="monetary" options="{'currency_field': 'currency_id'}" string="= Expected in Cash"/>
</group>
+ <group style="margin:0;padding:0;" attrs="{'invisible' : [('state', '!=', 'closed')]}">
+ <field style="text-align:right;margin:0;padding:0;" name="cash_real_expected" widget="monetary" options="{'currency_field': 'currency_id'}" string="= Expected"/>
+ </group>
<group style="margin:0;padding:0;" attrs="{'invisible' : [('state', 'in', ['new_session', 'opening_control'])]}">
<field style="text-align:right;margin:0;padding:0;" name="cash_register_balance_end_real" widget="monetary" options="{'currency_field': 'currency_id'}" string="Actual in Cash"/>
</group>
@@ -97,17 +103,22 @@
<group style="margin:0;padding:0;" attrs="{'invisible' : [('state', 'in', ['new_session', 'opening_control'])]}">
</group>
<group style="margin:0;padding:0;" attrs="{'invisible' : [('state', 'in', ['new_session', 'opening_control'])]}">
- <button class="oe_inline oe_link" name="open_cashbox_pos" type="object" attrs="{'invisible': [('state', 'in', ['new_session', 'opening_control', 'closed'])]}" context="{'balance': 'close'}">Set Closing Cash</button>
+ <button class="oe_inline oe_link" name="open_cashbox_pos" type="object" attrs="{'invisible': [('state', '!=', 'closing_control')]}" context="{'balance': 'close'}">Set Closing Cash</button>
</group>
</div>
</group>
</group>
- <div class="col-md-4" attrs="{'invisible' : [('state', 'in', ['new_session', 'opening_control', 'opened'])]}" style="height: 30px">
+ <div class="col-md-4" attrs="{'invisible' : [('state', '!=', 'closing_control')]}" style="height: 30px">
<group class="oe_subtotal_footer">
<field name="cash_register_difference" widget="monetary" options="{'currency_field': 'currency_id'}" decoration-danger="cash_register_difference != 0"/>
</group>
</div>
+ <div class="col-md-4" attrs="{'invisible' : [('state', '!=', 'closed')]}" style="height: 30px">
+ <group class="oe_subtotal_footer">
+ <field name="cash_real_difference" widget="monetary" options="{'currency_field': 'currency_id'}" decoration-danger="cash_real_difference != 0"/>
+ </group>
+ </div>
</page>
</notebook>
</sheet>