[IMP] Complete rewrite of sale_journal module

no need for picking journal anymore, the stock has a journal system by default
  no need for sale journal anymore, you can use sales team
  invoice types is kept

bzr revid: fp@tinyerp.com-20101017180528-3cmxx06v7wh9a6yi
This commit is contained in:
Fabien Pinckaers 2010-10-17 20:05:28 +02:00
parent ea969153db
commit 295cf8b235
16 changed files with 51 additions and 1120 deletions

View File

@ -28,11 +28,8 @@ class sale_installer(osv.osv_memory):
_columns = {
'delivery': fields.boolean('Delivery Costs',
help="Allows you to compute delivery costs on your quotations."),
'sale_journal': fields.boolean('Sales and deliveries by journal',
help="Allows you to categorise your "
"sales and deliveries (picking lists) between different journals. "
"This module is very helpful for bigger companies that "
"work by departments."),
'sale_journal': fields.boolean('Invoicing journals',
help="Allows you to group and invoice your delivery orders according to different invoicing types: daily, weekly, etc."),
'sale_layout': fields.boolean('Sales Order Layout Improvement',
help="Provides some features to improve the layout of the Sales Order reports."),
'sale_margin': fields.boolean('Margins in Sales Orders',

View File

@ -49,9 +49,11 @@
<field name="help">If you have more than one shops reselling your company products, you can create and manage them from here. Whenever you will record a new quotation or sale order, it has to be linked to a shop. The shop also defines the warehouse from which the products will be delivered for each particular sale.</field>
</record>
<menuitem id="menu_config_sale"
parent="base.menu_base_config"
name="Sales" groups="base.group_extended"/>
<menuitem action="action_shop_form" id="menu_action_shop_form"
parent="product.prod_config_main" sequence="0"
groups="base.group_extended,base.group_sale_manager"/>
parent="menu_config_sale" sequence="0" />
<record id="view_sale_order_calendar" model="ir.ui.view">
<field name="name">sale.order.calendar</field>

View File

@ -20,7 +20,4 @@
##############################################################################
import sale_journal
import report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -53,14 +53,9 @@
'update_xml': [
'security/ir.model.access.csv',
'sale_journal_view.xml',
'report/sale_journal_report_view.xml',
'report/picking_journal_report_view.xml',
],
'demo_xml': ['sale_journal_demo.xml'],
'test': [
'test/sale_journal.yml',
'test/picking_journal.yml',
],
'test': [ ],
'installable': True,
'active': False,
'certificate': '0077661619085',

View File

@ -1,25 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import sale_journal_report
import picking_journal_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,88 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
import tools
from decimal_precision import decimal_precision as dp
class sale_journal_picking_report(osv.osv):
"""
Picking list by journal and by invoice
"""
_name = "sale.journal.picking.report"
_description = "Picking lists"
_auto = False
_columns = {
'name': fields.char('Year', size=64, required=False, readonly=True),
'month': fields.selection([('01', 'January'), ('02', 'February'), ('03', 'March'), ('04', 'April'), ('05', 'May'), ('06', 'June'),
('07', 'July'), ('08', 'August'), ('09', 'September'), ('10', 'October'), ('11', 'November'), ('12', 'December')], 'Month', readonly=True),
'invoice_state':fields.selection([
("invoiced", "invoiced"),
("2binvoiced", "to be invoiced"),
("none", "None")
], "Invoice state", readonly=True),
'state': fields.selection([
('draft', 'draft'),
('auto', 'waiting'),
('confirmed', 'confirmed'),
('assigned', 'assigned'),
('done', 'done'),
('cancel', 'cancel'),
], 'State', readonly=True),
'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoicing method', readonly=True),
'journal_id': fields.many2one('sale_journal.picking.journal', 'Journal', readonly=True),
'quantity': fields.float('Quantities', readonly=True),
'price_total': fields.float('Total Price', readonly=True, digits_compute=dp.get_precision('Sale Price')),
'price_average': fields.float('Average Price', readonly=True, digits_compute=dp.get_precision('Sale Price')),
'count': fields.integer('# of Lines', readonly=True),
}
_order = 'journal_id, name desc, price_total desc'
def init(self, cr):
tools.drop_view_if_exists(cr, 'sale_journal_picking_report')
cr.execute("""
create or replace view sale_journal_picking_report as (
select
min(l.id) as id,
to_char(s.date, 'YYYY') as name,
to_char(s.date, 'MM') as month,
s.state,
s.invoice_state,
s.invoice_type_id,
s.journal_id,
sum(l.product_qty) as quantity,
count(*) as count,
sum(l.product_qty*ol.price_unit*(1.0-ol.discount/100.0)) as price_total,
(sum(l.product_qty*ol.price_unit*(1.0-ol.discount/100.0))/sum(l.product_qty))::decimal(16,2) as price_average
from stock_picking s
right join stock_move l on (s.id=l.picking_id)
left join sale_order_line ol on (l.sale_line_id=ol.id)
group by s.journal_id, s.invoice_type_id, to_char(s.date, 'YYYY'),to_char(s.date, 'MM'),s.state, s.invoice_state
order by s.invoice_type_id, s.invoice_state, s.state
)
""")
sale_journal_picking_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,106 +0,0 @@
<openerp>
<data>
<!-- picking by journal and invoice's tree view-->
<record model="ir.ui.view" id="view_sale_journal_picking_report_tree">
<field name="name">sale.journal.picking.report.tree</field>
<field name="model">sale.journal.picking.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Picking Journal">
<field name="name" invisible="1"/>
<field name="month" invisible="1"/>
<field name="invoice_state" invisible="1"/>
<field name="state" invisible="1"/>
<field name="invoice_type_id" invisible="1"/>
<field name="journal_id" invisible="1"/>
<field name="quantity" />
<field name="count" />
<field name="price_average"/>
<field name="price_total"/>
</tree>
</field>
</record>
<!-- picking journal's graph view -->
<record id="view_sale_journal_picking_graph" model="ir.ui.view">
<field name="name">sale.journal.picking.report.graph</field>
<field name="model">sale.journal.picking.report</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Picking journal Statistics" type="bar">
<field name="journal_id"/>
<field name="invoice_type_id"/>
<field name="price_total"/>
</graph>
</field>
</record>
<!-- Picking journal search view -->
<record model="ir.ui.view" id="view_sale_journal_picking_report_search">
<field name="name">sale.journal.picking.report.search</field>
<field name="model">sale.journal.picking.report</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Picking journal">
<group col="8" colspan="4">
<filter icon="terp-go-year" string="This Year" name="year" domain="[('name','=',time.strftime('%%Y'))]" help="Picking by invoice or by journal method in this year"/>
<filter icon="terp-go-month" string="This Month" name="month" domain="[('month','=',time.strftime('%%m'))]" help="Picking by invoice or by journal method in this month"/>
<separator orientation="vertical"/>
<filter icon="terp-document-new"
string="Draft"
domain="[('state','=','draft')]"/>
<filter icon="terp-gtk-media-pause"
string="Pending"
domain="[('state','=','waiting')]"/>
<filter icon="terp-camera_test"
string="Confirmed"
domain="[('state','=','confirmed')]"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="month" select="1"/>
<field name="invoice_state" select="1"/>
<field name="state" select="1"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="12">
<filter string="Journal" icon="terp-folder-orange" context="{'group_by':'journal_id'}"/>
<filter string="Invoice" icon="terp-dolar" context="{'group_by':'invoice_type_id'}"/>
<separator orientation="vertical"/>
<filter string="Invoice state" icon="terp-stock_effects-object-colorize" context="{'group_by':'invoice_state'}"/>
<filter string="state" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
</group>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="action_sale_journal_picking_report_open">
<field name="name">Statistics on picking to invoice</field>
<field name="res_model">sale.journal.picking.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('invoice_state','=','2binvoiced'),('invoice_type_id','=',active_id)]</field>
</record>
<!-- Action for picking journal view -->
<record model="ir.actions.act_window" id="action_sale_journal_picking_report_open_menu_all">
<field name="name">Picking Journal</field>
<field name="res_model">sale.journal.picking.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="search_view_id" ref="view_sale_journal_picking_report_search"/>
<field name="context">{'search_default_month':1, 'group_by_no_leaf':1,'group_by':[]}</field>
<field name="help">Display your company picking journal and personalize its view by filtering it with specific selection criteria.</field>
</record>
<menuitem name="Picking journal" id="menu_invoice_type_picking_stats_open_all" parent="stock.next_id_61"
action="action_sale_journal_picking_report_open_menu_all" sequence="8"/>
</data>
</openerp>

