New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IMP] account : Allow Zero value payment in write-off balance #16429
[IMP] account : Allow Zero value payment in write-off balance #16429
Conversation
b02b22b
to
248f1f1
Compare
620ff1b
to
8cd5572
Compare
54d0a7b
to
39d420e
Compare
894a2cb
to
f05e166
Compare
4f42140
to
d12bf75
Compare
d12bf75
to
0a822d1
Compare
097ce58
to
8285843
Compare
if not self.amount > 0.0: | ||
raise ValidationError(_('The payment amount must be strictly positive.')) | ||
if self.amount < 0: | ||
raise ValidationError(_('The payment amount must be strictly non-negetive.')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix typo non-negative
8285843
to
05e7343
Compare
('type', 'in', journal_type), | ||
self.payment_type == 'inbound' and ('at_least_one_inbound', '=', True) or ('at_least_one_outbound', '=', True) | ||
]} | ||
return res |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not remove 5 lines above and edit the domain directly in the xml like:
<field name="journal_id" widget="selection" domain="[('type', 'in', ['bank', 'cash', 'general'])......]" attrs="{'invisible': [('amount', '=', 0)]}"/>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smetl setting domain in xml would not be effective, because on onchange of payment_type, domain for journal is set to bank and cash see here: https://github.com/odoo/odoo/blob/master/addons/account/models/account_payment.py#L346
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to be tested because the usabilty might be a little odd (with that field that switch place)
self.journal_id = self.env['account.journal'].search([('type', '=', 'bank')], limit=1) | ||
res['domain'] = {'journal_id': [ | ||
('type', 'in', journal_type), | ||
self.payment_type == 'inbound' and ('at_least_one_inbound', '=', True) or ('at_least_one_outbound', '=', True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this line has any meaning for general journals... How can this work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is done to keep previous domians as it is on onchange of amount, please see here https://github.com/odoo/odoo/blob/master/addons/account/models/account_payment.py#L345
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that doesn't answer my question or my worry about this being meaningful for general journals...
if self.amount == 0: | ||
journal_type.append('general') | ||
self.payment_difference_handling = 'reconcile' | ||
self.journal_id = self.env['account.journal'].search([('type', '=', 'bank')], limit=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line can be removed AMHA
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to specification it is defined to select the first bank journal by default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let me rephrase it: I think specifications were wrong...
amount_currency = 0 | ||
liquidity_aml_dict = self._get_shared_move_line_vals(credit, debit, -amount_currency, move.id, False) | ||
liquidity_aml_dict.update(self._get_liquidity_move_line_vals(-amount)) | ||
aml_obj.create(liquidity_aml_dict) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be decided
if not self.amount > 0.0: | ||
raise ValidationError(_('The payment amount must be strictly positive.')) | ||
if self.amount < 0: | ||
raise ValidationError(_('The payment amount must be strictly non-negative.')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- raise ValidationError(_('The payment amount must be strictly positive.'))
+ raise ValidationError(_('The payment amount must be positive.'))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO i think doing 'positive' would confuse user as we are now allowing zero digit and also 'non-negative' would be more precise then it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then say "it cannot be negative" if you prefer
- When payment amount is zero - change label Journal Payment --> Journal - also show journal of type 'Miscellaneous' - select the first bank journal by default
…ash, general when amount is zero -> Note: In account_check_printing , onchange of amount ain't returning anything so domain will not set without returning something
9190b11
to
176b44d
Compare
Task:https://www.odoo.com/web?#id=29959&view_type=form&model=project.task&action=333&active_id=131&menu_id=4720
Pad:https://pad.odoo.com/p/r.5c727ad138ba4f04b3051b170f319872
Description of the issue/feature this PR addresses:
Current behavior before PR:
Desired behavior after PR is merged:
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr