New invoice view
bzr revid: fp@tinyerp.com-afcc8364ba67cdd03af767fcb1df291e88a45b54
This commit is contained in:
parent
114f013fad
commit
d8176652fc
|
@ -118,6 +118,87 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="invoice_supplier_form">
|
||||
<field name="name">account.invoice.supplier.form</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Supplier invoice">
|
||||
<notebook>
|
||||
<page string="Invoice">
|
||||
<field name="name" select="1"/>
|
||||
<field name="type" select="1"/>
|
||||
<field name="partner_id" on_change="onchange_partner_id(type,partner_id)" select="1"/>
|
||||
<field name="address_invoice_id" domain="[('partner_id','=',partner_id)]"/>
|
||||
<field name="account_id" domain="[('type','<>','view'), ('company_id', '=', company_id),('journal_id','=',journal_id)]" />
|
||||
<field name="date_due" select="1"/>
|
||||
|
||||
<field name="journal_id" select="1"/>
|
||||
<field name="number" select="1"/>
|
||||
|
||||
<field name="check_total"/>
|
||||
<field name="currency_id" on_change="onchange_currency_id(currency_id)" select="1"/>
|
||||
|
||||
<field name="invoice_line" nolabel="1" colspan="4">
|
||||
<tree string="Invoice lines" editable="bottom">
|
||||
<field name="name"/>
|
||||
|
||||
<field name="account_id" on_change="onchange_account_id(parent.partner_id,account_id)" domain="[('company_id', '=', parent.company_id),('journal_id','=',parent.journal_id)]"/>
|
||||
<field name="invoice_line_tax_id"/>
|
||||
<field name="account_analytic_id" domain="[('type','<>','view'), ('company_id', '=', parent.company_id)]" />
|
||||
<field name="quantity"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="price_subtotal"/>
|
||||
</tree>
|
||||
</field>
|
||||
<group col="2" colspan="2">
|
||||
<field name="tax_line" nolabel="1" colspan="2">
|
||||
<tree string="Taxes" editable="bottom">
|
||||
<field name="name"/>
|
||||
<field name="base" on_change="base_change(base)"/>
|
||||
<field name="amount" on_change="amount_change(amount)"/>
|
||||
|
||||
<field name="base_amount" invisible="True"/>
|
||||
<field name="tax_amount" invisible="True"/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
<group col="4" colspan="2">
|
||||
<field name="amount_untaxed"/>
|
||||
<field name="amount_total"/>
|
||||
<field name="amount_tax"/>
|
||||
<button name="button_compute" string="Compute taxes" states="draft" type="object" colspan="2"/>
|
||||
<field name="state" select="1" colspan="3"/>
|
||||
<newline/>
|
||||
<group col="3" colspan="4">
|
||||
<button name="invoice_open" states="draft,proforma" string="Create"/>
|
||||
<button name="invoice_cancel" states="draft,proforma,sale,open" string="Cancel"/>
|
||||
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Other Information">
|
||||
<field name="company_id"/>
|
||||
<newline/>
|
||||
<field name="partner_bank_id" domain="[('partner_id','=',partner_id)]"/>
|
||||
<field name="payment_term" on_change="onchange_payment_term(payment_term)" />
|
||||
<field name="reference" select="1"/>
|
||||
<field name="origin"/>
|
||||
<field name="address_contact_id" domain="[('partner_id','=',partner_id)]" colspan="3"/>
|
||||
<field name="partner_ref"/>
|
||||
<field name="partner_contact"/>
|
||||
<field name="move_id"/>
|
||||
<field name="date_invoice" select="1"/>
|
||||
<field name="period_id"/><label string="(keep empty to use the current period)" align="0.0" colspan="2"/>
|
||||
<newline/>
|
||||
<field name="comment" colspan="3"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="invoice_form">
|
||||
<field name="name">account.invoice.form1</field>
|
||||
<field name="model">account.invoice</field>
|
||||
|
@ -204,7 +285,8 @@
|
|||
<field name="name">account.invoice</field>
|
||||
<field name="res_model">account.invoice</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_mode">form,tree</field>
|
||||
<field name="view_id" eval="invoice_supplier_form"/>
|
||||
<field name="domain">[('type','=','in_invoice')]</field>
|
||||
<field name="context">{'type':'in_invoice'}</field>
|
||||
</record>
|
||||
|
|
|
@ -92,7 +92,7 @@ class account_invoice(osv.osv):
|
|||
('in_refund','Supplier Refund'),
|
||||
],'Type', readonly=True, states={'draft':[('readonly',False)]}, select=True),
|
||||
|
||||
'number': fields.char('Invoice Number', size=32,readonly=True),
|
||||
'number': fields.char('Invoice Number', size=32, readonly=True),
|
||||
'reference': fields.char('Invoice Reference', size=64),
|
||||
'comment': fields.text('Additionnal Information'),
|
||||
|
||||
|
@ -104,6 +104,7 @@ class account_invoice(osv.osv):
|
|||
('cancel','Canceled')
|
||||
],'State', select=True, readonly=True),
|
||||
|
||||
'check_total': fields.float('Total', digits=(16,2)),
|
||||
'date_invoice': fields.date('Date Invoiced', required=True, states={'open':[('readonly',True)],'close':[('readonly',True)]}),
|
||||
'date_due': fields.date('Due Date', states={'open':[('readonly',True)],'close':[('readonly',True)]}),
|
||||
|
||||
|
@ -124,7 +125,7 @@ class account_invoice(osv.osv):
|
|||
'tax_line': fields.one2many('account.invoice.tax', 'invoice_id', 'Tax Lines', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
|
||||
'move_id': fields.many2one('account.move', 'Invoice Movement', readonly=True),
|
||||
'amount_untaxed': fields.function(_amount_untaxed, method=True, digits=(16,2),string='Untaxed Amount'),
|
||||
'amount_untaxed': fields.function(_amount_untaxed, method=True, digits=(16,2),string='Untaxed'),
|
||||
'amount_tax': fields.function(_amount_tax, method=True, string='Tax', store=True),
|
||||
'amount_total': fields.function(_amount_total, method=True, string='Total', store=True),
|
||||
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
|
@ -261,6 +262,9 @@ class account_invoice(osv.osv):
|
|||
for inv in self.browse(cr, uid, ids):
|
||||
if inv.move_id:
|
||||
continue
|
||||
print inv.check_amount, inv.amount_total
|
||||
if inv.check_total <> inv.amount_total:
|
||||
raise osv.except_osv('Bad total !', 'Please verify the price of the invoice !\nThe real total does not match the computed total.')
|
||||
|
||||
company_currency = inv.account_id.company_id.currency_id.id
|
||||
# create the analytical lines
|
||||
|
@ -696,6 +700,10 @@ class account_invoice_tax(osv.osv):
|
|||
'tax_code_id': fields.many2one('account.tax.code', 'Tax Code'),
|
||||
'tax_amount': fields.float('Tax Code Amount', digits=(16,2)),
|
||||
}
|
||||
def base_change(self, cr, uid, ids, base):
|
||||
return {'value': {'base_amount':base}}
|
||||
def amount_change(self, cr, uid, ids, amount):
|
||||
return {'value': {'tax_amount':amount}}
|
||||
_order = 'sequence'
|
||||
_defaults = {
|
||||
'manual': lambda *a: 1,
|
||||
|
@ -719,4 +727,9 @@ class account_invoice_tax(osv.osv):
|
|||
return res
|
||||
account_invoice_tax()
|
||||
|
||||
class account_invoice_supplier(osv.osv):
|
||||
_inherit = 'account.invoice'
|
||||
_columns = {
|
||||
}
|
||||
account_invoice_supplier()
|
||||
|
||||
|
|
Loading…
Reference in New Issue