View File

@ -1,75 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
import tools
class sale_journal_report(osv.osv):
_name = "sale.journal.report"
_description = "Sales Orders by Journal"
_auto = False
_columns = {
'name': fields.char('Year', size=64, required=False, readonly=True),
'month':fields.selection([('01', 'January'), ('02', 'February'), ('03', 'March'), ('04', 'April'),
('05', 'May'), ('06', 'June'), ('07', 'July'), ('08', 'August'), ('09', 'September'),
('10', 'October'), ('11', 'November'), ('12', 'December')], 'Month', readonly=True),
'state': fields.selection([
('draft', 'Quotation'),
('waiting_date', 'Waiting Schedule'),
('manual', 'Manual in progress'),
('progress', 'In progress'),
('shipping_except', 'Shipping Exception'),
('invoice_except', 'Invoice Exception'),
('done', 'Done'),
('cancel', 'Cancel')
], 'Order State', readonly=True),
'journal_id': fields.many2one('sale_journal.sale.journal', 'Journal', readonly=True),
'quantity': fields.float('Quantities', readonly=True),
'price_total': fields.float('Total Price', readonly=True),
'price_average': fields.float('Average Price', readonly=True),
'count': fields.integer('# of Lines', readonly=True),
}
_order = 'journal_id, name desc,price_total desc'
def init(self, cr):
tools.drop_view_if_exists(cr, 'sale_journal_report')
cr.execute("""
create or replace view sale_journal_report as (
select
min(l.id) as id,
to_char(s.date_order, 'YYYY') as name,
to_char(s.date_order,'MM') as month,
s.state,
s.journal_id,
sum(l.product_uom_qty) as quantity,
count(*),
sum(l.product_uom_qty*l.price_unit) as price_total,
(sum(l.product_uom_qty*l.price_unit)/sum(l.product_uom_qty))::decimal(16,2) as price_average
from sale_order s
right join sale_order_line l on (s.id=l.order_id)
group by s.journal_id , to_char(s.date_order, 'YYYY'),to_char(s.date_order, 'MM'), s.state
)
""")
sale_journal_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,89 +0,0 @@
<openerp>
<data>
<!-- Sales by journal's view -->
<record model="ir.ui.view" id="view_sale_journal_report_tree">
<field name="name">sale.journal.report.tree</field>
<field name="model">sale.journal.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Sales by Journal">
<field name="name" invisible="1"/>
<field name="state" invisible="1"/>
<field name="journal_id" invisible="1"/>
<field name="quantity"/>
<field name="count"/>
<field name="price_average"/>
<field name="price_total"/>
</tree>
</field>
</record>
<!-- sales journal graph view -->
<record id="view_sale_journal_graph" model="ir.ui.view">
<field name="name">sale.journal.report.graph</field>
<field name="model">sale.journal.report</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Sales journal Statistics" type="bar">
<field name="journal_id"/>
<field name="price_total"/>
</graph>
</field>
</record>
<!-- sales by journal search view -->
<record model="ir.ui.view" id="view_sale_journal_report_search">
<field name="name">sale.journal.report.search</field>
<field name="model">sale.journal.report</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Sales by Journal">
<group col="8" colspan="4">
<filter icon="terp-go-year" string="This Year" domain="[('name','!=','')]" help="Sale journal in this year"/>
<filter icon="terp-go-month" string="This Month" domain="[('name','=',time.strftime('%%Y-%%m-01'))]" help="Sale journal in this month"/>
<separator orientation="vertical"/>
<filter icon="terp-document-new"
string="Quotations"
domain="[('state','=','draft')]"/>
<filter icon="terp-gtk-media-pause"
string="Waiting Schedule"
domain="[('state','=','waiting_date')]"/>
<filter icon="terp-camera_test"
string="In progress"
domain="[('state','=','progress')]"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="state" select="1"/>
<field name="journal_id" widget="selection"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="12">
<filter string="journal" name="journal" icon="terp-folder-orange" context="{'group_by':'journal_id'}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
</group>
</search>
</field>
</record>
<!-- Action of sales by journal view-->
<record model="ir.actions.act_window" id="action_sale_journal_report_open_menu_all">
<field name="name">Sales by Journal</field>
<field name="res_model">sale.journal.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="search_view_id" ref="view_sale_journal_report_search"/>
<field name="context">{'search_default_journal': 1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="help">This view allows you to access your sales orders or quotations by journal. You can create journal in order to group different sales orders by teams and perform automatic actions on a journal (confirm or cancel all sales of a journal).</field>
</record>
<menuitem name="Sales by Journal" id="menu_sale_journal_report_open_all"
parent="base.next_id_64" action="action_sale_journal_report_open_menu_all" sequence="2" groups="base.group_sale_manager"/>
</data>
</openerp>

View File

@ -39,160 +39,6 @@ class sale_journal_invoice_type(osv.osv):
}
sale_journal_invoice_type()
class sale_journal(osv.osv):
_name = 'sale_journal.sale.journal'
_description = 'Sale Journal'
_columns = {
'name': fields.char('Journal', size=64, required=True, states={'close':[('readonly',True)]}),
'code': fields.char('Code', size=16, required=True, states={'close':[('readonly',True)]}),
'user_id': fields.many2one('res.users', 'Responsible', required=True, states={'close':[('readonly',True)]}),
'date': fields.date('Journal date', required=True, states={'close':[('readonly',True)]}),
'date_created': fields.date('Creation date', readonly=True, required=True),
'date_close': fields.date('Close date ', readonly=True),
'sale_stats_ids': fields.one2many("sale.journal.report", "journal_id", 'Sale stats', readonly=True),
'state': fields.selection([
('draft','Draft'),
('open','Open'),
('cancel','Cancel'),
('confirm','Confirm'),
('close','Close'),
], 'State', required=True, readonly=True),
'note': fields.text('Note'),
}
_defaults = {
'date': time.strftime('%Y-%m-%d'),
'date_created': time.strftime('%Y-%m-%d'),
'user_id': lambda self,cr,uid,context: uid,
'state': lambda self,cr,uid,context: 'draft',
}
def button_sale_cancel(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, {'state':'cancel'})
for id in ids:
sale_ids = self.pool.get('sale.order').search(cr, uid, [('journal_id','=',id),('state','=','draft')])
for saleid in sale_ids:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'sale.order', saleid, 'cancel', cr)
return True
def button_sale_confirm(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, {'state':'confirm'})
for id in ids:
sale_ids = self.pool.get('sale.order').search(cr, uid, [('journal_id','=',id),('state','=','draft')])
for saleid in sale_ids:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'sale.order', saleid, 'order_confirm', cr)
return True
def button_open(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, {'state':'open'})
return True
def button_draft(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, {'state':'draft'})
return True
def button_close(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, {'state':'close', 'date_close':time.strftime('%Y-%m-%d')})
return True
def button_reset(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state': 'draft'})
return True
def copy(self, cr, uid, id, default=None, context=None):
"""Overrides orm copy method
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of cases IDs
@param context: A standard dictionary for contextual values
"""
if context is None:
context = {}
if default is None:
default = {}
default.update({'sale_stats_ids': []})
return super(sale_journal, self).copy(cr, uid, id, default=default, context=context)
sale_journal()
class picking_journal(osv.osv):
_name = 'sale_journal.picking.journal'
_description = 'Picking Journal'
_columns = {
'name': fields.char('Journal', size=64, required=True),
'code': fields.char('Code', size=16, required=True),
'user_id': fields.many2one('res.users', 'Responsible', required=True),
'date': fields.date('Journal date', required=True),
'date_created': fields.date('Creation date', readonly=True, required=True),
'date_close': fields.date('Close date', readonly=True),
'picking_stats_ids': fields.one2many("sale.journal.picking.report", "journal_id", 'Journal Stats', readonly=True),
'state': fields.selection([
('draft','Draft'),
('open','Open'),
('cancel','Cancel'),
('close','Close'),
('confirm','Confirm'),
], 'Creation date', required=True, readonly=True),
'note': fields.text('Note'),
}
_defaults = {
'date': time.strftime('%Y-%m-%d'),
'date_created': time.strftime('%Y-%m-%d'),
'user_id': lambda self,cr,uid,context: uid,
'state': lambda self,cr,uid,context: 'draft',
}
def button_picking_cancel(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, {'state':'cancel'})
for id in ids:
pick_ids = self.pool.get('stock.picking').search(cr, uid, [('journal_id','=',id)])
for pickid in pick_ids:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'stock.picking', pickid, 'button_cancel', cr)
return True
def button_open(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, {'state':'open'})
return True
def button_draft(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, {'state':'draft'})
return True
def button_close(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, {'state':'close', 'date_close':time.strftime('%Y-%m-%d')})
return True
def button_reset(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state': 'draft'})
return True
def button_picking_confirm(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, {'state':'confirm'})
for id in ids:
pick_ids = self.pool.get('stock.picking').search(cr, uid, [('journal_id','=',id)])
for pickid in pick_ids:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'stock.picking', pickid, 'button_confirm', cr)
return True
def copy(self, cr, uid, id, default=None, context=None):
"""Overrides orm copy method
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of cases IDs
@param context: A standard dictionary for contextual values
"""
if context is None:
context = {}
if default is None:
default = {}
default.update({'picking_stats_ids': []})
return super(picking_journal, self).copy(cr, uid, id, default=default, context=context)
picking_journal()
#==============================================
# sale journal inherit
#==============================================
@ -201,22 +47,20 @@ class res_partner(osv.osv):
_inherit = 'res.partner'
_columns = {
'property_invoice_type': fields.property(
'sale_journal.invoice.type',
type = 'many2one',
relation = 'sale_journal.invoice.type',
string = "Invoicing Method",
method = True,
view_load = True,
group_name = "Accounting Properties",
help = "The type of journal used for sales and picking."),
'sale_journal.invoice.type',
type = 'many2one',
relation = 'sale_journal.invoice.type',
string = "Invoicing Method",
method = True,
view_load = True,
group_name = "Accounting Properties",
help = "The type of journal used for sales and picking."),
}
res_partner()
class picking(osv.osv):
_inherit = "stock.picking"
_columns = {
'journal_id': fields.many2one('sale_journal.picking.journal', 'Picking Journal', domain=[('state','!=', 'close')],help="Picking Journal"),
'sale_journal_id': fields.many2one('sale_journal.sale.journal', 'Sale Journal'),
'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoice Type', readonly=True)
}
picking()
@ -224,7 +68,6 @@ picking()
class sale(osv.osv):
_inherit = "sale.order"
_columns = {
'journal_id': fields.many2one('sale_journal.sale.journal', 'Journal', domain=[('state','not in', ('done', 'draft''cancel'))]),
'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoice Type')
}
def action_ship_create(self, cr, uid, ids, *args):
@ -232,18 +75,16 @@ class sale(osv.osv):
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,
'sale_journal_id': order.journal_id.id
'invoice_type_id': order.invoice_type_id and order.invoice_type_id.id or False,
})
return result
def onchange_partner_id(self, cr, uid, ids, part):
result = super(sale, self).onchange_partner_id(cr, uid, ids, part)
if part:
itype = self.pool.get('res.partner').browse(cr, uid, part).property_invoice_type.id
result['value']['invoice_type_id'] = itype
itype = self.pool.get('res.partner').browse(cr, uid, part).property_invoice_type
if itype:
result['value']['invoice_type_id'] = itype.id
return result
sale()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -2,11 +2,11 @@
<openerp>
<data noupdate="1">
<record model="ir.property" id="property_invoice_type_def">
<field name="name">property_invoice_type</field>
<field name="fields_id" search="[('model','=','res.partner'),('name','=','property_invoice_type')]"/>
<field name="value" eval="False"/>
</record>
<record model="ir.property" id="property_invoice_type_def">
<field name="name">property_invoice_type</field>
<field name="fields_id" search="[('model','=','res.partner'),('name','=','property_invoice_type')]"/>
<field name="value" eval="False"/>
</record>
</data>
</openerp>

