Report_ANALYTIC:

new reports
Purchase Journal:
	Link in pickings
	Better views and objects
BOARD_Account:
	New dashboard for accountants
Purchases:
	link in the picking to the purchase
	allow multiple pickings for the same purchase order
STOCK:
	When refunding picking -> confirm & Assign the newly generated picking

bzr revid: pinky-180950b35ab721f7b133e048bfe1f2bc02742a99
This commit is contained in:
pinky 2006-12-18 06:33:52 +00:00
parent 8532d49c9b
commit 775aff9b46
23 changed files with 468 additions and 18 deletions

View File

@ -0,0 +1,28 @@
##############################################################################
#
# Copyright (c) 2006 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.
#
##############################################################################

View File

@ -0,0 +1,11 @@
{
"name":"Board for accountant",
"version":"1.0",
"author":"Tiny",
"category":"Board",
"depends":["account","hr_timesheet_invoice","board"],
"demo_xml":[],
"update_xml":["board_account_view.xml"],
"active":False,
"installable":True,
}

View File

@ -0,0 +1,127 @@
<?xml version="1.0"?>
<terp>
<data>
<record model="board.note.type" id="note_account_type">
<field name="name">Accountants</field>
</record>
<record model="ir.ui.view" id="view_task_tree">
<field name="name">project.task.tree</field>
<field name="model">project.task</field>
<field name="type">tree</field>
<field name="priority" eval="99"/>
<field name="arch" type="xml">
<tree string="My tasks" colors="red:date_deadline&lt;current_date;blue:date_deadline==current_date">
<field name="name"/>
<field name="project_id"/>
<field name="date_deadline"/>
<field name="planned_hours"/>
<field name="effective_hours"/>
<field name="priority"/>
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_view_task_tree">
<field name="name">My open tasks</field>
<field name="res_model">project.task</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="domain">[('user_id','=',uid),('state','=','open')]</field>
<field name="view_id" ref="view_task_tree" />
</record>
<record model="ir.actions.act_window" id="action_view_task_tree_deadline">
<field name="name">My task's deadlines</field>
<field name="res_model">project.task</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="domain">[('user_id','=',uid),('state','=','open'),('date_deadline','&lt;&gt;',False)]</field>
<field name="view_id" ref="view_task_tree" />
</record>
<record model="ir.actions.act_window" id="action_view_board_note_tree">
<field name="name">Public notes</field>
<field name="res_model">board.note</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
<field name="domain">[('type','=','Project')]</field>
</record>
<record model="ir.ui.view" id="board_project_form">
<field name="name">board.project.form</field>
<field name="model">board.board</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Project">
<hpaned>
<child1>
<action
string="My open tasks"
name="%(action_view_task_tree)d"
colspan="4"
height="220"
width="510"/>
<action
string="My deadlines"
name="%(action_view_task_tree_deadline)d"
height="150"
colspan="4"/>
<action
string="Public notes"
name="%(action_view_board_note_tree)d"
colspan="2"
height="150"/>
<action
string="Public notes"
name="%(action_view_board_note_tree)d"
colspan="2"
height="150"/>
</child1>
<child2>
<button
string="Menu"
name="%(base.action_menu_admin)d"
icon="gtk-ok"
type="action"
colspan="4"/>
<action
string="My timesheet"
name="%(report_timesheet.action_timesheet_user_stat)d"
colspan="4"/>
<action
string="My work"
name="%(report_analytic_line.action_account_analytic_planning_stat_my_form)d"
colspan="4"/>
</child2>
</hpaned>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="open_board_sales_manager">
<field name="name">Dashboard project member</field>
<field name="res_model">board.board</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="usage">menu</field>
<field name="view_id" ref="board_project_form"/>
</record>
<menuitem
name="Dashboards/Project member"
action="open_board_sales_manager"
sequence="1"
id="menu_board_sales_manager"/>
</data>
</terp>

View File

@ -3,7 +3,7 @@
"version":"1.0",
"author":"Tiny",
"category":"Board",
"depends":["project","report_timesheet","board"],
"depends":["project","report_timesheet","board","report_analytic_line"],
"demo_xml":[],
"update_xml":["board_project_view.xml"],
"active":False,

View File

@ -48,8 +48,7 @@ invoice_fields = {
'string':'Destination Journal',
'type':'many2one',
'relation':'account.journal',
'required':True,
'domain':[('type','=','sale')]
'required':True
},
'group' : {'string':'Group by partner', 'type':'boolean'}
}

View File

@ -26,8 +26,8 @@
#
##############################################################################
import tools
import purchase
import partner
import stock
import wizard
import report

View File

@ -7,7 +7,15 @@
"category" : "Generic Modules/Sales & Purchases",
"init_xml" : [],
"demo_xml" : ["purchase_demo.xml"],
"update_xml" : ["purchase_workflow.xml", "purchase_sequence.xml", "purchase_data.xml", "purchase_view.xml", "purchase_report.xml", "purchase_wizard.xml"],
"update_xml" : [
"purchase_workflow.xml",
"purchase_sequence.xml",
"purchase_data.xml",
"purchase_view.xml",
"purchase_report.xml",
"purchase_wizard.xml",
"stock_view.xml"
],
"active": False,
"installable": True
}

View File

@ -93,7 +93,7 @@ class purchase_order(osv.osv):
'validator' : fields.many2one('res.users', 'Validated by', readonly=True),
'notes': fields.text('Notes'),
'invoice_id': fields.many2one('account.invoice', 'Invoice', readonly=True),
'picking_id': fields.many2one('stock.picking', 'Picking list', readonly=True),
'picking_ids': fields.one2many('stock.picking', 'purchase_id', 'Picking List', readonly=True, help="This is the list of picking list that have been generated for this invoice"),
'shipped':fields.boolean('Received', readonly=True, select=True),
'invoiced':fields.boolean('Invoiced & Paid', readonly=True, select=True),
'invoice_method': fields.selection([('manual','Manual'),('order','From order'),('picking','From picking')], 'Invoicing method', required=True),
@ -227,10 +227,11 @@ class purchase_order(osv.osv):
if order.invoice_method=='picking':
istate = '2binvoiced'
picking_id = self.pool.get('stock.picking').create(cr, uid, {
'origin': order.name+':'+(order.origin or ''),
'origin': order.name+((order.origin and (':'+order.origin)) or ''),
'type': 'in',
'address_id': order.dest_address_id.id or order.partner_address_id.id,
'invoice_state': istate
'invoice_state': istate,
'purchase_id': order.id
})
for order_line in order.order_line:
if not order_line.product_id:
@ -253,7 +254,6 @@ class purchase_order(osv.osv):
})
if order_line.move_dest_id:
self.pool.get('stock.move').write(cr, uid, [order_line.move_dest_id.id], {'location_id':order.location_id.id})
self.write(cr,uid,[order.id],{'picking_id':picking_id})
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
return picking_id
@ -265,7 +265,7 @@ class purchase_order(osv.osv):
'shipped':False,
'invoiced':False,
'invoice_id':False,
'picking_id':False,
'picking_ids':[],
'name': self.pool.get('ir.sequence').get(cr, uid, 'purchase.order'),
})
return super(purchase_order, self).copy(cr, uid, id, default, context)

View File

@ -53,8 +53,8 @@
<field name="location_id"/>
<field name="invoice_method"/>
<newline/>
<field name="picking_id" colspan="3"/>
<field name="invoice_id" colspan="3"/>
<field name="picking_ids" colspan="3"/>
</page>
<page string="Notes">
<field name="validator" />

44
addons/purchase/stock.py Normal file
View File

@ -0,0 +1,44 @@
##############################################################################
#
# Copyright (c) 2006 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.
#
##############################################################################
from osv import osv, fields
#
# Inherit of picking to add the link to the PO
#
class stock_picking(osv.osv):
_inherit = 'stock.picking'
_columns = {
'purchase_id': fields.many2one('purchase.order', 'Purchase Order', ondelete='set null', relate=True, select=True),
}
_defaults = {
'purchase_id': lambda *a: False
}
stock_picking()

View File

@ -0,0 +1,17 @@
<terp>
<data>
<record model="ir.ui.view" id="stock_picking_inherit_purchase">
<field name="name">stock.picking.form</field>
<field name="model">stock.picking</field>
<field name="type">form</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="purchase_id"/>
</field>
</field>
</record>
</data>
</terp>

View File

