New trunk

bzr revid: pinky-dedd7f8a42bd4557112a0513082691b8590ad6cc
This commit is contained in:
pinky 2006-12-07 13:41:40 +00:00
parent 004a0b996f
commit a83dce15e0
857 changed files with 249258 additions and 0 deletions

View File

@ -0,0 +1,37 @@
##############################################################################
#
# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
# Fabien Pinckaers <fp@tiny.Be>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import account
import project
import invoice
import transfer
import wizard
import report
import partner
import product

View File

@ -0,0 +1,44 @@
{
"name" : "Accounting and financial management",
"version" : "1.0",
"depends" : ["product"],
"author" : "Tiny",
"description": """Financial and accounting module that covers:
General accounting
Cost / Analytic accounting
Third party accounting
Taxes management
Budgets
""",
"website" : "http://tinyerp.com/module_account.html",
"category" : "Generic Modules/Accounting",
"init_xml" : [
],
"demo_xml" : [
"account_demo.xml",
"project/project_demo.xml",
"project/account.analytic.account.csv"
],
"update_xml" : [
"account_wizard.xml",
"account_view.xml",
"account_end_fy.xml",
"account_view_transfer.xml",
"account_invoice_view.xml",
"account_report.xml",
"partner_view.xml",
"data/account_invoice.xml",
"data/account_data.xml",
"data/account_minimal.xml",
"account_invoice_workflow.xml",
"project/project_view.xml",
"project/project_report.xml",
"product_data.xml",
"product_view.xml",
],
# "translations" : {
# "fr": "i18n/french_fr.csv"
# },
"active": False,
"installable": True
}

1678
addons/account/account.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,106 @@
<?xml version="1.0"?>
<terp>
<data noupdate="1">
<!--
Fiscal year
-->
<record model="account.fiscalyear" id="data_fiscalyear">
<field name="name" eval="'Fiscal Year '+time.strftime('%Y')"/>
<field name="code" eval="'FY'+time.strftime('%Y')"/>
<field name="date_start" eval="time.strftime('%Y')+'-01-01'"/>
<field name="date_stop" eval="time.strftime('%Y')+'-12-31'"/>
</record>
<!--
Fiscal Periods
-->
<record model="account.period">
<field name="name" eval="'Jan.'+time.strftime('%Y')"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field name="date_start" eval="time.strftime('%Y')+'-01-01'"/>
<field name="date_stop" eval="time.strftime('%Y')+'-01-31'"/>
</record>
<record model="account.period">
<field name="name" eval="'Feb.'+time.strftime('%Y')"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field name="date_start" eval="time.strftime('%Y')+'-02-01'"/>
<field name="date_stop" eval="time.strftime('%Y')+'-02-28'"/>
</record>
<record model="account.period">
<field name="name" eval="'Mar.'+time.strftime('%Y')"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field name="date_start" eval="time.strftime('%Y')+'-03-01'"/>
<field name="date_stop" eval="time.strftime('%Y')+'-03-31'"/>
</record>
<record model="account.period">
<field name="name" eval="'Apr.'+time.strftime('%Y')"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field name="date_start" eval="time.strftime('%Y')+'-04-01'"/>
<field name="date_stop" eval="time.strftime('%Y')+'-04-30'"/>
</record>
<record model="account.period">
<field name="name" eval="'May.'+time.strftime('%Y')"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field name="date_start" eval="time.strftime('%Y')+'-05-01'"/>
<field name="date_stop" eval="time.strftime('%Y')+'-05-31'"/>
</record>
<record model="account.period">
<field name="name" eval="'Jun.'+time.strftime('%Y')"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field name="date_start" eval="time.strftime('%Y')+'-06-01'"/>
<field name="date_stop" eval="time.strftime('%Y')+'-06-30'"/>
</record>
<record model="account.period">
<field name="name" eval="'Jul.'+time.strftime('%Y')"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field name="date_start" eval="time.strftime('%Y')+'-07-01'"/>
<field name="date_stop" eval="time.strftime('%Y')+'-07-31'"/>
</record>
<record model="account.period">
<field name="name" eval="'Aug.'+time.strftime('%Y')"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field name="date_start" eval="time.strftime('%Y')+'-08-01'"/>
<field name="date_stop" eval="time.strftime('%Y')+'-08-31'"/>
</record>
<record model="account.period">
<field name="name" eval="'Sep.'+time.strftime('%Y')"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field name="date_start" eval="time.strftime('%Y')+'-09-01'"/>
<field name="date_stop" eval="time.strftime('%Y')+'-09-30'"/>
</record>
<record model="account.period">
<field name="name" eval="'Oct.'+time.strftime('%Y')"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field name="date_start" eval="time.strftime('%Y')+'-10-01'"/>
<field name="date_stop" eval="time.strftime('%Y')+'-10-31'"/>
</record>
<record model="account.period">
<field name="name" eval="'Nov.'+time.strftime('%Y')"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field name="date_start" eval="time.strftime('%Y')+'-11-01'"/>
<field name="date_stop" eval="time.strftime('%Y')+'-11-30'"/>
</record>
<record model="account.period">
<field name="name" eval="'Dec.'+time.strftime('%Y')"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field name="date_start" eval="time.strftime('%Y')+'-12-01'"/>
<field name="date_stop" eval="time.strftime('%Y')+'-12-31'"/>
</record>
<record model="account.bank" id="fs">
<field name="name">Fortis</field>
<field name="code">FSB</field>
</record>
<record model="account.bank.account">
<field name="name">001-123456789-73</field>
<field name="journal_id" ref="bank_journal"/>
<field name="bank_id" ref="fs"/>
<field name="currency_id" ref="base.EUR"/>
<field name="account_id" ref="account.cash"/>
</record>
</data>
</terp>

