('number_uniq', 'unique(number, company_id, journal_id, type)', 'Invoice Number must be unique per Company!'),
]
+ def _find_partner(self, inv):
+ '''
+ Find the partner for which the accounting entries will be created
+ '''
+ #if the chosen partner is not a company and has a parent company, use the parent for the journal entries
+ #because you want to invoice 'Agrolait, accounting department' but the journal items are for 'Agrolait'
+ part = inv.partner_id
+ if part.parent_id and not part.is_company:
+ part = part.parent_id
+ return part
+
+
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
journal_obj = self.pool.get('account.journal')
if context is None:
date = inv.date_invoice or time.strftime('%Y-%m-%d')
- #if the chosen partner is not a company and has a parent company, use the parent for the journal entries
- #because you want to invoice 'Agrolait, accounting department' but the journal items are for 'Agrolait'
- part = inv.partner_id
- if part.parent_id and not part.is_company:
- part = part.parent_id
+ part = self._find_partner(inv)
line = map(lambda x:(0,0,self.line_get_convert(cr, uid, x, part.id, date, context=ctx)),iml)
<field name="invoice" invisible="1"/>
<field name="amount_currency" readonly="True" invisible="not context.get('currency',False)"/>
<field name="currency_id" readonly="True" invisible="not context.get('currency',False)" />
- <field name="state" />
+ <field name="state" invisible="1"/>
<field name="company_id" invisible="1"/>
</tree>
</field>
</field>
</record>
<menuitem
- name="Journal Items to Reconcile"
- action="action_account_manual_reconcile"
- id="menu_manual_reconcile_bank"
- sequence="20"
- parent="account.menu_finance_bank_and_cash"/>
- <menuitem
name="Manual Reconciliation"
action="action_account_manual_reconcile"
id="menu_manual_reconcile"
context="{'search_default_journal_id': active_id, 'default_journal_id': active_id}"
res_model="account.move.line"
src_model="account.move"/>
+
<act_window
domain="[('reconcile_id', '=', active_id)]"
id="act_account_acount_move_line_reconcile_open"
'target': 'new',
'domain': '[]',
'context': {
- 'default_partner_id': inv.partner_id.id,
+ 'default_partner_id': self._find_partner(inv),
'default_amount': inv.type in ('out_refund', 'in_refund') and -inv.residual or inv.residual,
'default_number':inv.name,
'close_after_process': True,
def _get_one_full_name(self, elmt, level=6):
if level<=0:
return '...'
- if elmt.parent_id:
+ if elmt.parent_id and not elmt.type == 'template':
parent_path = self._get_one_full_name(elmt.parent_id, level-1) + "/"
else:
parent_path = ''