View File

@ -2,17 +2,17 @@
<openerp>
<data noupdate="1">
<record model="sale_journal.invoice.type" id="daily">
<field name="name">Daily invoicing</field>
</record>
<record model="sale_journal.invoice.type" id="monthly">
<field name="name">Monthly invoicing</field>
<field name="invoicing_method">grouped</field>
</record>
<record model="sale_journal.invoice.type" id="daily">
<field name="name">Daily invoicing</field>
</record>
<record model="sale_journal.invoice.type" id="monthly">
<field name="name">Monthly invoicing</field>
<field name="invoicing_method">grouped</field>
</record>
<record model="ir.property" id="sale_journal.property_invoice_type_def">
<field name="value" eval="'sale_journal.invoice.type,'+str(daily)"/>
</record>
<record model="ir.property" id="sale_journal.property_invoice_type_def">
<field name="value" eval="'sale_journal.invoice.type,'+str(daily)"/>
</record>
</data>
</openerp>

View File

@ -1,10 +1,5 @@
<openerp>
<data>
<menuitem id="base.menu_base_config" name="Configuration" parent="base.menu_base_partner" sequence="30"
groups="base.group_sale_salesman,base.group_sale_manager"/>
<menuitem id="menu_sale_journal_config" name="Sale Journals"
parent="base.menu_base_config" sequence="5" groups="base.group_sale_salesman"/>
<!-- sale journal invoice Type's Form view -->
<record model="ir.ui.view" id="view_sale_journal_invoice_type_form">
@ -14,13 +9,12 @@
<field name="arch" type="xml">
<form string="Invoice Type">
<group colspan="4" col="6">
<field name="name" select="1"/>
<field name="invoicing_method" select="1"/>
<field name="active" select="1"/>
<field name="name" select="1"/>
<field name="invoicing_method" select="1"/>
<field name="active" select="1"/>
</group>
<separator string="Notes" colspan="3"/>
<newline/>
<field name="note" colspan="3" nolabel="1"/>
<separator string="Notes" colspan="4"/>
<field name="note" colspan="4" nolabel="1"/>
</form>
</field>
</record>
@ -42,113 +36,15 @@
<!-- Action for sale journal invoice Type -->
<record model="ir.actions.act_window" id="action_definition_journal_invoice_type">
<field name="name">Invoice Types</field>
<field name="res_model">sale_journal.invoice.type</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="help">Create specific invoicing types that can be maintained in your sales orders. An invoicing type can, for example, be a time lapse to be observed before billing your sales orders. Example: invoice daily, invoice every Wednesday, at end of month, etc.</field>
<field name="help">Invoice types are used on partners, sales order and delivery orders. You can create journal to group your invoicing according to customer's needs: daily, each wednesday, monthly, etc.</field>
</record>
<menuitem name="Invoicing Methods" id="menu_definition_journal_invoice_type" parent="menu_sale_journal_config" action="action_definition_journal_invoice_type"/>
<!-- sale journal Form view -->
<record model="ir.ui.view" id="view_sale_journal_form">
<field name="name">sale_journal.sale.journal.form</field>
<field name="model">sale_journal.sale.journal</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Sales Journals">
<group colspan="4" col="6">
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="user_id" select="1"/>
<field name="date" select="1"/>
<field name="date_created" select="1"/>
<field name="date_close" select="1"/>
</group>
<notebook colspan="4">
<page string="Sales">
<field name="sale_stats_ids" colspan="4" nolabel="1">
<tree string="Sales">
<field name="name"/>
<field name="quantity"/>
<field name="price_total"/>
<field name="price_average"/>
<field name="count"/>
<field name="state"/>
</tree>
</field>
</page>
<page string="Notes">
<field name="note" colspan="4" nolabel="1"/>
</page>
</notebook>
<field name="state"/>
<group col="6" colspan="2">
<button name="button_open" string="Open Journal" states="draft" type="object" icon="terp-check"/>
<button string="Confirm Sales" name="button_sale_confirm" states="open" type="object" icon="terp-camera_test"/>
<button name="button_close" string="Close Journal" states="confirm,open" type="object" icon="terp-dialog-close"/>
<button name="button_draft" string="Set to Draft" states="cancel" type="object" icon="gtk-convert"/>
<button string="Cancel Sales" name="button_sale_cancel" states="close,draft,open,confirm" type="object" icon="gtk-cancel"/>
</group>
</form>
</field>
</record>
<!-- Sale journal tree view -->
<record model="ir.ui.view" id="view_sale_journal_tree">
<field name="name">sale_journal.sale.journal.tree</field>
<field name="model">sale_journal.sale.journal</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Sales Journals">
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="user_id" select="1"/>
<field name="date" select="1"/>
<field name="state"/>
</tree>
</field>
</record>
<!-- Sale journal search view -->
<record model="ir.ui.view" id="view_sale_journal_search">
<field name="name">sale_journal.sale.journal.search</field>
<field name="model">sale_journal.sale.journal</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Sales by Journal">
<group col="8" colspan="4">
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Sales Journal which are in draft state"/>
<filter icon="terp-check" string="Open" domain="[('state','=','open')]" help="Open Sales Journal"/>
<filter icon="terp-camera_test" string="Confirm" domain="[('state','=','confirm')]" help="Confirmed Sales Journal"/>
<filter icon="gtk-cancel" string="Cancel" domain="[('state','=','cancel')]" help="Sales Journal which are cancelled"/>
<filter icon="terp-dialog-close" string="Close" domain="[('state','=','done')]" help="Sales Journal which are closed"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="code"/>
<field name="user_id"/>
<field name="date"/>
</group>
</search>
</field>
</record>
<!-- Action for sale journal view -->
<record model="ir.actions.act_window" id="action_definition_journal">
<field name="res_model">sale_journal.sale.journal</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="context">{'search_default_user_id':uid}</field>
<field name="search_view_id" ref="view_sale_journal_search"/>
<field name="help">Display and maintain the sales journals to be used in your system. A sales journal is the place where all specific sales are recorded. If you do not need more than one sales journal, just create a generic sales journal that will be the default journal to be used for all made sales.</field>
</record>
<menuitem id="menu_definition_journal" name="Sales Journals" parent="menu_sale_journal_config" action="action_definition_journal" sequence="70"/>
<menuitem id="menu_definition_journal_invoice_type"
parent="sale.menu_config_sale" action="action_definition_journal_invoice_type"/>
<!-- Inherit sales order form view -->
@ -159,11 +55,7 @@
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<field name="origin" position="after">
<group colspan="2" col="2">
<separator string="Journal" colspan="4"/>
<field name="journal_id" select="1" widget="selection" domain="[('state','in', ('draft', 'open'))]"/>
<field name="invoice_type_id" select="1" widget="selection"/>
</group>
<field name="invoice_type_id" widget="selection"/>
</field>
</field>
</record>
@ -177,8 +69,7 @@
<field name="inherit_id" ref="sale.view_order_tree" />
<field name="arch" type="xml">
<field name="state" position="after">
<field name="invoice_type_id"/>
<field name="journal_id"/>
<field name="invoice_type_id" widget="selection"/>
</field>
</field>
</record>
@ -192,9 +83,7 @@
<field name="inherit_id" ref="stock.view_picking_form" />
<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 name="invoice_type_id" widget="selection"/>
</field>
</field>
</record>
@ -208,9 +97,7 @@
<field name="inherit_id" ref="stock.vpicktree" />
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
<field name="sale_journal_id" select="1"/>
</field>
</field>
</record>
@ -222,8 +109,6 @@
<field name="inherit_id" ref="stock.view_picking_in_form" />
<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>
@ -236,9 +121,7 @@
<field name="inherit_id" ref="stock.view_picking_in_tree" />
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
<field name="sale_journal_id" select="1"/>
</field>
</field>
</record>
@ -250,8 +133,6 @@
<field name="inherit_id" ref="stock.view_picking_out_form" />
<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>
@ -264,73 +145,11 @@
<field name="inherit_id" ref="stock.view_picking_out_tree" />
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
<field name="sale_journal_id" select="1"/>
</field>
</field>
</record>
<!-- Action of sale journal report in sale journal -->
<act_window name="Monthly sales"
context="{'search_default_journal_id': active_id}"
res_model="sale.journal.report"
src_model="sale_journal.sale.journal"
id="act_sale_journal_sale_journal_2_sale_journal_sale_stats"/>
<!-- Action of stock picking in picking journal -->
<act_window name="Assigned picking"
domain="[('state', '=', 'assigned')]"
context="{'search_default_journal_id': [active_id]}"
res_model="stock.picking"
src_model="sale_journal.picking.journal"
id="act_sale_journal_picking_journal_2_stock_picking_assigned"/>
<!-- Action of stock picking in picking journal -->
<act_window name="Confirmed picking"
domain="[('state', '=', 'confirmed')]"
context="{'search_default_journal_id': [active_id]}"
res_model="stock.picking"
src_model="sale_journal.picking.journal"
id="act_sale_journal_picking_journal_2_stock_picking_confirmed"/>
<!-- Action of stock picking in sale journal -->
<act_window name="Assigned picking"
domain="[('state', '=', 'assigned')]"
context="{'search_default_sale_journal_id': [active_id]}"
res_model="stock.picking"
src_model="sale_journal.sale.journal"
id="act_sale_journal_sale_journal_2_stock_picking_assigned"/>
<!-- Action of stock picking in sale journal -->
<act_window name="Confirmed picking"
domain="[('state', '=', 'confirmed')]"
context="{'search_default_sale_journal_id': [active_id]}"
res_model="stock.picking"
src_model="sale_journal.sale.journal"
id="act_sale_journal_sale_journal_2_stock_picking_confirmed"/>
<!-- Action of sale order in sale journal -->
<act_window name="Draft sales"
domain="[('journal_id', '=', active_id),('state', '=', 'draft')]"
res_model="sale.order"
src_model="sale_journal.sale.journal"
id="act_sale_journal_sale_journal_2_sale_order_draft"/>
<!-- Action of sale order in sale journal -->
<act_window name="Approved sales"
domain="[('journal_id', '=', active_id),('state', '=', 'approved')]"
res_model="sale.order"
src_model="sale_journal.sale.journal"
id="act_sale_journal_sale_journal_2_sale_order_approved"/>
<record id="view_partner_property_form" model="ir.ui.view">
<field name="name">res.partner.journal.property.form.inherit</field>
<field name="model">res.partner</field>
@ -338,161 +157,13 @@
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<page string="Sales &amp; Purchases" position="inside">
<field name="property_invoice_type"/>
<group colspan="2" col="2">
<separator string="Invoicing" colspan="2"/>
<field name="property_invoice_type" widget="selection"/>
</group>
</page>
</field>
</record>
<!--=====================================================-->
<!-- picking journal view-->
<!--===================================================== -->
<record model="ir.ui.view" id="view_picking_journal_form">
<field name="name">sale_journal.picking.journal.form</field>
<field name="model">sale_journal.picking.journal</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Picking Journal">
<group colspan="4" col="6">
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="user_id" select="1"/>
<newline/>
<field name="date" select="1"/>
<field name="date_created" select="1"/>
<field name="date_close" select="1"/>
</group>
<notebook colspan="4">
<page string="Picking">
<field name="picking_stats_ids" colspan="4" nolabel="1"/>
</page>
<page string="Notes">
<field name="note" colspan="4" nolabel="1"/>
</page>
</notebook>
<field name="state"/>
<group col="6" colspan="2">
<button name="button_open" string="Open Journal" states="draft" type="object" icon="terp-check"/>
<button string="Confirm Picking" name="button_picking_confirm" states="open" type="object" icon="terp-camera_test"/>
<button name="button_reset" string="Set to Draft" states="cancel" type="object" icon="gtk-convert"/>
<button name="button_close" string="Close Journal" states="confirm,open" type="object" icon="terp-dialog-close"/>
<button string="Cancel Picking" name="button_picking_cancel" states="close,draft,open,confirm" type="object" icon="gtk-cancel"/>
</group>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_picking_journal_tree">
<field name="name">sale_journal.picking.journal.tree</field>
<field name="model">sale_journal.picking.journal</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Picking Journal">
<field name="name"/>
<field name="code"/>
<field name="user_id"/>
<field name="date"/>
<field name="state"/>
</tree>
</field>
</record>
<!-- Picking journal tree view -->
<record model="ir.ui.view" id="view_picking_journal_search">
<field name="name">sale_journal.picking.journal.search</field>
<field name="model">sale_journal.picking.journal</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Picking Journals">
<group col="8" colspan="4">
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Picking Journals which are in draft state"/>
<filter icon="terp-check" string="Open" domain="[('state','=','open')]" help="Open Picking Journals"/>
<filter icon="gtk-cancel" string="Cancel" domain="[('state','=','cancel')]" help="Picking Journals which are cancelled"/>
<filter icon="terp-dialog-close" string="Close" domain="[('state','=','done')]" help="Picking Journals which are closed"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="code"/>
<field name="user_id"/>
<field name="date"/>
</group>
</search>
</field>
</record>
<!-- Action of Picking journals -->
<record model="ir.actions.act_window" id="action_definition_picking_journal">
<field name="name">Picking Journals</field>
<field name="res_model">sale_journal.picking.journal</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="context">{'search_default_user_id':uid}</field>
<field name="search_view_id" ref="view_picking_journal_search"/>
</record>
<menuitem name="Picking Journals" id="menu_definition_journal_picking" parent="stock.menu_warehouse_config" action="action_definition_picking_journal"/>
<record model="ir.actions.act_window" id="action_invoice_type_tree">
<field name="name">Picking by invoice_method</field>
<field name="res_model">sale_journal.invoice.type</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">tree</field>
</record>
<record model="ir.actions.act_window" id="action_invoice_type_picking_open">
<field name="name">Picking to invoice</field>
<field name="res_model">stock.picking</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('state','=','done'),('invoice_state','=','2binvoiced'),('invoice_type_id','=',active_id)]</field>
</record>
<record model="ir.values" id="ir_open_invoice_type">
<field name="key2">tree_but_open</field>
<field name="model">sale_journal.invoice.type</field>
<field name="name">Picking to invoice</field>
<field name="value" eval="'ir.actions.act_window,%d'%action_invoice_type_picking_open"/>
<field name="object" eval="True"/>
</record>
<record id="view_picking_out_jorunal_search_form" model="ir.ui.view">
<field name="name">stock.picking.journal.search</field>
<field name="model">stock.picking</field>
<field name="type">search</field>
<field name="inherit_id" ref="stock.view_picking_out_search"/>
<field name="arch" type="xml">
<xpath expr="/search/group[@string='Group By...']/filter[@string='Partner']" position="after">
<filter string="Picking Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
</xpath>
</field>
</record>
<record id="view_picking_in_jorunal_search_form" model="ir.ui.view">
<field name="name">stock.picking.journal.search</field>
<field name="model">stock.picking</field>
<field name="type">search</field>
<field name="inherit_id" ref="stock.view_picking_in_search"/>
<field name="arch" type="xml">
<xpath expr="/search/group[@string='Group By...']/filter[@string='Partner']" position="after">
<filter string="Picking Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
</xpath>
</field>
</record>
<record id="view_picking_internal_jorunal_search_form" model="ir.ui.view">
<field name="name">stock.picking.journal.search</field>
<field name="model">stock.picking</field>
<field name="type">search</field>
<field name="inherit_id" ref="stock.view_picking_internal_search"/>
<field name="arch" type="xml">
<xpath expr="/search/group[@string='Group By...']/filter[@string='Origin']" position="after">
<filter string="Picking Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -1,13 +1,6 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_sale_journal_invoice_type_finance_invoice","sale_journal.invoice.type invoice","model_sale_journal_invoice_type","account.group_account_invoice",1,0,0,0
"access_sale_journal_invoice_type_finance_invoice","sale_journal.invoice.type invoice","model_sale_journal_invoice_type","account.group_account_invoice",1,1,1,1
"access_sale_journal_invoice_type_partner_manager","sale_journal.invoice.type partner manager","model_sale_journal_invoice_type","base.group_partner_manager",1,0,0,0
"access_sale_journal_invoice_type_salesman","sale_journal.invoice.type salesman","model_sale_journal_invoice_type","base.group_sale_salesman",1,0,0,0
"access_sale_journal_sale_journal","sale_journal.sale.journal","model_sale_journal_sale_journal","base.group_sale_salesman",1,0,0,0
"access_sale_journal_invoice_type_manager","sale_journal.invoice.type.manager","model_sale_journal_invoice_type","base.group_sale_manager",1,1,1,1
"access_sale_journal_sale_journal_manager","sale_journal.sale.journal.manager","model_sale_journal_sale_journal","base.group_sale_manager",1,1,1,1
"access_sale_journal_picking_journal_manager","sale_journal.picking.journal.manager","model_sale_journal_picking_journal","base.group_sale_manager",1,1,1,1
"access_sale_journal_sale_journal_stock_worker","sale_journal.sale.journal stock worker","model_sale_journal_sale_journal","stock.group_stock_user",1,0,0,0
"access_sale_journal_picking_journal_stock_worker","sale_journal.picking.journal stock worker","model_sale_journal_picking_journal","stock.group_stock_user",1,0,0,0
"access_sale_journal_invoice_type_stock_worker","sale_journal.invoice_type stock worker","model_sale_journal_invoice_type","stock.group_stock_user",1,0,0,0
"access_sale_journal_sale_journal_report_manager","sale_journal_sale_journal_report_manager","model_sale_journal_report","base.group_sale_manager",1,1,1,1
"access_sale_journal_picking_report","sale_journal_picking_report","model_sale_journal_picking_report","stock.group_stock_manager",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_sale_journal_invoice_type_finance_invoice sale_journal.invoice.type invoice model_sale_journal_invoice_type account.group_account_invoice 1 0 1 0 1 0 1
3 access_sale_journal_invoice_type_partner_manager sale_journal.invoice.type partner manager model_sale_journal_invoice_type base.group_partner_manager 1 0 0 0
4 access_sale_journal_invoice_type_salesman sale_journal.invoice.type salesman model_sale_journal_invoice_type base.group_sale_salesman 1 0 0 0
access_sale_journal_sale_journal sale_journal.sale.journal model_sale_journal_sale_journal base.group_sale_salesman 1 0 0 0
5 access_sale_journal_invoice_type_manager sale_journal.invoice.type.manager model_sale_journal_invoice_type base.group_sale_manager 1 1 1 1
access_sale_journal_sale_journal_manager sale_journal.sale.journal.manager model_sale_journal_sale_journal base.group_sale_manager 1 1 1 1
access_sale_journal_picking_journal_manager sale_journal.picking.journal.manager model_sale_journal_picking_journal base.group_sale_manager 1 1 1 1
access_sale_journal_sale_journal_stock_worker sale_journal.sale.journal stock worker model_sale_journal_sale_journal stock.group_stock_user 1 0 0 0
access_sale_journal_picking_journal_stock_worker sale_journal.picking.journal stock worker model_sale_journal_picking_journal stock.group_stock_user 1 0 0 0
6 access_sale_journal_invoice_type_stock_worker sale_journal.invoice_type stock worker model_sale_journal_invoice_type stock.group_stock_user 1 0 0 0
access_sale_journal_sale_journal_report_manager sale_journal_sale_journal_report_manager model_sale_journal_report base.group_sale_manager 1 1 1 1
access_sale_journal_picking_report sale_journal_picking_report model_sale_journal_picking_report stock.group_stock_manager 1 1 1 1