View File

@ -0,0 +1,30 @@
<?xml version="1.0"?>
<terp>
<data>
<menuitem name="Financial Management/End of year treatments" sequence="20"/>
<record model="ir.actions.act_window" id="action_account_period_tree">
<field name="name">account.period.tree</field>
<field name="res_model">account.period</field>
<field name="view_type">tree</field>
<field name="domain">[('state','=','draft')]</field>
<field name="view_id" ref="view_account_period_tree"/>
</record>
<menuitem name="Financial Management/End of year treatments/Close a period"
id="menu_action_account_period_close_tree"
action="action_account_period_tree" />
<record model="ir.actions.act_window" id="action_account_fiscalyear_tree">
<field name="name">account.fiscalyear.tree</field>
<field name="res_model">account.fiscalyear</field>
<field name="view_type">tree</field>
<field name="domain">[('state','=','done')]</field>
<field name="view_id" ref="view_account_fiscalyear_tree"/>
</record>
<menuitem name="Financial Management/End of year treatments/Old fiscal years"
id="menu_action_account_fiscalyear_close_tree"
action="action_account_fiscalyear_tree"/>
</data>
</terp>

View File

@ -0,0 +1,319 @@
<?xml version="1.0"?>
<terp>
<data>
<record model="ir.ui.view" id="view_company_from_invoice">
<field name="name">res.company.form</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="rml_footer2" position="after">
<field name="currency_id" />
</field>
</field>
</record>
#---------------------------------------------------------
# Invoices
#---------------------------------------------------------
<record model="ir.ui.view" id="view_invoice_line_tree">
<field name="name">account.invoice.line.tree</field>
<field name="model">account.invoice.line</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Invoice Line">
<field name="name"/>
<field name="account_id"/>
<field name="quantity"/>
<field name="uos_id"/>
<field name="price_unit"/>
<field name="discount"/>
<field name="price_subtotal"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_invoice_line_form">
<field name="name">account.invoice.line.form</field>
<field name="model">account.invoice.line</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Invoice Line">
<notebook>
<page string="Line">
<field name="name" select="1"/>
<field name="account_id" on_change="onchange_account_id(parent.partner_id,account_id)" />
<field name="product_id" select="1" on_change="product_id_change(product_id, uos_id, quantity, name)"/>
<field name="uos_id"/>
<field name="quantity" select="1"/>
<field name="price_unit" select="1"/>
<field name="discount"/>
<newline/>
<field name="price_subtotal"/>
<field name="invoice_line_tax_id" colspan="3"/>
</page>
<page string="Other">
<field name="note" colspan="4"/>
</page>
</notebook>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_invoice_tax_tree">
<field name="name">account.invoice.tax.tree</field>
<field name="model">account.invoice.tax</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Manual Invoice Taxes">
<field name="sequence"/>
<field name="manual"/>
<field name="name"/>
<field name="account_id"/>
<field name="base"/>
<field name="amount"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_invoice_tax_form">
<field name="name">account.invoice.tax.form</field>
<field name="model">account.invoice.tax</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Manual Invoice Taxes">
<field name="name" select="1"/>
<field name="sequence"/>
<field name="account_id" select="1"/>
<field name="manual" select="1"/>
<field name="amount" select="1"/>
<field name="base"/>
<separator string="Tax codes" colspan="4"/>
<field name="base_code_id"/>
<field name="base_amount"/>
<field name="tax_code_id"/>
<field name="tax_amount"/>
</form>
</field>
</record>
<record model="ir.ui.view" id="invoice_tree">
<field name="name">account.invoice.tree</field>
<field name="model">account.invoice</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Invoice" colors="grey:state=='draft'">
<field name="name"/>
<field name="type"/>
<field name="number"/>
<field name="date_invoice"/>
<field name="partner_id"/>
<field name="amount_untaxed"/>
<field name="amount_total"/>
<field name="currency_id"/>
<field name="state"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="invoice_form">
<field name="name">account.invoice.form1</field>
<field name="model">account.invoice</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Invoice">
<notebook>
<page string="Invoice">
<field name="name" select="1"/>
<field name="currency_id" on_change="onchange_currency_id(currency_id)" select="1"/>
<newline/>
<field name="type" select="1"/>
<field name="number" select="1"/>
<newline/>
<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"/>
<field name="project_id"/>
<field name="payment_term"/>
<field name="date_due"/>
<field name="journal_id" select="1"/>
<field name="invoice_line" nolabel="1" widget="one2many_list" colspan="4"/>
<group colspan="4" col="7">
<field name="amount_untaxed"/>
<field name="amount_tax"/>
<field name="amount_total"/>
<button name="button_compute" string="Compute" states="draft" type="object"/>
</group>
<group col="6" colspan="4">
<field name="state" readonly="1" select="1"/>
<button name="invoice_proforma" states="draft" string="Create PRO-FORMA"/>
<button name="invoice_open" states="draft,proforma" string="Create Invoice"/>
<button name="invoice_cancel" states="draft,proforma,sale,open" string="Cancel Invoice"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object"/>
</group>
</page>
<page string="Tax Lines">
<field name="tax_line" nolabel="1" widget="one2many_list" colspan="4"/>
</page>
<page string="Other Information">
<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.actions.act_window" id="action_invoice_form">
<field name="name">account.invoice</field>
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_id" ref="invoice_form"/>
</record>
<menuitem name="Financial Management/Invoices" id="menu_action_invoice_form" action="action_invoice_form" sequence="6"/>
<record model="ir.actions.act_window" id="action_invoice_tree1">
<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="domain">[('type','=','out_invoice')]</field>
<field name="context">{'type':'out_invoice'}</field>
</record>
<menuitem name="Financial Management/Invoices/Customers Invoices" id="menu_action_invoice_tree1" action="action_invoice_tree1"/>
<record model="ir.actions.act_window" id="action_invoice_tree2">
<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="domain">[('type','=','in_invoice')]</field>
<field name="context">{'type':'in_invoice'}</field>
</record>
<menuitem name="Financial Management/Invoices/Suppliers Invoices" id="menu_action_invoice_tree2" action="action_invoice_tree2"/>
<record model="ir.actions.act_window" id="action_invoice_tree3">
<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="domain">[('type','=','out_refund')]</field>
<field name="context">{'type':'out_refund'}</field>
</record>
<menuitem name="Financial Management/Invoices/Customers Refund" id="menu_action_invoice_tree3" action="action_invoice_tree3"/>
<record model="ir.actions.act_window" id="action_invoice_tree4">
<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="domain">[('type','=','in_refund')]</field>
<field name="context">{'type':'in_refund'}</field>
</record>
<menuitem name="Financial Management/Invoices/Suppliers Refund" id="menu_action_invoice_tree4" action="action_invoice_tree4"/>
<record model="ir.actions.act_window" id="action_invoice_tree5">
<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="domain">[('state','=','draft'),('type','=','out_invoice')]</field>
<field name="context">{'type':'out_invoice'}</field>
</record>
<menuitem name="Financial Management/Invoices/Customers Invoices/Draft Invoices" action="action_invoice_tree5" id="menu_invoice_draft"/>
<record model="ir.actions.act_window" id="action_invoice_tree6">
<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="domain">[('state','=','proforma'),('type','=','out_invoice')]</field>
<field name="context">{'type':'out_invoice'}</field>
</record>
<menuitem name="Financial Management/Invoices/Customers Invoices/PRO-FORMA" id="menu_action_invoice_tree6" action="action_invoice_tree6"/>
<record model="ir.actions.act_window" id="action_invoice_tree7">
<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="domain">[('state','=','open'),('type','=','out_invoice')]</field>
<field name="context">{'type':'out_invoice'}</field>
</record>
<menuitem name="Financial Management/Invoices/Customers Invoices/Opened Invoices" id="menu_action_invoice_tree7" action="action_invoice_tree7"/>
<record model="ir.actions.act_window" id="action_invoice_tree8">
<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="domain">[('state','=','draft'),('type','=','in_invoice')]</field>
<field name="context">{'type':'in_invoice'}</field>
</record>
<menuitem name="Financial Management/Invoices/Suppliers Invoices/Draft" id="menu_action_invoice_tree8" action="action_invoice_tree8"/>
<record model="ir.actions.act_window" id="action_invoice_tree9">
<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="domain">[('state','=','open'),('type','=','in_invoice')]</field>
<field name="context">{'type':'in_invoice'}</field>
</record>
<menuitem name="Financial Management/Invoices/Suppliers Invoices/Opened" id="menu_action_invoice_tree9" action="action_invoice_tree9"/>
<record model="ir.actions.act_window" id="action_invoice_tree10">
<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="domain">[('state','=','draft'),('type','=','out_refund')]</field>
<field name="context">{'type':'out_refund'}</field>
</record>
<menuitem name="Financial Management/Invoices/Customers Refund/Draft" id="menu_action_invoice_tree10" action="action_invoice_tree10"/>
<record model="ir.actions.act_window" id="action_invoice_tree11">
<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="domain">[('state','=','open'),('type','=','out_refund')]</field>
<field name="context">{'type':'out_refund'}</field>
</record>
<menuitem name="Financial Management/Invoices/Customers Refund/Opened" id="menu_action_invoice_tree11" action="action_invoice_tree11"/>
<record model="ir.actions.act_window" id="action_invoice_tree12">
<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="domain">[('state','=','draft'),('type','=','in_refund')]</field>
<field name="context">{'type':'in_refund'}</field>
</record>
<menuitem name="Financial Management/Invoices/Suppliers Refund/Draft" id="menu_action_invoice_tree12" action="action_invoice_tree12"/>
<record model="ir.actions.act_window" id="action_invoice_tree13">
<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="domain">[('state','=','open'),('type','=','in_refund')]</field>
<field name="context">{'type':'in_refund'}</field>
</record>
<menuitem name="Financial Management/Invoices/Suppliers Refund/Opened" id="menu_action_invoice_tree13" action="action_invoice_tree13"/>
</data>
</terp>

