add cash order - deposit creation from dashboard

16-gn-cash-refactor
Florian Roger 2 months ago
parent 08c514519b
commit 5e4fddae80

@ -20,14 +20,17 @@ It is based on modules:
## Whats Needs to Be Done:
- [x] add validate cashbox and entry lines creation
- [x] loss/profit validation
- [x] use predefined cash units
- [x] sequencing on statement gen
- [x] add button on payment to access statement if is_matched
- [x] add orphan statement lines in the next gen statement
- [x] add partner in deposit and move
- [x] use suspense account
- [x] add validate cashbox and entry lines creation | 16.0.0.0.1
- [x] loss/profit validation | 16.0.0.0.2
- [x] use predefined cash units | 16.0.0.0.3
- [x] sequencing on statement gen | 16.0.0.0.4
- [x] add button on payment to access statement if is_matched |16.0.0.0.5
- [x] add orphan statement lines in the next gen statement | 16.0.0.0.6
- [x] add partner in deposit and move | 16.0.0.0.7
- [x] use suspense account | 16.0.0.0.7
- [x] add button in dashboard to create a deposit / order | 16.0.0.0.8
- [x] add some defaults (date, default_lines) at deposit creation | 16.0.0.0.8
- [] add default cash units for cash order
- [] choose beetween bank and cash journal for a deposit
- [] add a button to put directly the cash order from bank to cash
- [] add cash deposits / cash outs to statement

@ -1,6 +1,6 @@
{
'name': "Gn Cash",
'version': '16.0.0.0.7',
'version': '16.0.0.0.8',
'author': 'Garage Numérique',
'category': 'Accounting',
'description': """

@ -13,6 +13,15 @@ class AccountCashDeposit(models.Model):
ondelete='restrict',
)
operation_type = fields.Selection(
[
("deposit", "Cash Deposit"),
("order", "Cash Order"),
],
required=True,
readonly=False,
)
@api.onchange('partner_id')
def _compute_partner_id(self):
for deposit in self:

@ -8,6 +8,37 @@ _logger = logging.getLogger(__name__)
class AccountJournal(models.Model):
_inherit = "account.journal"
def cash_in_or_out(self):
for journal in self:
journal.ensure_one()
# Create deposit
deposit = self.env['account.cash.deposit'].create({
'operation_type': 'order',
'date': fields.Date.today(),
'cash_journal_id': journal.id,
'bank_journal_id': journal.id,
'currency_id': self.env.company.currency_id.id
})
# Add default lines
cash_units = self.env["cash.unit"].search(
[
("auto_create", "in", ("both", 'deposit')),
("currency_id", "=", deposit.currency_id.id),
]
)
deposit.line_ids = [(0, 0, {
"cash_unit_id": cunit.id,
"qty": 0,
"currency_id": deposit.currency_id.id}) for cunit in cash_units ]
# Call form view
action = self.env['ir.actions.act_window']._for_xml_id('gn_cash.account_cash_inorout_action')
action['res_id'] = deposit.id
return action
def generate_statement_line_from_payment(self, payment_id):
payment = self.env['account.payment'].browse(payment_id)
stmt_line_values = {

@ -11,8 +11,15 @@
<field name="inherit_id" ref="account_cash_deposit.account_cash_deposit_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='order_date']" position="before">
<field name="operation_type" widget="radio" options="{'horizontal': True}" on_change="1" modifiers="{'readonly': [('state', '!=', 'draft')], 'required': True"/>
<field name="partner_id"/>
</xpath>
</field>
</record>
<record id="gn_cash.account_cash_inorout_action" model="ir.actions.act_window">
<field name="name">Cash Deposit</field>
<field name="res_model">account.cash.deposit</field>
<field name="view_mode">form</field>
<field name="view_id" ref="gn_cash.account_cash_deposit_form"/>
</record>
</odoo>

@ -10,6 +10,7 @@
<xpath expr='//div[@name="bank_customer_payment"]' position='before'>
<div t-if="journal_type == 'cash'" name="new_statement">
<a role="menuitem" context="{'journal_type': 'cash'}" type="object" name="create_cash_statement">Nouveau Relevé</a>
<a role="menuitem" context="{'journal_type': 'cash'}" type="object" name="cash_in_or_out">Cash In/Out</a>
</div>
</xpath>
<xpath expr='//button[@name="create_cash_statement"]' position='replace'>

Loading…
Cancel
Save