View File

@ -1,87 +0,0 @@
-
In order to test the sale_journal module in OpenERP,
I create a picking journal
-
!record {model: sale_journal.picking.journal, id: sale_journal_picking_journal_pickjournal0}:
code: PJ
date: '2010-08-04'
date_created: '2010-08-04'
name: Pick_journal
state: draft
user_id: base.user_root
-
I create a picking for product keyboard, quantity 50
-
!record {model: stock.picking, id: stock_picking_out0}:
address_id: base.res_partner_address_6
company_id: base.main_company
invoice_state: none
journal_id: sale_journal_picking_journal_pickjournal0
move_lines:
- company_id: base.main_company
date_expected: '2010-08-04 14:09:38'
date: '2010-08-04 14:09:38'
location_id: stock.stock_location_stock
product_id: product.product_product_24
product_qty: 50.0
product_uom: product.product_uom_unit
location_dest_id: stock.stock_location_customers
name: '[KEYA] Keyboard - AZERTY'
product_uos_qty: 50.0
move_type: direct
name: OUT/00007
type: out
-
I verify that a Journal consist of picking order
-
!python {model: sale_journal.picking.journal}: |
pick_jour = self.browse(cr, uid, ref("sale_journal_picking_journal_pickjournal0"))
assert pick_jour.picking_stats_ids, "Journal does not consist of a picking order"
-
Then I click on the 'Open Journal' button
-
!python {model: sale_journal.picking.journal}: |
self.button_open(cr, uid, [ref("sale_journal_picking_journal_pickjournal0")], {"lang": "en_US", "search_default_user_id":
1, "tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("sale_journal.menu_definition_journal_picking")],
"active_id": ref("sale_journal.menu_definition_journal_picking")})
-
I verify that a state of journal has transit from draft to open state
-
!python {model: sale_journal.picking.journal}: |
pick_jour = self.browse(cr, uid, ref("sale_journal_picking_journal_pickjournal0"))
assert (pick_jour.state == 'open'), "Journal is not in the open state"
-
Then I click on the 'Confirm Picking' button
-
!python {model: sale_journal.picking.journal}: |
self.button_picking_confirm(cr, uid, [ref("sale_journal_picking_journal_pickjournal0")], {"lang": "en_US", "search_default_user_id":
1, "tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("sale_journal.menu_definition_journal_picking")],
"active_id": ref("sale_journal.menu_definition_journal_picking")})
-
I verify that a state of journal has transit from open to confirm state
-
!python {model: sale_journal.picking.journal}: |
pick_jour = self.browse(cr, uid, ref("sale_journal_picking_journal_pickjournal0"))
assert (pick_jour.state == 'confirm'), "Journal is not in the open state"
-
I verify that an picking order is now in the confirm state
-
!python {model: stock.picking}: |
pick_jour_obj = self.pool.get('sale_journal.picking.journal')
jour = pick_jour_obj.browse(cr, uid, ref("sale_journal_picking_journal_pickjournal0"))
stock_pick = self.browse(cr, uid, ref("stock_picking_out0"))
pick_jour = self.search(cr, uid, [('journal_id','=',jour.name) and ('state','=','confirmed')])
assert pick_jour, "Sale order is not in the confirm state"
-
Then I click on the 'Close Journal' button
-
!python {model: sale_journal.picking.journal}: |
self.button_close(cr, uid, [ref("sale_journal_picking_journal_pickjournal0")], {"lang": "en_US", "search_default_user_id":
1, "tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("sale_journal.menu_definition_journal_picking")],
"active_id": ref("sale_journal.menu_definition_journal_picking")})
-
I verify that a state of journal has transit from confirm to close state
-
!python {model: sale_journal.picking.journal}: |
pick_jour = self.browse(cr, uid, ref("sale_journal_picking_journal_pickjournal0"))
assert (pick_jour.state == 'close'), "Journal is not in the open state"

