Skip to content
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

Merged
merged 5 commits into from Aug 29, 2017

Conversation

abh-odoo
Copy link
Contributor

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

@C3POdoo C3POdoo added the RD research & development, internal work label Apr 14, 2017
@abh-odoo abh-odoo force-pushed the master-account-allow-zero-payment-abh branch from b02b22b to 248f1f1 Compare April 25, 2017 10:31
@abh-odoo abh-odoo force-pushed the master-account-allow-zero-payment-abh branch 3 times, most recently from 620ff1b to 8cd5572 Compare May 23, 2017 08:42
@abh-odoo abh-odoo force-pushed the master-account-allow-zero-payment-abh branch 4 times, most recently from 54d0a7b to 39d420e Compare June 5, 2017 05:20
@abh-odoo abh-odoo force-pushed the master-account-allow-zero-payment-abh branch 3 times, most recently from 894a2cb to f05e166 Compare June 14, 2017 05:32
@rgo-odoo rgo-odoo force-pushed the master-account-allow-zero-payment-abh branch 2 times, most recently from 4f42140 to d12bf75 Compare June 15, 2017 10:26
@rgo-odoo rgo-odoo force-pushed the master-account-allow-zero-payment-abh branch from d12bf75 to 0a822d1 Compare July 12, 2017 07:03
@abh-odoo abh-odoo force-pushed the master-account-allow-zero-payment-abh branch 5 times, most recently from 097ce58 to 8285843 Compare July 18, 2017 10:32
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.'))
Copy link
Contributor

@hbto hbto Jul 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix typo non-negative

@abh-odoo abh-odoo force-pushed the master-account-allow-zero-payment-abh branch from 8285843 to 05e7343 Compare July 19, 2017 05:19
('type', 'in', journal_type),
self.payment_type == 'inbound' and ('at_least_one_inbound', '=', True) or ('at_least_one_outbound', '=', True)
]}
return res
Copy link
Contributor

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)]}"/>

Copy link
Contributor Author

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

Copy link
Contributor

@qdp-odoo qdp-odoo left a 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)
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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)
Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor

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)
Copy link
Contributor

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.'))
Copy link
Contributor

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.'))

Copy link
Contributor Author

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

Copy link
Contributor

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

abh-odoo and others added 5 commits August 29, 2017 11:03
- 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
@smetl smetl force-pushed the master-account-allow-zero-payment-abh branch from 9190b11 to 176b44d Compare August 29, 2017 09:05
@smetl smetl merged commit 3267e76 into odoo:master Aug 29, 2017
@smetl smetl deleted the master-account-allow-zero-payment-abh branch November 6, 2018 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants