-
-
Notifications
You must be signed in to change notification settings - Fork 414
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
[10.0][IMP] account_payment_return: Add return expenses functionality #156
[10.0][IMP] account_payment_return: Add return expenses functionality #156
Conversation
@@ -157,6 +158,28 @@ def action_confirm(self): | |||
(move_line | move_line2).reconcile() | |||
return_line.move_line_ids.mapped('matched_debit_ids').write( | |||
{'origin_returned_move_ids': [(6, 0, returned_moves.ids)]}) | |||
if return_line.expense_amount and return_line.expense_account: |
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.
Both expressions are the same.
@@ -231,6 +254,13 @@ class PaymentReturnLine(models.Model): | |||
string='Amount', | |||
help="Returned amount. Can be different from the move amount", | |||
digits=dp.get_precision('Account')) | |||
expense_account = fields.Many2one( |
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.
Put at journal level a default expense account and expense partner, and add an _onchange_expense_amount
to bring this data to the fields.
@@ -42,6 +43,12 @@ | |||
('reconciled', '=', True)]" | |||
/> | |||
<field name="amount"/> | |||
<field name="expense_account" | |||
attrs="{'required':[('expense_amount','!=', 0)]}" /> | |||
<field name="expense_amount" |
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.
Put it first and without attrs
.
Changes proposed done in last commit. |
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.
Little comments.
<record id="view_account_journal_form" model="ir.ui.view"> | ||
<field name="name">account.journal.form</field> | ||
<field name="model">account.journal</field> | ||
<field name="type">form</field> |
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.
Remove this deprecated key
@@ -281,6 +281,13 @@ def _get_partner_from_move(self): | |||
def _onchange_move_line(self): | |||
self._compute_amount() | |||
|
|||
@api.onchange('expense_amount') | |||
def _onchange_expense_amount(self): | |||
journal = self.return_id.journal_id |
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.
Put this inside if
b7a3d94
to
81ab48a
Compare
Changes done (commit squashed). |
@cubells please review |
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.
👍
LGTM
Code review and test.
Improvements:
cc @Tecnativa