[18.0][MIG] pos_transfer_account: Migration to 18.0 - #8
Conversation
5cf6ad2 to
22a9c03
Compare
There was a problem hiding this comment.
the file name should be CONFIG.md or CONFIGURE.md. Please double check.
|
|
||
| If this account is set, it will be used when user realizes "Put Money In" or | ||
| "Take Money Out" operation, instead of the default one set in 'Invoicing' / | ||
| 'Configuration' / 'Setting' Section. ("Inter-Banks Transfer Account" field) No newline at end of file |
There was a problem hiding this comment.
@P-H-Phuc You missed this comment. Note that, there is no "Inter-Banks Transfer Account" in 'Invoicing' / 'Configuration' / 'Setting'
| return super( | ||
| PosSession, | ||
| self.with_context(active_model="pos.session", active_ids=self.ids), | ||
| ).try_cash_in_out(_type, amount, reason, extras) |
There was a problem hiding this comment.
I don't know how you test this module. You even did not import the file account_bank_statement_line.py to your models/__init__.py.
Anw, please remove account_bank_statement_line.py. Then, add this code block:
from odoo import models
class PosSession(models.Model):
_inherit = "pos.session"
def try_cash_in_out(self, _type, amount, reason, extras):
if self.config_id.suspense_account_id:
extras = extras or {}
extras["counterpart_account_id"] = self.config_id.suspense_account_id.id
return super().try_cash_in_out(_type, amount, reason, extras)
def _prepare_account_bank_statement_line_vals(self, session, sign, amount, reason, extras):
res = super()._prepare_account_bank_statement_line_vals(session, sign, amount, reason, extras)
if extras.get("counterpart_account_id"):
res["counterpart_account_id"] = extras["counterpart_account_id"]
return res
| class PosConfig(models.Model): | ||
| _inherit = "pos.config" | ||
|
|
||
| transfer_account_id = fields.Many2one(comodel_name="account.account") |
There was a problem hiding this comment.
| transfer_account_id = fields.Many2one(comodel_name="account.account") | |
| suspense_account_id = fields.Many2one(comodel_name="account.account") |
There was a problem hiding this comment.
to make it synchronize with the one created by Odoo SA.
| class ResConfigSettings(models.TransientModel): | ||
| _inherit = "res.config.settings" | ||
|
|
||
| pos_transfer_account_id = fields.Many2one( |
There was a problem hiding this comment.
| pos_transfer_account_id = fields.Many2one( | |
| pos_suspense_account_id = fields.Many2one( |
22a9c03 to
511589f
Compare
nguyenminhchien
left a comment
There was a problem hiding this comment.
2025-11-21 09:14:13,832 207521 INFO v18c_pos_transfer_account odoo.modules.loading: Loading module pos_transfer_account (56/56)
2025-11-21 09:14:13,993 207521 INFO v18c_pos_transfer_account odoo.modules.registry: module pos_transfer_account: creating or updating database tables
2025-11-21 09:14:14,113 207521 INFO v18c_pos_transfer_account odoo.modules.loading: loading pos_transfer_account/views/view_pos_config.xml
2025-11-21 09:14:14,129 207521 INFO v18c_pos_transfer_account odoo.modules.loading: loading pos_transfer_account/views/res_config_settings_view.xml
2025-11-21 09:14:14,162 207521 INFO v18c_pos_transfer_account odoo.modules.loading: Module pos_transfer_account: loading demo
2025-11-21 09:14:14,162 207521 INFO v18c_pos_transfer_account odoo.modules.loading: loading pos_transfer_account/demo/account_account.xml
2025-11-21 09:14:14,179 207521 INFO v18c_pos_transfer_account odoo.modules.loading: loading pos_transfer_account/demo/pos_config.xml
2025-11-21 09:14:14,182 207521 WARNING v18c_pos_transfer_account odoo.modules.loading: Module pos_transfer_account demo data failed to install, installed without demo data
Traceback (most recent call last):
File "/home/chien/code/odoo/odoo/18.0/odoo/tools/convert.py", line 544, in _tag_root
f(rec)
File "/home/chien/code/odoo/odoo/18.0/odoo/tools/convert.py", line 444, in _tag_record
record = model._load_records([data], self.mode == 'update')
File "/home/chien/code/odoo/odoo/18.0/odoo/models.py", line 5502, in _load_records
data['record']._load_records_write(data['values'])
File "/home/chien/code/odoo/odoo/18.0/odoo/models.py", line 5420, in _load_records_write
self.write(values)
File "/home/chien/code/odoo/odoo/18.0/addons/point_of_sale/models/pos_config.py", line 543, in write
result = super(PosConfig, self).write(vals)
File "/home/chien/code/odoo/odoo/18.0/odoo/models.py", line 4741, in write
raise ValueError("Invalid field %r on model %r" % (fname, self._name))
ValueError: Invalid field 'transfer_account_id' on model 'pos.config'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/chien/code/odoo/odoo/18.0/odoo/modules/loading.py", line 90, in load_demo
load_data(env(su=True), idref, mode, kind='demo', package=package)
File "/home/chien/code/odoo/odoo/18.0/odoo/modules/loading.py", line 72, in load_data
tools.convert_file(env, package.name, filename, idref, mode, noupdate, kind)
File "/home/chien/code/odoo/odoo/18.0/odoo/tools/convert.py", line 615, in convert_file
convert_xml_import(env, module, fp, idref, mode, noupdate)
File "/home/chien/code/odoo/odoo/18.0/odoo/tools/convert.py", line 686, in convert_xml_import
obj.parse(doc.getroot())
File "/home/chien/code/odoo/odoo/18.0/odoo/tools/convert.py", line 601, in parse
self._tag_root(de)
File "/home/chien/code/odoo/odoo/18.0/odoo/tools/convert.py", line 557, in _tag_root
raise ParseError('while parsing %s:%s, somewhere inside\n%s' % (
odoo.tools.convert.ParseError: while parsing /home/chien/code/oca/pos/18.0/pos_transfer_account/demo/pos_config.xml:3, somewhere inside
<record id="pos_config_specific_transfer_account" model="pos.config">
<field name="name">Point Of Sale with Specific Transfer Account</field>
<field name="transfer_account_id" ref="account_pos_transfer_account"/>
<field name="company_id" ref="base.main_company"/>
</record>
2025-11-21 09:14:14,203 207521 INFO v18c_pos_transfer_account odoo.modules.loading: Module pos_transfer_account loaded in 0.37s, 209 queries (+209 other)
511589f to
0cd2a51
Compare
nguyenminhchien
left a comment
There was a problem hiding this comment.
- Update
DESCRIPTION.mdfollowing a comment in my previous review
0cd2a51 to
2612349
Compare
|
Resolved! |
|
Reference to OCA: |
2612349 to
75c957f
Compare
|
@nguyenminhchien Could you please review this module? The update is based on the new request: https://tms.trobz.com/web#id=66226&action=543&model=tms.forge.ticket&view_type=form&cids=1&menu_id=424 |
| suspense_account = session.config_id.suspense_account_id | ||
| if not suspense_account: | ||
| suspense_account = session.company_id.transfer_account_id | ||
| res["counterpart_account_id"] = suspense_account.id |
75c957f to
a90c85d
Compare
a90c85d to
f1d9bf7
Compare
c82a758 to
7f38b1b
Compare
7f38b1b to
f09a908
Compare


pos_transfer_account/models/cash_box_in.pyandpos_transfer_account/models/cash_box_out.py: its model was removed from 14.0.