View File

@ -0,0 +1,121 @@
<?xml version="1.0"?>
<terp>
<data>
<record model="workflow" id="wkf">
<field name="name">account.invoice.basic</field>
<field name="osv">account.invoice</field>
<field name="on_create">True</field>
</record>
<record model="workflow.activity" id="act_draft">
<field name="wkf_id" ref="wkf"/>
<field name="flow_start">True</field>
<field name="name">draft</field>
</record>
<!-- <record model="workflow.activity" id="act_confirm">
<field name="wkf_id" ref="wkf"/>
<field name="name">confirm</field>
</record> -->
<record model="workflow.activity" id="act_sale">
<field name="wkf_id" ref="wkf"/>
<field name="name">sale</field>
<field name="action">action_move_create()&#10;write({'state':'sale'})</field>
<field name="kind">function</field>
</record>
<record model="workflow.activity" id="act_proforma">
<field name="wkf_id" ref="wkf"/>
<field name="name">proforma</field>
<field name="action">action_move_create()&#10;write({'state':'proforma'})</field>
<field name="kind">function</field>
</record>
<record model="workflow.activity" id="act_open">
<field name="wkf_id" ref="wkf"/>
<field name="name">open</field>
<field name="action">action_move_create()&#10;action_number()&#10;write({'state':'open'})</field>
<field name="kind">function</field>
</record>
<record model="workflow.activity" id="act_paid">
<field name="wkf_id" ref="wkf"/>
<field name="name">paid</field>
<field name="flow_stop">True</field>
<field name="action">write({'state':'paid'})</field>
<field name="kind">function</field>
</record>
<record model="workflow.activity" id="act_cancel">
<field name="wkf_id" ref="wkf"/>
<field name="name">cancel</field>
<field name="flow_stop">True</field>
<field name="action">action_cancel()&#10;write({'state':'cancel'})</field>
<field name="kind">function</field>
</record>
<!--
<record model="workflow.transition" id="t1">
<field name="act_from" ref="act_draft"/>
<field name="act_to" ref="act_confirm"/>
</record>
-->
<record model="workflow.transition" id="t2">
<field name="act_from" ref="act_draft"/>
<field name="act_to" ref="act_sale"/>
<field name="signal">invoice_sale</field>
</record>
<record model="workflow.transition" id="t3">
<field name="act_from" ref="act_draft"/>
<field name="act_to" ref="act_proforma"/>
<field name="signal">invoice_proforma</field>
</record>
<record model="workflow.transition" id="t4">
<field name="act_from" ref="act_draft"/>
<field name="act_to" ref="act_open"/>
<field name="signal">invoice_open</field>
</record>
<record model="workflow.transition" id="t5">
<field name="act_from" ref="act_proforma"/>
<field name="act_to" ref="act_open"/>
<field name="signal">invoice_open</field>
</record>
<record model="workflow.transition" id="t6">
<field name="act_from" ref="act_sale"/>
<field name="act_to" ref="act_paid"/>
<field name="trigger_model">account.move.line</field>
<field name="trigger_expr_id">move_line_id_payment_get()</field>
<field name="condition">test_paid()</field>
</record>
<record model="workflow.transition" id="t7">
<field name="act_from" ref="act_proforma"/>
<field name="act_to" ref="act_paid"/>
<field name="trigger_model">account.move.line</field>
<field name="trigger_expr_id">move_line_id_payment_get()</field>
<field name="condition">test_paid()</field>
</record>
<record model="workflow.transition" id="t8">
<field name="act_from" ref="act_open"/>
<field name="act_to" ref="act_paid"/>
<field name="trigger_model">account.move.line</field>
<field name="trigger_expr_id">move_line_id_payment_get()</field>
<field name="condition">test_paid()</field>
</record>
<record model="workflow.transition" id="t9">
<field name="act_from" ref="act_draft"/>
<field name="act_to" ref="act_cancel"/>
<field name="signal">invoice_cancel</field>
</record>
<record model="workflow.transition" id="t10">
<field name="act_from" ref="act_sale"/>
<field name="act_to" ref="act_cancel"/>
<field name="signal">invoice_cancel</field>
</record>
<record model="workflow.transition" id="t11">
<field name="act_from" ref="act_proforma"/>
<field name="act_to" ref="act_cancel"/>
<field name="signal">invoice_cancel</field>
</record>
<record model="workflow.transition" id="t12">
<field name="act_from" ref="act_open"/>
<field name="act_to" ref="act_cancel"/>
<field name="signal">invoice_cancel</field>
</record>
</data>
</terp>

View File

@ -0,0 +1,122 @@
<?xml version="1.0"?>
<terp>
<data>
<report id="account_ledger"
string="General Ledger"
model="account.account"
name="account.grand.livre"
rml="account/report/grand_livre.rml"
auto="False"
menu="False"/>
<report id="account_3rdparty_ledger"
string="Third party ledger"
model="res.partner"
name="account.grand.livre.tiers"
rml="account/report/grand_livre_tiers.rml"
auto="False"
menu="False"/>
<report id="account_account_balance"
string="Account balance"
model="account.account"
name="account.account.balance"
rml="account/report/account_balance.rml"
auto="False"
menu="False"/>
<report id="account_3rdparty_account_balance"
string="Third party balance"
model="account.account"
name="account.partner.balance"
rml="account/report/partner_balance.rml"
auto="False"
menu="False"/>
<report id="account_budget"
string="Print Budget"
model="account.budget.post"
name="account.budget"
rml="account/report/budget_report.rml"
auto="False"
menu="False"/>
<report id="account_central_journal"
string="Print Central Journal"
model="account.journal.period"
name="account.central.journal"
rml="account/report/central_journal.rml"
auto="False"/>
<report id="account_general_journal"
string="Print General Journal"
model="account.journal.period"
name="account.general.journal"
rml="account/report/general_journal.rml"
auto="False"/>
<report id="account_journal"
string="Print Journal"
model="account.journal.period"
name="account.journal.period.print"
rml="account/report/account_journal.rml"
auto="False"/>
<report id="account_overdue"
string="Overdue payments"
model="res.partner"
name="account.rappel"
rml="account/report/rappel.rml"
auto="False" />
<report id="account_invoices"
string="Invoices"
model="account.invoice"
name="account.invoice"
rml="account/report/invoice.rml"
auto="False"/>
<report id="account_transfers"
string="Transfers"
model="account.transfer"
name="account.transfer"
xml="account/report/transfer.xml"
xsl="account/report/transfer.xsl"/>
<report id="account_intracom"
string="IntraCom"
model="account.move.line"
name="account.intracom"
menu="False"
auto="False" />
<report id="account_move_line_list"
string="All Entries"
model="account.tax.code"
name="account.tax.code.entries"
rml="account/report/account_tax_code.rml"
/>
<report id="account_vat_declaration"
string="VAT Declaration"
model="account.tax.code"
name="account.vat.declaration"
rml="account/report/tax_report.rml"
auto="False"
menu="False"/>
<wizard
string="Wizard VAT Declaration"
model="account.tax.code"
name="account.vat.declaration"
menu="False"
id="wizard_vat_declaration"/>
<menuitem
name="Financial Management/Reporting/VAT Declaration"
action="wizard_vat_declaration"
type="wizard"
id="menu_wizard_vat_declaration"/>
<!--
<report id="analytic_journal"
string="Analytic journal"
model="account.analytic.account"
name="account.analytic.journal"
xml="account/report/analytic_journal.rml"
auto="False" />
-->
</data>
</terp>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,71 @@
<?xml version="1.0"?>
<terp>
<data>
#---------------------------------------------------------
# Transfers
#---------------------------------------------------------
<record model="ir.ui.view" id="view_transfer_tree">
<field name="name">account.transfer.tree</field>
<field name="model">account.transfer</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Transfers">
<field name="date"/>
<field name="name" select="1"/>
<field name="type"/>
<field name="amount"/>
<field name="account_src_id"/>
<field name="account_dest_id"/>
<field name="state"/>
<field name="partner_id" select="1"/>
<field name="project_id" select="1"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_transfer_form">
<field name="name">account.transfer.form</field>
<field name="model">account.transfer</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Transfers">
<field name="name" select="1"/>
<field name="reference" select="1"/>
<field name="journal_id" select="1"/>
<field name="period_id" select="1"/>
<field name="type" on_change="onchange_type(type)"/>
<field name="partner_id" select="1" on_change="onchange_partner(type,partner_id)"/>
<field name="date" select="1"/>
<field name="project_id"/>
<field name="amount" select="1"/>
<field name="change" select="1"/>
<newline/>
<field name="account_src_id" select="1" on_change="onchange_account(type,account_src_id,account_dest_id)"/>
<field name="account_dest_id" select="1"/>
<newline/>
<field name="state" select="1"/>
<group colspan="2">
<button name="pay_validate" states="draft" string="Confirm Payment" type="object"/>
<button name="pay_cancel" states="posted" string="Cancel Payment" type="object"/>
</group>
<separator string="Related Invoices" colspan="4"/>
<field name="invoice_id" colspan="4" domain="[('partner_id','=',partner_id),('state','=','open')]"/>
<separator string="Adjustement and corrections" colspan="4"/>
<field name="adjust_amount"/>
<field name="adjust_account_id"/>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_transfer_form">
<field name="name">account.transfer.form</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.transfer</field>
<field name="view_type">form</field>
<field name="view_id" ref="view_transfer_form"/>
</record>
<!--
<menuitem name="Financial Management/Entries/Cash Book Transfers" action="action_transfer_form" sequence="15"/>
-->
</data>
</terp>

View File

@ -0,0 +1,191 @@
<?xml version="1.0"?>
<terp>
<data>
<menuitem name="Financial Management" icon="terp-account"/>
<wizard
string="Refund Invoice"
model="account.invoice"
name="account.invoice.refund"
id="wizard_invoice_refund"/>
<wizard
string="Pay Invoice"
model="account.invoice"
name="account.invoice.pay"
id="wizard_invoice_pay"/>
<wizard
string="Spread amount"
model="account.budget.post"
name="account.budget.spread"
menu="False"
id="wizard_budget_spread"/>
<!-- close year, period, journal -->
<wizard
string="Close Fiscal Year"
model="account.fiscalyear"
name="account.fiscalyear.close"
keyword="tree_but_action"
id="wizard_fiscalyear_close"/>
<menuitem
name="Financial Management/End of year treatments/Close a fiscal year"
action="wizard_fiscalyear_close"
type="wizard"
id="menu_wizard_fy_close"/>
<wizard
string="Close Period"
model="account.period"
name="account.period.close"
keyword="tree_but_action"
id="wizard_period_close"/>
<wizard
string="Close Journal"
model="account.journal.period"
name="account.journal.period.close"
keyword="tree_but_action"
id="wizard_journal_period_close"
auto="False"/>
<!-- automatic reconcile -->
<wizard
string="Automatic Reconciliation"
model="account.account"
name="account.automatic.reconcile"
menu="False"
id="wizard_automatic_reconcile"/>
<menuitem name="Financial Management/Periodical Processing/Automatic reconciliation"
action="wizard_automatic_reconcile"
type="wizard"
id="menu_automatic_reconcile"/>
<!-- manual reconcile -->
<wizard
string="Reconcile Entries"
model="account.move.line"
name="account.move.line.reconcile"
id="wizard_reconcile"/>
<wizard
string="Reconcile Entries"
model="account.move.line"
name="account.move.line.reconcile.select"
menu="False"
id="wizard_reconcile_select"/>
<menuitem
name="Financial Management/Periodical Processing/Manual reconciliation"
action="wizard_reconcile_select"
type="wizard"
id="menu_reconcile_select"/>
<!-- unreconcile -->
<wizard
string="Unreconcile Entries"
model="account.move.line"
name="account.move.line.unreconcile"
id="wizard_unreconcile"/>
<wizard
string="Unreconcile Entries"
model="account.move.line"
name="account.move.line.unreconcile.select"
menu="False"
id="wizard_unreconcile_select"/>
<menuitem
name="Financial Management/Periodical Processing/Manual unreconciliation"
action="wizard_unreconcile_select"
type="wizard"
id="menu_unreconcile_select"/>
<!-- subscriptions -->
<wizard
string="Generate Subscription Entries"
model="account.subscription"
name="account.subscription.generate"
menu="False"
id="wizard_generate_subscription"/>
<menuitem
name="Financial Management/Periodical Processing/Subscription entries"
action="wizard_generate_subscription"
type="wizard"
id="menu_generate_subscription"/>
<!-- Aged trial balance -->
<wizard
string="Aged Trial Balance"
model="res.partnet"
name="account.aged.trial.balance"
menu="False"
id="wizard_aged_trial_balance"/>
<menuitem
name="Financial Management/Reporting/Aged Trial Balance"
action="wizard_aged_trial_balance"
type="wizard"
id="menu_aged_trial_balance"/>
<!-- report-related wizards -->
<wizard
string="Partner Balance"
model="res.partner"
name="account.partner.balance.report"
menu="False"
id="wizard_partner_balance_report"/>
<menuitem
name="Financial Management/Reporting/Third party balance"
action="wizard_partner_balance_report"
type="wizard"
id="menu_partner_balance"/>
<wizard
string="Third party ledger"
model="res.partner"
name="account.grand.livre.tiers.report"
menu="False"
id="wizard_grand_livre_tiers"/>
<menuitem
name="Financial Management/Reporting/Third party ledger"
action="wizard_grand_livre_tiers"
type="wizard"
id="menu_third_party_ledger"/>
<wizard
string="Budget"
model="account.budget.post"
name="account.budget.report"
keyword="client_print_multi"
id="wizard_budget_report"/>
<wizard
string="Account Balance"
model="account.account"
name="account.account.balance.report"
keyword="client_print_multi"
id="wizard_balance_report"/>
<wizard
string="General Ledger"
model="account.account"
name="account.grand.livre.report"
keyword="client_print_multi"
id="wizard_general_ledger_report"/>
<wizard
string="Confirm draft invoices"
model="account.invoice"
name="account.invoice.state.confirm"
keyword="client_action_multi"
multi="True"
id="wizard_invoice_state_confirm"/>
<wizard
string="Cancel selected invoices"
model="account.invoice"
name="account.invoice.state.cancel"
keyword="client_action_multi"
multi="True"
id="wizard_invoice_state_cancel"/>
</data>
</terp>