@ -34,4 +34,19 @@ class purchase(osv.osv):
_columns = {
'journal_id': fields.many2one('purchase_journal.purchase.journal', 'Journal', relate=True),
}
def action_picking_create(self, cr, uid, ids, *args):
result = super(purchase, self).action_picking_create(cr, uid, ids, *args)
for order in self.browse(cr, uid, ids, context={}):
pids = [ x.id for x in (order.picking_ids or [])]
self.pool.get('stock.picking').write(cr, uid, pids, {
'purchase_journal_id': order.journal_id.id
})
return result
purchase()
class picking(osv.osv):
_inherit="stock.picking"
_columns = {
'purchase_journal_id': fields.many2one('purchase_journal.purchase.journal', 'Purchase Journal', select=True, relate=True),
}
picking()

View File

@ -1,5 +1,17 @@
<terp>
<data>
<record model="ir.ui.view" id="purchase_journal_picking_order">
<field name="name">stock.picking.journal.view.form</field>
<field name="type">form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form" />
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="purchase_journal_id" select="1"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="view_purchase_journal_form">
<field name="name">purchase_journal.purchase.journal.form</field>
<field name="model">purchase_journal.purchase.journal</field>

View File

@ -0,0 +1,30 @@
##############################################################################
#
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# $Id: __init__.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 report_analytic

View File

@ -0,0 +1,14 @@
{
"name" : "Analytic Account Reporting",
"version" : "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com",
"depends" : ["account"],
"category" : "Generic Modules/Account",
"description": "A module that adds new reports based on analytic accounts.",
"init_xml" : [],
"demo_xml" : [],
"update_xml" : ["report_analytic_view.xml"],
"active": False,
"installable": True
}

View File

@ -0,0 +1,67 @@
##############################################################################
#
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# $Id: project.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.
#
##############################################################################
from osv import fields,osv
class report_analytic_account_close(osv.osv):
_name = "report.analytic.account.close"
_description = "Analytic account to close"
_auto = False
_columns = {
'name': fields.many2one('account.analytic.account', 'Analytic account', readonly=True),
'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
'quantity': fields.float('Quantity', readonly=True),
'quantity_max': fields.float('Max. Quantity', readonly=True),
'balance': fields.float('Balance', readonly=True),
'date_deadline': fields.date('Deadline', readonly=True),
}
def init(self, cr):
cr.execute("""
create or replace view report_crm_case_user as (
select
l.account_id as id,
l.account_id as name,
sum(l.unit_amount) as quantity,
sum(l.amount) as balance,
a.partner_id as partner_id,
a.quantity_max as quantity_max,
a.date as date_deadline
from
account_analytic_line l
left join
account_analytic_account a on (l.account_id=a.id)
where
a.state='open'
group by
l.account_id,a.quantity_max,a.date,a.partner_id
having
sum(l.unit_amount)>=a.quantity_max or
a.date <= current_date
)""")
report_analytic_account_close()

View File

@ -0,0 +1,67 @@
<?xml version="1.0"?>
<terp>
<data>
#
# Analytic accounts to close
#
<record model="ir.ui.view" id="view_analytic_account_form">
<field name="name">report.analytic.account.form</field>
<field name="model">report.analytic.account</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Sales Orders by product">
<field name="name" select="1"/>
<field name="partner_id" select="1"/>
<field name="quantity" select="1"/>
<field name="quantity_max"/>
<field name="date_deadline" select="1"/>
<field name="balance" select="1"/>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_analytic_account_tree">
<field name="name">report.analytic.account.tree</field>
<field name="model">report.analytic.account</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Sales Orders by product">
<field name="name"/>
<field name="partner_id"/>
<field name="quantity"/>
<field name="quantity_max"/>
<field name="date_deadline"/>
<field name="balance"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_analytic_account_graph">
<field name="name">report.analytic.account.graph</field>
<field name="model">report.analytic.account</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Analytic accounts to close">
<field name="partner_id" group="True"/>
<field name="quantity" operator="+"/>
<field name="quantity_max" operator="+"/>
</graph>
</field>
</record>
<record model="ir.actions.act_window" id="action_analytic_account_tree">
<field name="name">report.analytic.account.tree</field>
<field name="res_model">report.analytic.account</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
</record>
<menuitem name="Financial Management/Reporting/All Months/Analytic accounts to close"
action="action_analytic_account_tree"
id="menu_action_analytic_account_tree"/>
</data>
</terp>

View File