View File

@ -1,95 +0,0 @@
-
In order to test the sale_journal module in OpenERP,
I create a sale journal and place a sale order related to a journal
-
I create a sale journal
-
!record {model: sale_journal.sale.journal, id: sale_journal_sale_journal_journal0}:
code: J1
date: '2010-08-04'
date_created: '2010-08-04'
name: Journal_1
state: draft
user_id: base.user_root
-
I place a sale order for product keyboard, quantity 100
-
!record {model: sale.order, id: sale_order_so0}:
date_order: '2010-08-04'
invoice_quantity: order
invoice_type_id: sale_journal.daily
journal_id: sale_journal_sale_journal_journal0
name: Test_SO012
order_line:
- name: '[KEYA] Keyboard - AZERTY'
price_unit: 7.0
product_uom: product.product_uom_unit
product_uom_qty: 100.0
state: draft
delay: 7.0
product_id: product.product_product_24
product_uos_qty: 100.0
th_weight: 0.0
type: make_to_stock
order_policy: manual
partner_id: base.res_partner_4
partner_invoice_id: base.res_partner_address_7
partner_order_id: base.res_partner_address_7
partner_shipping_id: base.res_partner_address_7
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I verify that a Journal consist of sale order
-
!python {model: sale_journal.sale.journal}: |
sal_jour = self.browse(cr, uid, ref("sale_journal_sale_journal_journal0"))
assert sal_jour.sale_stats_ids, "Journal does not consist of a sale order details"
-
Then I click on the 'Open Journal' button
-
!python {model: sale_journal.sale.journal}: |
self.button_open(cr, uid, [ref("sale_journal_sale_journal_journal0")], {"lang": "en_US", "search_default_user_id":
1, "tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("sale_journal.menu_definition_journal")],
"active_id": ref("sale_journal.menu_definition_journal")})
-
I verify that a state of journal has transit from draft to open state
-
!python {model: sale_journal.sale.journal}: |
sal_jour = self.browse(cr, uid, ref("sale_journal_sale_journal_journal0"))
assert (sal_jour.state == 'open'), "Journal is not in the open state"
-
Then I click on the 'Confirm Sales' button
-
!python {model: sale_journal.sale.journal}: |
self.button_sale_confirm(cr, uid, [ref("sale_journal_sale_journal_journal0")], {"lang": "en_US", "search_default_user_id":
1, "tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("sale_journal.menu_definition_journal")],
"active_id": ref("sale_journal.menu_definition_journal")})
-
I verify that a state of journal has transit from open to confirm state
-
!python {model: sale_journal.sale.journal}: |
sal_jour = self.browse(cr, uid, ref("sale_journal_sale_journal_journal0"))
assert (sal_jour.state == 'confirm'), "Journal is not in the confirm state"
-
I verify that a sale order is now in the confirm state
-
!python {model: sale.order}: |
sale_jour_obj = self.pool.get('sale_journal.sale.journal')
jour = sale_jour_obj.browse(cr, uid, ref("sale_journal_sale_journal_journal0"))
so = self.browse(cr, uid, ref("sale_order_so0"))
so_jour = self.search(cr, uid, [('journal_id','=',jour.name) and ('state','=','manual')])
assert so_jour, "Sale order is not in the confirm state"
-
Then I click on the 'Close Journal' button
-
!python {model: sale_journal.sale.journal}: |
self.button_close(cr, uid, [ref("sale_journal_sale_journal_journal0")], {"lang": "en_US", "search_default_user_id":
1, "tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("sale_journal.menu_definition_journal")],
"active_id": ref("sale_journal.menu_definition_journal")})
-
I verify that a state of journal has transit from confirm to close state
-
!python {model: sale_journal.sale.journal}: |
sal_jour = self.browse(cr, uid, ref("sale_journal_sale_journal_journal0"))
assert (sal_jour.state == 'close'), "Journal is not in the close state"