View File

@ -0,0 +1,280 @@
<?xml version="1.0"?>
<terp>
<data>
<!--
Account Type
-->
<record model="account.account.type" id="account_type_receivable" >
<field name="name">Receivable</field>
<field name="code">receivable</field>
<field name="partner_account">True</field>
</record>
<record model="account.account.type" id="account_type_payable" >
<field name="name">Payable</field>
<field name="code">payable</field>
<field name="partner_account">True</field>
</record>
<record model="account.account.type" id="account_type_view">
<field name="name">View</field>
<field name="code">view</field>
</record>
<record model="account.account.type" id="account_type_income" >
<field name="name">Income</field>
<field name="code">income</field>
</record>
<record model="account.account.type" id="account_type_expense">
<field name="name">Expense</field>
<field name="code">expense</field>
</record>
<record model="account.account.type" id="account_type_tax">
<field name="name">Tax</field>
<field name="code">tax</field>
</record>
<record model="account.account.type" id="account_type_cash">
<field name="name">Cash</field>
<field name="code">cash</field>
</record>
<record model="account.account.type" id="account_type_asset">
<field name="name">Asset</field>
<field name="code">asset</field>
</record>
<record model="account.account.type" id="account_type_equity">
<field name="name">Equity</field>
<field name="code">equity</field>
</record>
</data>
<data noupdate="1">
<!--
Payment term
-->
<record model="account.payment.term" id="account_payment_term">
<field name="name">Default Payment Term</field>
</record>
<record model="account.payment.term.line" id="account_payment_term_line">
<field name="name">30 days</field>
<field name="value">balance</field>
<field name="days" eval="30"/>
<field name="condition">net days</field>
<field name="payment_id" eval="account_payment_term"/>
</record>
<!--
Account Journal View
-->
<record model="account.journal.view" id="account_journal_bank_view">
<field name="name">Cash Journal View</field>
</record>
<record model="account.journal.column" id="bank_col1">
<field name="view_id" ref="account_journal_bank_view"/>
<field name="name">Date</field>
<field name="field">date</field>
<field name="required" eval="True"/>
<field name="sequence" eval="1"/>
</record>
<record model="account.journal.column" id="bank_col2">
<field name="view_id" ref="account_journal_bank_view"/>
<field name="name">N. Piece</field>
<field name="field">move_id</field>
<field name="required" eval="False"/>
<field name="sequence" eval="2"/>
</record>
<record model="account.journal.column" id="bank_col7">
<field name="view_id" ref="account_journal_bank_view"/>
<field name="name">Name</field>
<field name="field">name</field>
<field name="sequence" eval="3"/>
<field name="required" eval="True"/>
</record>
<record model="account.journal.column" id="bank_col4">
<field name="view_id" ref="account_journal_bank_view"/>
<field name="name">Statement</field>
<field name="field">statement_id</field>
<field name="sequence" eval="4"/>
</record>
<record model="account.journal.column" id="bank_col6">
<field name="view_id" ref="account_journal_bank_view"/>
<field name="name">Partner</field>
<field name="field">partner_id</field>
<field name="sequence" eval="5"/>
</record>
<record model="account.journal.column" id="bank_col5">
<field name="view_id" ref="account_journal_bank_view"/>
<field name="name">Account</field>
<field name="field">account_id</field>
<field name="required" eval="True"/>
<field name="sequence" eval="6"/>
</record>
<record model="account.journal.column" id="bank_col9">
<field name="view_id" ref="account_journal_bank_view"/>
<field name="name">Debit</field>
<field name="field">debit</field>
<field name="sequence" eval="10"/>
</record>
<record model="account.journal.column" id="bank_col10">
<field name="view_id" ref="account_journal_bank_view"/>
<field name="name">Credit</field>
<field name="field">credit</field>
<field name="sequence" eval="11"/>
</record>
<record model="account.journal.column" id="bank_col3">
<field name="view_id" ref="account_journal_bank_view"/>
<field name="name">Ref</field>
<field name="field">ref</field>
<field name="sequence" eval="7"/>
</record>
<record model="account.journal.column" id="bank_col23">
<field name="view_id" ref="account_journal_bank_view"/>
<field name="name">State</field>
<field name="field">state</field>
<field name="sequence" eval="12"/>
</record>
<record model="account.journal.view" id="account_journal_view">
<field name="name">Journal View</field>
</record>
<record model="account.journal.column" id="journal_col1">
<field name="view_id" ref="account_journal_view"/>
<field name="name">Date</field>
<field name="field">date</field>
<field name="required" eval="True"/>
<field name="sequence" eval="1"/>
</record>
<record model="account.journal.column" id="journal_col2">
<field name="view_id" ref="account_journal_view"/>
<field name="name">N. Piece</field>
<field name="field">move_id</field>
<field name="required" eval="False"/>
<field name="sequence" eval="2"/>
</record>
<record model="account.journal.column" id="journal_col3">
<field name="view_id" ref="account_journal_view"/>
<field name="name">Ref</field>
<field name="field">ref</field>
<field name="sequence" eval="3"/>
</record>
<record model="account.journal.column" id="journal_col4">
<field name="view_id" ref="account_journal_view"/>
<field name="name">Account</field>
<field name="field">account_id</field>
<field name="required" eval="True"/>
<field name="sequence" eval="5"/>
</record>
<record model="account.journal.column" id="journal_col5">
<field name="view_id" ref="account_journal_view"/>
<field name="name">Partner</field>
<field name="field">partner_id</field>
<field name="sequence" eval="4"/>
</record>
<record model="account.journal.column" id="journal_col6">
<field name="view_id" ref="account_journal_view"/>
<field name="name">Name</field>
<field name="field">name</field>
<field name="sequence" eval="6"/>
<field name="required" eval="True"/>
</record>
<record model="account.journal.column" id="journal_col7">
<field name="view_id" ref="account_journal_view"/>
<field name="name">Maturity Date</field>
<field name="field">date_maturity</field>
<field name="sequence" eval="7"/>
</record>
<record model="account.journal.column" id="journal_col8">
<field name="view_id" ref="account_journal_view"/>
<field name="name">Debit</field>
<field name="field">debit</field>
<field name="sequence" eval="8"/>
</record>
<record model="account.journal.column" id="journal_col9">
<field name="view_id" ref="account_journal_view"/>
<field name="name">Credit</field>
<field name="field">credit</field>
<field name="sequence" eval="9"/>
</record>
<record model="account.journal.column" id="journal_col24">
<field name="view_id" ref="account_journal_view"/>
<field name="name">State</field>
<field name="field">state</field>
<field name="sequence" eval="10"/>
</record>
<record model="account.journal.column" id="journal_col25">
<field name="view_id" ref="account_journal_view"/>
<field name="name">Tax Acc.</field>
<field name="field">tax_code_id</field>
<field name="sequence" eval="11"/>
</record>
<record model="account.journal.column" id="journal_col26">
<field name="view_id" ref="account_journal_view"/>
<field name="name">Tax</field>
<field name="field">tax_amount</field>
<field name="sequence" eval="12"/>
</record>
<!--
Account Journal Sequences
-->
<record model="ir.sequence.type" id="sequence_journal_type">
<field name="name">Account Journal</field>
<field name="code">account.journal</field>
</record>
<record model="ir.sequence" id="sequence_journal">
<field name="name">Account Journal</field>
<field name="code">account.journal</field>
<field name="prefix"></field>
</record>
<!--
Account Statement Sequences
-->
<record model="ir.sequence.type" id="sequence_statement_type">
<field name="name">Bank Statement</field>
<field name="code">account.bank.statement</field>
</record>
<record model="ir.sequence" id="sequence_statement">
<field name="name">Account Bank Statement</field>
<field name="code">account.bank.statement</field>
<field name="prefix">St. %(month)s/%(day)s</field>
<field name="number_next" eval="0"/>
<field name="number_increment" eval="0"/>
</record>
<!--
Account Journal
-->
<record model="account.journal" id="sales_journal">
<field name="name">Sales Journal</field>
<field name="code">SAJ</field>
<field name="type">sale</field>
<field name="view_id" ref="account_journal_view"/>
<field name="sequence_id" ref="sequence_journal"/>
<field name="default_credit_account_id" model="account.account" search="[('type','=','receivable')]"/>
<field name="default_debit_account_id" model="account.account" search="[('type','=','receivable')]"/>
</record>
<record model="account.journal" id="expenses_journal">
<field name="name">Expenses Journal</field>
<field name="code">EXJ</field>
<field name="type">purchase</field>
<field name="view_id" ref="account_journal_view"/>
<field name="sequence_id" ref="sequence_journal"/>
<field name="default_debit_account_id" model="account.account" search="[('type','=','payable')]"/>
<field name="default_credit_account_id" model="account.account" search="[('type','=','payable')]"/>
</record>
<record model="account.journal" id="bank_journal">
<field name="name">Bank Journal</field>
<field name="code">BNK</field>
<field name="type">cash</field>
<field name="view_id" ref="account_journal_bank_view"/>
<field name="sequence_id" ref="sequence_journal"/>
<field name="default_debit_account_id" model="account.account" search="[('type','=','cash')]"/>
<field name="default_credit_account_id" model="account.account" search="[('type','=','cash')]"/>
</record>
</data>
</terp>