@ -34,7 +34,6 @@ class report_account_analytic_line_to_invoice(osv.osv):
_description = "Analytic lines to invoice report"
_auto = False
_columns = {
# a quoi sert le relate=True ?
'name': fields.date('Month', readonly=True),
'product_id':fields.many2one('product.product', 'Product', readonly=True, relate=True),
'account_id':fields.many2one('account.analytic.account', 'Analytic account', readonly=True, relate=True),
@ -61,4 +60,3 @@ class report_account_analytic_line_to_invoice(osv.osv):
)
""")
#report_account_analytic_line_to_invoice()

View File

@ -130,8 +130,6 @@ class sale_order(osv.osv):
'payment_line': fields.one2many('sale.order.payment', 'order_id', 'Order Payments', readonly=True, states={'draft':[('readonly',False)]}),
'invoice_ids': fields.many2many('account.invoice', 'sale_order_invoice_rel', 'order_id', 'invoice_id', 'Invoice', readonly=True, help="This is the list of invoices that have been generated for this sale order. The same sale order may have been invoiced in several times (by line for example)."),
#'picking_ids': fields.many2many('stock.picking', 'sale_order_picking_rel', 'order_id','picking_id', 'Picking List', readonly=True, help="This is the list of picking list that have been generated for this invoice"),
'picking_ids': fields.one2many('stock.picking', 'sale_id', 'Picking List', readonly=True, help="This is the list of picking list that have been generated for this invoice"),
'shipped':fields.boolean('Picked', readonly=True),

View File

@ -48,6 +48,7 @@ class picking(osv.osv):
_inherit="stock.picking"
_columns = {
'journal_id': fields.many2one('sale_journal.picking.journal', 'Journal', relate=True),
'sale_journal_id': fields.many2one('sale_journal.sale.journal', 'Sale Journal', relate=True),
'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoice Type', relate=True, readonly=True)
}
picking()
@ -62,7 +63,10 @@ class sale(osv.osv):
result = super(sale, self).action_ship_create(cr, uid, ids, *args)
for order in self.browse(cr, uid, ids, context={}):
pids = [ x.id for x in order.picking_ids]
self.pool.get('stock.picking').write(cr, uid, pids, {'invoice_type_id': order.invoice_type_id.id})
self.pool.get('stock.picking').write(cr, uid, pids, {
'invoice_type_id': order.invoice_type_id.id,
'sale_journal_id': order.journal_id.id
})
return result
def onchange_partner_id(self, cr, uid, ids, part):

View File

@ -176,6 +176,7 @@
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="journal_id" select="1"/>
<field name="sale_journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
</field>
</field>
@ -189,6 +190,7 @@
<field name="arch" type="xml">
<field name="invoice_state" position="after">
<field name="journal_id" select="1"/>
<field name="sale_journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
</field>
</field>

View File

@ -406,7 +406,7 @@ class stock_picking(osv.osv):
for move in pick.move_lines:
if (move.state in ('confirmed','draft')) and (mt=='one'):
return False
if (mt=='direct') and move.state=='assigned':
if (mt=='direct') and (move.state=='assigned') and (move.product_qty):
return True
ok = ok and (move.state in ('cancel','done','assigned'))
return ok
@ -530,6 +530,7 @@ class stock_picking(osv.osv):
'product_id': line.product_id.id,
'account_id': account_id,
'price_unit': line.sale_line_id and line.sale_line_id.price_unit or line.product_id.list_price,
'discount': line.sale_line_id and line.sale_line_id.discount or 0.0,
'quantity': line.product_uos_qty,
'invoice_line_tax_id': [(6,0,tax_ids)]
})

View File

@ -30,6 +30,8 @@
import wizard
import pooler
from tools.misc import UpdateableStr
import netsvc
import time
arch=UpdateableStr()
@ -41,7 +43,8 @@ def make_default(val):
return fct
def _get_returns(self, cr, uid, data, context):
pick_obj=pooler.get_pool(cr.dbname).get('stock.picking')
pool = pooler.get_pool(cr.dbname)
pick_obj=pool.get('stock.picking')
pick=pick_obj.browse(cr, uid, [data['id']])[0]
res={}
fields.clear()
@ -87,6 +90,11 @@ def _create_returns(self, cr, uid, data, context):
'picking_id':new_picking, 'state':'draft',
'location_id':new_location, 'location_dest_id':move.location_id.id,
'date':date_cur, 'date_planned':date_cur,})
if new_picking:
wf_service = netsvc.LocalService("workflow")
if new_picking:
wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_confirm', cr)
pick_obj.force_assign(cr, uid, [new_picking], context)
return new_picking
def _action_open_window(self, cr, uid, data, context):