Dear Mahmoud,
thanks for your response.
I'm very new to Odoo programming, so would like to confirm my understanding:
1. Requirement: Accounting | Journal Entries | Create
- I don't want to use the "Add in Item" link.
- but I will move the values of item entries from current fields at the header level, plus the new fields I'm adding below.
- The Save button still available, to save the whole journal entry.
2. Added 4 fields = DONE
class myJournalEntry(models.Model):
_inherit = 'account.move'
# ADD 4 new fields
x_myDescription = fields.Char('Description', required=True, default='Description here ...')
x_myDebitCredit = fields.Char('Debit/Kredit', required=True, default='D')
x_myPartner = fields.Many2one('res.partner', 'Customer')
x_myAccount = fields.Many2one('account.account', 'Account')
3. My view: 4 new fields + 1 button to move the values from header level to item level (while standard Save button is still available)
<?xml version="1.0"?>
<openerp>
<data>
<record id="view_form_account_move_inherited" model="ir.ui.view">
<field name="name">Account Move form – User extension</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<group> <group name="group_l1">
<field name="x_myDescription" />
<field name="x_myDebitCredit" />
<field name="x_myPartner" />
<field name="x_myAccount" />
</group>
<group name="group_l2">
<!-- INSERT button = a method to insert the entry as items -->
<button name="do_insert_item" type="object" string="Insert Item" class="oe_highlight" />
</group>
</group>
</field>
</record>
</data>
</openerp>
4. How to make the "Insert" button move the values from header + new fields to the journal item section?
Note: it's NOT saving action using the Save button.
The "Insert" button is only moving the values.
After all is filled up, I still want to use the "Save" button to create the Journal Entry.
Appreciate your very help. :)