View File

@ -0,0 +1,76 @@
<?xml version="1.0"?>
<terp>
<data noupdate="1">
<record model="res.request.link" id="req_link_invoice">
<field name="name">Invoice</field>
<field name="object">account.invoice</field>
</record>
<!--
Sequences types for invoices
-->
<record model="ir.sequence.type" id="seq_type_out_invoice">
<field name="name">Account Invoice Out</field>
<field name="code">account.invoice.out_invoice</field>
</record>
<record model="ir.sequence.type" id="seq_type_in_invoice">
<field name="name">Account Invoice In</field>
<field name="code">account.invoice.in_invoice</field>
</record>
<record model="ir.sequence.type" id="seq_type_out_refund">
<field name="name">Account Refund Out</field>
<field name="code">account.invoice.out_refund</field>
</record>
<record model="ir.sequence.type" id="seq_type_in_refund">
<field name="name">Account Refund In</field>
<field name="code">account.invoice.in_refund</field>
</record>
<!--
Sequences for invoices
-->
<record model="ir.sequence" id="seq_out_invoice">
<field name="name">Account Invoice Out</field>
<field name="code">account.invoice.out_invoice</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<record model="ir.sequence" id="seq_in_invoice">
<field name="name">Account Invoice In</field>
<field name="code">account.invoice.in_invoice</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<record model="ir.sequence" id="seq_out_refund">
<field name="name">Account Refund Out</field>
<field name="code">account.invoice.out_refund</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<record model="ir.sequence" id="seq_in_refund">
<field name="name">Account Refund In</field>
<field name="code">account.invoice.in_refund</field>
<field name="padding" eval="3"/>
<field name="prefix">%(year)s/</field>
</record>
<!--
Sequences types for analytic account
-->
<record model="ir.sequence.type">
<field name="name">Analytic account</field>
<field name="code">account.analytic.account</field>
</record>
<!--
Sequence for analytic account
-->
<record model="ir.sequence">
<field name="name">Analytic account sequence</field>
<field name="code">account.analytic.account</field>
<field name="padding" eval="3" />
<field name="number_next" eval="2708" />
</record>
</data>
</terp>

