[FIX] account: various usability stuff

This commit is contained in:
Cedric Snauwaert
2015-08-19 10:45:38 +02:00
parent 1ce29f046c
commit 3493789b37
11 changed files with 213 additions and 63 deletions
+1 -1
View File
@@ -107,7 +107,7 @@ class AccountAccount(models.Model):
last_time_entries_checked = fields.Datetime(string='Latest Invoices & Payments Matching Date', readonly=True, copy=False,
help='Last time the invoices & payments matching was performed on this account. It is set either if there\'s not at least '\
'an unreconciled debit and an unreconciled credit Or if you click the "Done" button.')
reconcile = fields.Boolean(string='Reconciliation of Entries', default=False,
reconcile = fields.Boolean(string='Allow Reconciliation', default=False,
help="Check this box if this account allows invoices & payments matching of journal items.")
tax_ids = fields.Many2many('account.tax', 'account_account_tax_default_rel',
'account_id', 'tax_id', string='Default Taxes')
+4 -1
View File
@@ -713,6 +713,9 @@ class WizardMultiChartsAccounts(models.TransientModel):
'cash_account_code_prefix': self.cash_account_code_prefix,
'chart_template_id': self.chart_template_id.id})
#set the coa currency to active
self.currency_id.write({'active': True})
# When we install the CoA of first company, set the currency to price types and pricelists
if company.id == 1:
for reference in ['product.list_price', 'product.standard_price', 'product.list0', 'purchase.list0']:
@@ -738,7 +741,7 @@ class WizardMultiChartsAccounts(models.TransientModel):
# Create the current year earning account (outside of the CoA)
self.env['account.account'].create({
'code': '0',
'code': '9999',
'name': _('Undistributed Profits/Losses'),
'user_type_id': self.env.ref("account.data_unaffected_earnings").id,
'company_id': company.id,})
@@ -133,8 +133,8 @@
<field name="user_id"/>
<field name="date_due"/>
<field name="origin"/>
<field name="amount_total_signed" sum="Total Amount"/>
<field name="residual_signed" sum="Residual Amount"/>
<field name="amount_total"/>
<field name="residual"/>
<field name="currency_id" invisible="1"/>
<field name="company_currency_id" invisible="1"/>
<field name="state"/>
@@ -194,8 +194,8 @@
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/>
<field name="date_due"/>
<field name="origin"/>
<field name="amount_total_signed" sum="Total Amount"/>
<field name="residual_signed" sum="Residual Amount" string="To Pay"/>
<field name="amount_total"/>
<field name="residual" string="To Pay"/>
<field name="currency_id" invisible="1"/>
<field name="company_currency_id" invisible="1"/>
<field name="state"/>
@@ -245,7 +245,7 @@
<field name="date_invoice" string="Bill Date"/>
<field name="date_due"/>
<field name="move_name" invisible="1"/>
<field name="currency_id" options="{'no_create': True}" groups="base.group_multi_currency"/>
<field name="currency_id" options="{'no_create': True, 'no_open': True}" groups="base.group_multi_currency"/>
<field name="company_currency_id" invisible="1"/>
</group>
</group>
@@ -383,7 +383,7 @@
<field name="user_id" groups="base.group_user" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'account.group_account_invoice']}"/>
<label for="currency_id" groups="base.group_multi_currency"/>
<div groups="base.group_multi_currency">
<field name="currency_id" options="{'no_create': True}" class="oe_inline"/>
<field name="currency_id" options="{'no_create': True, 'no_open': True}" class="oe_inline"/>
<field name="company_currency_id" invisible="1"/>
</div>
</group>
@@ -107,7 +107,7 @@
<label for="amount"/>
<div name="amount_div" class="o_row">
<field name="amount" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
<field name="currency_id" options="{'no_create': True}" groups="base.group_multi_currency" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
<field name="currency_id" options="{'no_create': True, 'no_open': True}" groups="base.group_multi_currency" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
</div>
</group>
<group>
@@ -191,7 +191,7 @@
<label for="amount"/>
<div name="amount_div">
<field name="amount" class="oe_inline"/>
<field name="currency_id" options="{'no_create': True}" groups="base.group_multi_currency" class="oe_inline" invisible="1"/>
<field name="currency_id" options="{'no_create': True, 'no_open': True}" groups="base.group_multi_currency" class="oe_inline" invisible="1"/>
</div>
</group>
<group>
+5 -7
View File
@@ -15,14 +15,12 @@
<group>
<div class="oe_title oe_inline" colspan="2">
<h1>
<field name="code" placeholder="code"/> -
<field name="name" placeholder="name"/>
</h1>
</div>
<separator string="Reporting" colspan="2"/>
<field name="code" placeholder="code"/>
<field name="user_type_id" widget="selection"/>
<field name="tag_ids" widget="many2many_tags" domain="[('applicability', '!=', 'taxes')]" context="{'default_applicability': 'accounts'}"/>
<separator string="Miscellaneous Options" colspan="2"/>
<field name="deprecated"/>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
<field name="currency_id" options="{'no_create': True}" groups="base.group_multi_currency"/>
@@ -266,7 +264,7 @@
</page>
<page name="advanced_settings" string="Advanced Settings">
<group>
<group string="Security">
<group string="Control-Access" groups="base.group_no_one">
<div class="text-muted" colspan="2">Keep empty for no control</div>
<field name="type_control_ids" widget="many2many_tags"/>
<field name="account_control_ids" widget="many2many_tags"/>
@@ -1204,14 +1202,14 @@
</h1>
<group>
<group>
<field name="journal_id"/>
<field name="journal_id" options="{'no_open': True, 'no_create': True}"/>
<field name="company_id" required="1" groups="base.group_multi_company"/>
<field name="partner_id"
domain="['|', ('parent_id', '=', False), ('is_company', '=', True)]"/>
</group>
<group>
<field name="ref"/>
<field name="date"/>
<field name="ref"/>
<field name="amount" invisible="1"/>
<field name="currency_id" invisible="1"/>
</group>
@@ -1221,8 +1219,8 @@
<field name="line_ids" widget="one2many_list"
context="{'line_ids': line_ids, 'journal_id': journal_id }">
<tree editable="top" string="Journal Items">
<field name="name"/>
<field name="account_id" domain="[('company_id', '=', parent.company_id)]"/>
<field name="name"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
<field name="amount_currency" groups="base.group_multi_currency"/>
<field name="company_currency_id" invisible="1"/>
@@ -7,7 +7,7 @@
<field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="arch" type="xml">
<field name="group_invoice_lines" position="after">
<field name="update_posted"/>
<field name="update_posted" groups="base.group_no_one"/>
</field>
</field>
</record>
+17 -31
View File
@@ -55,6 +55,11 @@ class AccountVoucher(models.Model):
voucher.amount = total + voucher.tax_correction
voucher.tax_amount = tax_amount
@api.one
@api.depends('account_pay_now_id', 'account_pay_later_id', 'pay_now')
def _get_account(self):
self.account_id = self.account_pay_now_id if self.pay_now == 'pay_now' else self.account_pay_later_id
_name = 'account.voucher'
_description = 'Accounting Voucher'
_inherit = ['mail.thread']
@@ -65,7 +70,7 @@ class AccountVoucher(models.Model):
date = fields.Date(readonly=True, select=True, states={'draft': [('readonly', False)]},
help="Effective date for accounting entries", copy=False, default=fields.Date.context_today)
journal_id = fields.Many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft': [('readonly', False)]}, default=_default_journal)
account_id = fields.Many2one('account.account', 'Account', required=True, readonly=True, states={'draft': [('readonly', False)]}, domain=[('deprecated', '=', False)])
account_id = fields.Many2one('account.account', 'Account', required=True, readonly=True, states={'draft': [('readonly', False)]}, domain="[('deprecated', '=', False), ('internal_type','=', (pay_now == 'pay_now' and 'liquidity' or 'receivable'))]")
line_ids = fields.One2many('account.voucher.line', 'voucher_id', 'Voucher Lines',
readonly=True, copy=True,
states={'draft': [('readonly', False)]})
@@ -97,19 +102,19 @@ class AccountVoucher(models.Model):
], 'Payment', select=True, readonly=True, states={'draft': [('readonly', False)]}, default='pay_later')
date_due = fields.Date('Due Date', readonly=True, select=True, states={'draft': [('readonly', False)]})
@api.onchange('partner_id')
@api.onchange('partner_id', 'pay_now')
def onchange_partner_id(self):
if self.journal_id.type == 'sale':
account_id = self.partner_id.property_account_receivable_id.id
elif self.journal_id.type == 'purchase':
account_id = self.partner_id.property_account_payable_id.id
elif self.voucher_type == 'sale':
account_id = sef.journal_id.default_debit_account_id.id
elif self.voucher_type == 'purchase':
account_id = self.journal_id.default_credit_account_id.id
if self.pay_now =='pay_now':
liq_journal = self.env['account.journal'].search([('type', 'in', ('bank', 'cash'))], limit=1)
self.account_id = liq_journal.default_debit_account_id \
if self.voucher_type == 'sale' else liq_journal.default_credit_account_id
else:
account_id = self.journal_id.default_credit_account_id.id or self.journal_id.default_debit_account_id.id
self.account_id = account_id
if self.partner_id:
self.account_id = self.partner_id.property_account_receivable_id \
if self.voucher_type == 'sale' else self.partner_id.property_account_payable_id
else:
self.account_id = self.journal_id.default_debit_account_id \
if self.voucher_type == 'sale' else self.journal_id.default_credit_account_id
@api.multi
def button_proforma_voucher(self):
@@ -139,24 +144,6 @@ class AccountVoucher(models.Model):
raise Warning(_('Cannot delete voucher(s) which are already opened or paid.'))
return super(AccountVoucher, self).unlink()
@api.onchange('pay_now')
def onchange_payment(self):
account_id = False
if self.pay_now == 'pay_later':
partner = self.partner_id
journal = self.journal_id
if journal.type == 'sale':
account_id = partner.property_account_receivable_id.id
elif journal.type == 'purchase':
account_id = partner.property_account_payable_id.id
elif self.voucher_type == 'sale':
account_id = journal.default_debit_account_id.id
elif self.voucher_type == 'purchase':
account_id = journal.default_credit_account_id.id
else:
account_id = journal.default_credit_account_id.id or journal.default_debit_account_id.id
self.account_id = account_id
@api.multi
def first_move_line_get(self, move_id, company_currency, current_currency):
debit = credit = 0.0
@@ -337,7 +324,6 @@ class account_voucher_line(models.Model):
store=True, readonly=True, compute='_compute_subtotal')
quantity = fields.Float(digits=dp.get_precision('Product Unit of Measure'),
required=True, default=1)
account_id = fields.Many2one('account.account', 'Account', required=True, domain=[('deprecated', '=', False)])
account_analytic_id = fields.Many2one('account.analytic.account', 'Analytic Account')
company_id = fields.Many2one('res.company', related='voucher_id.company_id', string='Company', store=True, readonly=True)
tax_ids = fields.Many2many('account.tax', string='Tax', help="Only for tax excluded from price")
@@ -8,7 +8,6 @@
<tree decoration-info="state == 'draft'" decoration-muted="state == 'cancel'" string="Voucher Entries">
<field name="date"/>
<field name="number"/>
<field name="reference"/>
<field name="partner_id" string="Customer"/>
<field name="voucher_type" invisible="context.get('visible', True)"/>
<field name="amount" sum="Total Amount"/>
@@ -67,15 +67,12 @@
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
<field name="partner_id" domain="[('customer','=',True)]" string="Customer" context="{'search_default_customer':1, 'show_address': 1}" options='{"always_reload": True}'/>
<field name="pay_now" required="1"/>
<field name="account_id" attrs="{'invisible': [('pay_now', '=', 'pay_now')]}"
domain="[('internal_type','=', 'receivable')]"/>
<field name="account_id" attrs="{'invisible': [('pay_now', '=', 'pay_later')]}"
domain="[('internal_type','=', 'liquidity')]"/>
<field name="date_due" attrs="{'invisible':[('pay_now','=','pay_now')]}"/>
<field name="account_id"/>
</group>
<group>
<field name="journal_id" domain="[('type','=','sale')]" widget="selection" groups="account.group_account_user"/>
<field name="date"/>
<field name="date_due" attrs="{'invisible':[('pay_now','=','pay_now')]}"/>
<field name="name" attrs="{'invisible': [('pay_now', '=', 'pay_later')]}"/>
<field name="paid" invisible="1"/>
</group>
@@ -180,10 +177,7 @@
<group>
<field name="partner_id" domain="[('supplier','=',True)]" string="Vendor" context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}" />
<field name="pay_now" required="1"/>
<field name="account_id" attrs="{'invisible': [('pay_now', '=', 'pay_now')]}"
domain="[('internal_type','=', 'payable')]"/>
<field name="account_id" attrs="{'invisible': [('pay_now', '=', 'pay_later')]}"
domain="[('internal_type','=', 'liquidity')]"/>
<field name="account_id"/>
<field name="name" colspan="2" attrs="{'invisible': [('pay_now', '=', 'pay_later')]}"/>
<field name="reference"/>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
File diff suppressed because it is too large Load Diff
@@ -39,6 +39,7 @@
<search string="Currencies">
<field name="name" string="Currency"/>
<field name="active"/>
<filter name="inactive" string="Inactive" domain="[('active','=',False)]" help="Show inactive currencies"/>
</search>
</field>
</record>
@@ -49,13 +50,10 @@
<field name="arch" type="xml">
<tree string="Currencies">
<field name="name"/>
<field name="symbol"/>
<field name="rate_ids" invisible="1"/>
<field name="date"/>
<field name="rate"/>
<field name="rounding"/>
<field name="decimal_places"/>
<field name="position"/>
<field name="active"/>
</tree>
</field>
</record>