[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>
This commit is contained in:
committed by
Pierre Masereel
parent
67848457d0
commit
daf6db970d
@@ -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()
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user