diff --git a/gn_cash/__manifest__.py b/gn_cash/__manifest__.py index fdc2701..5026bac 100644 --- a/gn_cash/__manifest__.py +++ b/gn_cash/__manifest__.py @@ -16,6 +16,7 @@ 'views/account_cash_statement_views.xml', 'views/account_journal_dashboard_view.xml', 'views/account_payment_views.xml', + 'views/account_cash_deposit_views.xml', ], 'translate': True, 'installable': True, diff --git a/gn_cash/models/__init__.py b/gn_cash/models/__init__.py index 7dbfd15..77c613e 100644 --- a/gn_cash/models/__init__.py +++ b/gn_cash/models/__init__.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- -from . import cash_statement, account_journal_dashboard, account_payment \ No newline at end of file +from . import cash_statement, account_journal_dashboard, account_payment, account_cash_deposit \ No newline at end of file diff --git a/gn_cash/models/account_cash_deposit.py b/gn_cash/models/account_cash_deposit.py index 89e459f..d9c5542 100644 --- a/gn_cash/models/account_cash_deposit.py +++ b/gn_cash/models/account_cash_deposit.py @@ -1,9 +1,27 @@ +from odoo import models, api, _, fields +import logging +_logger = logging.getLogger(__name__) + class AccountCashDeposit(models.Model): _inherit = 'account.cash.deposit' - def _prepare_account_move(self, vals): - move_vals = self.super()._prepare_account_move(vals) - if move_vals['line_ids'] and self.partner_id and self.partner_id.: + partner_id = fields.Many2one( + comodel_name='res.partner', + string='Partner', + compute='_compute_partner_id', store=True, readonly=False, precompute=True, + ondelete='restrict', + ) + + @api.onchange('partner_id') + def _compute_partner_id(self): + for deposit in self: + deposit.ensure_one() + if not deposit.partner_id: + deposit.write({'partner_id': self.env.user.id}) + - for line_values in move_vals['lines_ids']: - if + # def _prepare_account_move(self, vals): + # move_vals = self.super()._prepare_account_move(vals) + # if move_vals['line_ids'] and self.partner_id and self.partner_id.: + # for line_values in move_vals['lines_ids']: + # if diff --git a/gn_cash/views/account_cash_deposit_views.xml b/gn_cash/views/account_cash_deposit_views.xml new file mode 100644 index 0000000..b4b0517 --- /dev/null +++ b/gn_cash/views/account_cash_deposit_views.xml @@ -0,0 +1,18 @@ + + + + + AccountCashDepositFormView + account.cash.deposit + + + + + + + + \ No newline at end of file