Point of Sale mailing list archives
pos@odoo-community.org
Browse archives
Re: [OCA/pos] [ADD] new module pos_cash_control_multiple_config to handle correctly cash control in a multi point of sale context (#569)
Re: [OCA/pos] [ADD] new module pos_cash_control_multiple_config to handle correctly cash control in a multi point of sale context (#569)
Re: [OCA/pos] [ADD] new module pos_cash_control_multiple_config to handle correctly cash control in a multi point of sale context (#569)
by Meet Dholakia <notifications@github.com> - 24/11/2020 16:28:58@MeetKD requested changes on this pull request.
Minor Improvements.
In pos_cash_control_multiple_config/__manifest__.py:
> @@ -0,0 +1,18 @@
+# Copyright (C) 2020 - Today: GRAP (http://www.grap.coop)
+# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+
+{
+ "name": "Point Of Sale - Correct Opening Balance",
+ "summary": "Handle correctly opening balance in a multi point of sale"
+ " context with Cash control enabled.",
+ "version": "12.0.1.0.1",
+ "category": "Point of Sale",
+ "author": "GRAP, Odoo Community Association (OCA)",
+ "website": "http://www.grap.coop",
You can change website to https://github.com/OCA/pos/
In pos_cash_control_multiple_config/models/account_bank_statement.py:
> @@ -0,0 +1,31 @@
+# Copyright (C) 2020 - Today: GRAP (http://www.grap.coop)
+# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+
+from odoo import api, models
+
+
+class AccountBankStatement(models.Model):
+ _inherit = "account.bank.statement"
+
+ @api.multi
+ def _get_opening_balance(self, journal_id):
+ PosSession = self.env["pos.session"]
+ pos_config_id = self.env.context.get("pos_config_id")
+ if self.env.context.get("pos_config_id"):
⬇️ Suggested change
- if self.env.context.get("pos_config_id"):
+ if pos_config_id:
In pos_cash_control_multiple_config/models/account_bank_statement.py:
> + if self.env.context.get("pos_config_id"):
+ sessions = PosSession.search(
+ [('config_id', '=', pos_config_id)],
+ order="start_at desc", limit=1)
+ if not sessions:
+ # it is the first time the pos config is opened.
+ # returning 0
+ return 0
+ else:
+ last_valid_statement = False
+ for old_statement in sessions.mapped('statement_ids'):
+ if old_statement.journal_id.id == journal_id:
+ last_valid_statement = old_statement
+ if last_valid_statement:
+ return last_valid_statement.balance_end
+
We can also remove this extra line.
—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
Reference
-
[OCA/pos] [ADD] new module pos_cash_control_multiple_config to handle correctly cash control in a multi point of sale context (#569)
by Sylvain LE GAL <notifications@github.com> - 23/11/2020 13:48:23 - 0-
Re: [OCA/pos] [ADD] new module pos_cash_control_multiple_config to handle correctly cash control in a multi point of sale context (#569)
by "OCA Bot" <notifications@github.com> - 14/05/2021 02:38:13 - 0 -
Re: [OCA/pos] [ADD] new module pos_cash_control_multiple_config to handle correctly cash control in a multi point of sale context (#569)
by "OCA Bot" <notifications@github.com> - 14/05/2021 02:38:11 - 0 -
Re: [OCA/pos] [ADD] new module pos_cash_control_multiple_config to handle correctly cash control in a multi point of sale context (#569)
by "OCA Bot" <notifications@github.com> - 14/05/2021 00:41:46 - 0 -
Re: [OCA/pos] [ADD] new module pos_cash_control_multiple_config to handle correctly cash control in a multi point of sale context (#569)
by "OCA Bot" <notifications@github.com> - 13/05/2021 22:59:31 - 0 -
Re: [OCA/pos] [ADD] new module pos_cash_control_multiple_config to handle correctly cash control in a multi point of sale context (#569)
by "OCA Bot" <notifications@github.com> - 13/05/2021 21:08:27 - 0 -
Re: [OCA/pos] [ADD] new module pos_cash_control_multiple_config to handle correctly cash control in a multi point of sale context (#569)
by "Sylvain LE GAL" <notifications@github.com> - 13/05/2021 21:08:19 - 0 -
Re: [OCA/pos] [ADD] new module pos_cash_control_multiple_config to handle correctly cash control in a multi point of sale context (#569)
by "Meet Dholakia" <notifications@github.com> - 13/05/2021 21:03:16 - 0 -
Re: [OCA/pos] [ADD] new module pos_cash_control_multiple_config to handle correctly cash control in a multi point of sale context (#569)
by "Sylvain LE GAL" <notifications@github.com> - 13/05/2021 20:36:41 - 0 -
Re: [OCA/pos] [ADD] new module pos_cash_control_multiple_config to handle correctly cash control in a multi point of sale context (#569)
by Sylvain LE GAL <notifications@github.com> - 10/12/2020 23:58:39 - 0 -
Re: [OCA/pos] [ADD] new module pos_cash_control_multiple_config to handle correctly cash control in a multi point of sale context (#569)
by Meet Dholakia <notifications@github.com> - 24/11/2020 16:28:58 - 0
-