View File

@ -0,0 +1,64 @@
<?xml version="1.0"?>
<terp>
<data noupdate="True">
<!--
Minimal Tiny ERP Account Chart
-->
<record model="account.account" id="a_recv">
<field name="name">Main Receivable</field>
<field name="code">40</field>
<field name="type">receivable</field>
<field name="currency_id" ref="base.EUR"/>
<field name="parent_id" eval="[(6,0,[])]"/>
</record>
<record model="account.account" id="a_pay">
<field name="name">Main Payable</field>
<field name="code">440</field>
<field name="type">payable</field>
<field name="currency_id" ref="base.EUR"/>
<field name="parent_id" eval="[(6,0,[])]"/>
</record>
<record model="account.account" id="cash">
<field name="name">Petty Cash</field>
<field name="code">57</field>
<field name="type">cash</field>
<field name="currency_id" ref="base.EUR"/>
<field name="parent_id" eval="[(6,0,[])]"/>
</record>
<record model="account.account" id="a_expense">
<field name="name">Products Purchase</field>
<field name="code">600</field>
<field name="type">expense</field>
<field name="currency_id" ref="base.EUR"/>
<field name="parent_id" eval="[(6,0,[])]"/>
</record>
<record model="account.account" id="a_sale">
<field name="name">Products Sales</field>
<field name="code">701</field>
<field name="type">income</field>
<field name="currency_id" ref="base.EUR"/>
<field name="parent_id" eval="[(6,0,[])]"/>
</record>
<record model="ir.property" id="property_account_receivable" forcecreate="True">
<field name="name">property_account_receivable</field>
<field name="fields_id" search="[('model','=','res.partner'),('name','=','property_account_receivable')]"/>
<field name="value" eval="'account.account,'+str(a_recv)"/>
</record>
<record model="ir.property" id="property_account_payable" forcecreate="True">
<field name="name">property_account_payable</field>
<field name="fields_id" search="[('model','=','res.partner'),('name','=','property_account_payable')]"/>
<field name="value" eval="'account.account,'+str(a_pay)"/>
</record>
<record model="ir.property" id="property_account_tax" forcecreate="True">
<field name="name">property_account_tax</field>
<field name="fields_id" search="[('model','=','res.partner'),('name','=','property_account_tax')]"/>
<field name="value" eval="False"/>
</record>
</data>
</terp>

665
addons/account/invoice.py Normal file
View File

@ -0,0 +1,665 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# $Id: account.py 1005 2005-07-25 08:41:42Z nicoe $
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import time
import netsvc
from osv import fields, osv
import ir
class account_invoice(osv.osv):
def _amount_untaxed(self, cr, uid, ids, prop, unknow_none,unknow_dict):
id_set=",".join(map(str,ids))
cr.execute("SELECT s.id,COALESCE(SUM(l.price_unit*l.quantity*(100-l.discount))/100.0,0)::decimal(16,2) AS amount FROM account_invoice s LEFT OUTER JOIN account_invoice_line l ON (s.id=l.invoice_id) WHERE s.id IN ("+id_set+") GROUP BY s.id ")
res=dict(cr.fetchall())
return res
def _amount_tax(self, cr, uid, ids, prop, unknow_none,unknow_dict):
id_set=",".join(map(str,ids))
cr.execute("SELECT s.id,COALESCE(SUM(l.amount),0)::decimal(16,2) AS amount FROM account_invoice s LEFT OUTER JOIN account_invoice_tax l ON (s.id=l.invoice_id) WHERE s.id IN ("+id_set+") GROUP BY s.id ")
res=dict(cr.fetchall())
return res
def _amount_total(self, cr, uid, ids, prop, unknow_none,unknow_dict):
untax = self._amount_untaxed(cr, uid, ids, prop, unknow_none,unknow_dict)
tax = self._amount_tax(cr, uid, ids, prop, unknow_none,unknow_dict)
res = {}
for id in ids:
res[id] = untax.get(id,0.0