[IMP] procurement,purchase,purchase_requisition,sale,sale_journal:Improvements made as per the testing

bzr revid: mtr@mtr-20100621135911-rudvobfa6o090s1o
This commit is contained in:
mtr 2010-06-21 19:29:11 +05:30
parent 0a9b1024bf
commit f8ed9066ad
16 changed files with 73 additions and 62 deletions

View File

@ -58,7 +58,7 @@
<button name="button_confirm" states="draft" string="Confirm" icon="gtk-apply"/>
<button name="button_restart" states="exception" string="Retry" icon="gtk-convert"/>
<button name="button_cancel" states="draft,exception,waiting" string="Cancel" icon="gtk-cancel"/>
<button name="button_check" states="confirmed" string="Run Procurement" icon="gtk-media-play"/>
<button name="button_check" states="confirmed" string="Run Procurement" icon="gtk-media-play"/>
</group>
</page>
<page string="Extra Information">

View File

@ -37,9 +37,7 @@ class procurement_order(osv.osv):
context = {}
if use_new_cursor:
print 'Cursor New', cr,
cr = pooler.get_db(use_new_cursor).cursor()
print cr
cr = pooler.get_db(use_new_cursor).cursor()
wf_service = netsvc.LocalService("workflow")
procurement_obj = self.pool.get('procurement.order')
@ -124,7 +122,6 @@ class procurement_order(osv.osv):
})
if use_new_cursor:
cr.commit()
print 'Cursor Close', cr
cr.close()
return {}
@ -175,9 +172,7 @@ class procurement_order(osv.osv):
if not context:
context = {}
if use_new_cursor:
print 'Cursor New', cr,
cr = pooler.get_db(use_new_cursor).cursor()
print cr
cr = pooler.get_db(use_new_cursor).cursor()
orderpoint_obj = self.pool.get('stock.warehouse.orderpoint')
location_obj = self.pool.get('stock.location')
procurement_obj = self.pool.get('procurement.order')
@ -241,7 +236,6 @@ class procurement_order(osv.osv):
})
if use_new_cursor:
cr.commit()
print 'Cursor Close', cr
cr.close()
return {}
procurement_order()

View File

@ -1,11 +1,12 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_mrp_property_group","mrp.property.group","model_mrp_property_group",stock.group_stock_manager,1,1,1,1
"access_mrp_property","mrp.property","model_mrp_property",stock.group_stock_manager,1,1,1,1
"access_mrp_property_group","mrp.property.group","model_mrp_property_group","stock.group_stock_manager",1,1,1,1
"access_mrp_property","mrp.property","model_mrp_property","stock.group_stock_manager",1,1,1,1
"access_mrp_property_group","mrp.property.group","model_mrp_property_group",,1,0,0,0
"access_mrp_property","mrp.property","model_mrp_property",base.group_user,1,0,0,0
"access_procurement","procurement.order","model_procurement_order",base.group_user,1,0,0,0
"access_stock_warehouse_orderpoint","stock.warehouse.orderpoint","model_stock_warehouse_orderpoint",stock.group_stock_manager,1,1,1,1
"access_procurement_compute_all","procurement.order.compute.all","model_procurement_order_compute_all",stock.group_stock_manager,1,1,1,1
"access_procurement_orderpoint_compute","procurement.orderpoint.compute","model_procurement_orderpoint_compute",stock.group_stock_manager,1,1,1,1
"access_mrp_make_procurement","make.procurement","model_make_procurement",stock.group_stock_manager,1,1,1,1
"access_mrp_make_procurement","procurement.order.compute","model_procurement_order_compute",stock.group_stock_manager,1,1,1,1
"access_mrp_property","mrp.property","model_mrp_property","base.group_user",1,0,0,0
"access_procurement","procurement.order","model_procurement_order","base.group_user",1,0,0,0
"access_stock_warehouse_orderpoint","stock.warehouse.orderpoint","model_stock_warehouse_orderpoint","stock.group_stock_manager",1,1,1,1
"access_procurement_compute_all","procurement.order.compute.all","model_procurement_order_compute_all","stock.group_stock_manager",1,1,1,1
"access_procurement_orderpoint_compute","procurement.orderpoint.compute","model_procurement_orderpoint_compute","stock.group_stock_manager",1,1,1,1
"access_mrp_make_procurement","make.procurement","model_make_procurement","stock.group_stock_manager",1,1,1,1
"access_mrp_make_procurement","procurement.order.compute","model_procurement_order_compute","stock.group_stock_manager",1,1,1,1
"access_make_procurement","make.procurement","model_make_procurement","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_mrp_property_group mrp.property.group model_mrp_property_group stock.group_stock_manager 1 1 1 1
3 access_mrp_property mrp.property model_mrp_property stock.group_stock_manager 1 1 1 1
4 access_mrp_property_group mrp.property.group model_mrp_property_group 1 0 0 0
5 access_mrp_property mrp.property model_mrp_property base.group_user 1 0 0 0
6 access_procurement procurement.order model_procurement_order base.group_user 1 0 0 0
7 access_stock_warehouse_orderpoint stock.warehouse.orderpoint model_stock_warehouse_orderpoint stock.group_stock_manager 1 1 1 1
8 access_procurement_compute_all procurement.order.compute.all model_procurement_order_compute_all stock.group_stock_manager 1 1 1 1
9 access_procurement_orderpoint_compute procurement.orderpoint.compute model_procurement_orderpoint_compute stock.group_stock_manager 1 1 1 1
10 access_mrp_make_procurement make.procurement model_make_procurement stock.group_stock_manager 1 1 1 1
11 access_mrp_make_procurement procurement.order.compute model_procurement_order_compute stock.group_stock_manager 1 1 1 1
12 access_make_procurement make.procurement model_make_procurement stock.group_stock_manager 1 1 1 1

View File

@ -45,10 +45,8 @@ class procurement_compute_all(osv.osv_memory):
"""
proc_obj = self.pool.get('procurement.order')
for proc in self.browse(cr, uid, ids):
print 'Cursor', cr
proc_obj.run_scheduler(cr, uid, automatic=proc.automatic, use_new_cursor=cr.dbname,\
context=context)
print 'Cursor', cr
context=context)
return {}
def procure_calculation(self, cr, uid, ids, context):

View File

@ -148,13 +148,13 @@ class purchase_order(osv.osv):
return res
_columns = {
'name': fields.char('Order Reference', size=64, required=True, select=True),
'name': fields.char('Order Reference', size=64, required=True, select=True, help="unique number of the purchase order,computed automatically when the purchase order is created"),
'origin': fields.char('Source Document', size=64,
help="Reference of the document that generated this purchase order request."
),
'partner_ref': fields.char('Supplier Reference', size=64),
'date_order':fields.date('Date Ordered', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)]}, help="Date on which this document has been created."),
'date_approve':fields.date('Date Approved', readonly=1),
'date_approve':fields.date('Date Approved', readonly=1, help="Date on which purchase order has been approved"),
'partner_id':fields.many2one('res.partner', 'Supplier', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, change_default=True),
'partner_address_id':fields.many2one('res.partner.address', 'Address', required=True, states={'posted':[('readonly',True)]}),
'dest_address_id':fields.many2one('res.partner.address', 'Destination Address', states={'posted':[('readonly',True)]},
@ -168,11 +168,11 @@ class purchase_order(osv.osv):
'order_line': fields.one2many('purchase.order.line', 'order_id', 'Order Lines', states={'approved':[('readonly',True)],'done':[('readonly',True)]}),
'validator' : fields.many2one('res.users', 'Validated by', readonly=True),
'notes': fields.text('Notes'),
'invoice_id': fields.many2one('account.invoice', 'Invoice', readonly=True),
'invoice_id': fields.many2one('account.invoice', 'Invoice', readonly=True, help="An invoice generated for a purchase order"),
'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 purchase"),
'shipped':fields.boolean('Received', readonly=True, select=True),
'shipped':fields.boolean('Received', readonly=True, select=True, help="It indicates that a picking has been done"),
'shipped_rate': fields.function(_shipped_rate, method=True, string='Received', type='float'),
'invoiced': fields.function(_invoiced, method=True, string='Invoiced & Paid', type='boolean'),
'invoiced': fields.function(_invoiced, method=True, string='Invoiced & Paid', type='boolean', help="It indicates that an invoice has been paid"),
'invoiced_rate': fields.function(_invoiced_rate, method=True, string='Invoiced', type='float'),
'invoice_method': fields.selection([('manual','Manual'),('order','From Order'),('picking','From Picking')], 'Invoicing Control', required=True,
help="From Order: a draft invoice will be pre-generated based on the purchase order. The accountant " \
@ -184,15 +184,15 @@ class purchase_order(osv.osv):
'amount_untaxed': fields.function(_amount_all, method=True, digits_compute= dp.get_precision('Purchase Price'), string='Untaxed Amount',
store={
'purchase.order.line': (_get_order, None, 10),
}, multi="sums"),
}, multi="sums", help="The amount without tax"),
'amount_tax': fields.function(_amount_all, method=True, digits_compute= dp.get_precision('Purchase Price'), string='Taxes',
store={
'purchase.order.line': (_get_order, None, 10),
}, multi="sums"),
}, multi="sums", help="The tax amount"),
'amount_total': fields.function(_amount_all, method=True, digits_compute= dp.get_precision('Purchase Price'), string='Total',
store={
'purchase.order.line': (_get_order, None, 10),
}, multi="sums"),
}, multi="sums",help="The total amount"),
'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position'),
'product_id': fields.related('order_line','product_id', type='many2one', relation='product.product', string='Product'),
'create_uid': fields.many2one('res.users', 'Responsible'),

View File

@ -169,7 +169,7 @@
<field name="arch" type="xml">
<search string="Search Purchase Order">
<group col='10' colspan='4'>
<filter icon="terp-document-new" name="draft" string="Quotations" domain="[('state','=','draft')]" separator="1" help="Quotations for purchase"/>
<filter icon="terp-document-new" name="draft" string="Quotations" domain="[('state','=','draft')]" separator="1" help="Purchase order which are in draft state"/>
<filter icon="terp-camera_test" name="confirmed" string="To Approve" domain="[('state','in',('wait','confirmed'))]" separator="1" help="Purchase order to be approved"/>
<filter icon="terp-check" name="approved" string="Approved" domain="[('state','in',('approved','done'))]" separator="1" help="Approved purchase order"/>
<filter icon="terp-emblem-important" name="exception" string="Exception" domain="[('state','in',('except_invoice','except_picking'))]" separator="1" help="Purchase order which are in the exception state"/>
@ -179,7 +179,7 @@
<field name="name" select="1" string="Reference"/>
<field name="partner_id" select="1"/>
<field name="product_id" select="1"/>
<field name="create_uid" select="1" default="1"/>
<field name="create_uid" select="1"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="10" groups="base.group_extended">
@ -220,7 +220,7 @@
<field name="type">ir.actions.act_window</field>
<field name="res_model">purchase.order</field>
<field name="view_type">form</field>
<field name="context">{'search_default_draft': 1,'search_create_uid':uid}</field>
<field name="context">{'search_default_draft': 1,'search_default_create_uid':uid}</field>
<field name="view_mode">tree,form,graph,calendar</field>
<field name="search_view_id" ref="view_purchase_order_filter"/>
</record>
@ -232,7 +232,7 @@
<field name="type">ir.actions.act_window</field>
<field name="res_model">purchase.order</field>
<field name="view_mode">tree,form,graph,calendar</field>
<field name="context">{'search_default_approved': 1,'search_create_uid':uid}</field>
<field name="context">{'search_default_approved': 1,'search_default_create_uid':uid}</field>
<field name="search_view_id" ref="view_purchase_order_filter"/>
</record>
<menuitem action="purchase_form_action" id="menu_purchase_form_action" parent="menu_procurement_management"/>
@ -307,14 +307,15 @@
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Purchase Order">
<group>
<group>
<field name='order_id'/>
<field name="product_id"/>
</group>
<newline/>
<group expand="0" string="Group By...">
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by' : 'state'}" />
<filter string="Order Reference" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by' : 'product_id'}" />
<filter string="Product" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by' : 'product_id'}" />
<filter icon="terp-gtk-jump-to-rtl" string="Order Reference" domain="[('group_by' : 'order_id')]"/>
</group>
</search>
</field>

View File

@ -35,11 +35,11 @@ class purchase_requisition(osv.osv):
'date_start': fields.datetime('Requisition Date'),
'date_end': fields.datetime('Requisition Deadline'),
'user_id': fields.many2one('res.users', 'Responsible'),
'exclusive': fields.selection([('exclusive','Purchase Tender (exclusive)'),('multiple','Multiple Requisitions')],'Requisition Type', help="If the requisition is exclusive, it will cancel all purchase orders when you confirm one of them", required=True),
'exclusive': fields.selection([('exclusive','Purchase Tender (exclusive)'),('multiple','Multiple Requisitions')],'Requisition Type', required=True, help="Purchase Tender (exclusive):On the confirmation of a purchase order, it cancels the remaining purchase order.Multiple Requisitions:It allows to have multiple purchase orders.On confirmation of a purchase order it does not cancel the remaining orders"""),
'description': fields.text('Description'),
'company_id': fields.many2one('res.company', 'Company', required=True),
'purchase_ids' : fields.one2many('purchase.order','requisition_id','Purchase Orders'),
'line_ids' : fields.one2many('purchase.requisition.line','requisition_id','Products to Purchase'),
'line_ids' : fields.one2many('purchase.requisition.line','requisition_id','Products to Purchase',states={'done': [('readonly', True)]}),
'state': fields.selection([('draft','Draft'),('in_progress','In Progress'),('cancel','Cancelled'),('done','Done')], 'State', required=True)
}
_defaults = {
@ -64,6 +64,9 @@ class purchase_requisition(osv.osv):
self.log(cr, uid, id, message)
return True
def tender_in_progress(self, cr, uid, ids, context={}):
for quotations in self.browse(cr, uid, ids):
if not quotations.purchase_ids:
raise osv.except_osv(_('Purchase order required'),('You should have atleast one purchase order line defined for this tender'))
self.write(cr, uid, ids, {'state':'in_progress'} ,context=context)
for (id,name) in self.name_get(cr, uid, ids):
message = _('Tender') + " '" + name + "' "+ _(" is In Progress")
@ -109,7 +112,7 @@ class purchase_requisition_line(osv.osv):
value = {'product_uom_id': ''}
if product_id:
prod = self.pool.get('product.product').browse(cr, uid, [product_id])[0]
value = {'product_uom_id': prod.uom_id.id}
value = {'product_uom_id': prod.uom_id.id,'product_qty':1.0}
return {'value': value}
_defaults = {

View File

@ -78,7 +78,7 @@
<field name="minimum_planned_date"/>
<field name="origin"/>
<field name="state"/>
</tree>
</tree>
</field>
<separator colspan="4" string=""/>
<group col="8" colspan="4">

View File

@ -204,7 +204,7 @@ class sale_order(osv.osv):
return result.keys()
_columns = {
'name': fields.char('Order Reference', size=64, required=True, select=True),
'name': fields.char('Order Reference', size=64, required=True, select=True, help="unique number of the sale order,computed automatically when the sale order is created"),
'shop_id': fields.many2one('sale.shop', 'Shop', required=True, readonly=True, states={'draft': [('readonly', False)]}),
'origin': fields.char('Source document', size=64, help="Reference of the document that generated this sale order request."),
'client_order_ref': fields.char('Customer Reference', size=64),
@ -220,15 +220,15 @@ class sale_order(osv.osv):
('cancel', 'Cancelled')
], 'Order State', readonly=True, help="Gives the state of the quotation or sale order. The exception state is automatically set when a cancel operation occurs in the invoice validation (Invoice Exception) or in the picking list process (Shipping Exception). The 'Waiting Schedule' state is set when the invoice is confirmed but waiting for the scheduler to run on the date 'Ordered Date'.", select=True),
'date_order': fields.date('Ordered Date', required=True, readonly=True, states={'draft': [('readonly', False)]}),
'create_date': fields.date('Creation Date', readonly=True),
'date_confirm': fields.date('Confirmation Date', readonly=True),
'create_date': fields.date('Creation Date', readonly=True, help="Date on which sale order is created"),
'date_confirm': fields.date('Confirmation Date', readonly=True, help="Date on which sale order is confirmed"),
'user_id': fields.many2one('res.users', 'Salesman', states={'draft': [('readonly', False)]}, select=True),
'partner_id': fields.many2one('res.partner', 'Customer', readonly=True, states={'draft': [('readonly', False)]}, required=True, change_default=True, select=True),
'partner_invoice_id': fields.many2one('res.partner.address', 'Invoice Address', readonly=True, required=True, states={'draft': [('readonly', False)]}),
'partner_invoice_id': fields.many2one('res.partner.address', 'Invoice Address', readonly=True, required=True, states={'draft': [('readonly', False)]}, help="Invoice address for current sale order"),
'partner_order_id': fields.many2one('res.partner.address', 'Ordering Contact', readonly=True, required=True, states={'draft': [('readonly', False)]}, help="The name and address of the contact who requested the order or quotation."),
'partner_shipping_id': fields.many2one('res.partner.address', 'Shipping Address', readonly=True, required=True, states={'draft': [('readonly', False)]}, help="Shipping address for current sale order"),
'incoterm': fields.selection(_incoterm_get, 'Incoterm', size=3),
'incoterm': fields.selection(_incoterm_get, 'Incoterm', size=3, help="Incoterm which stands for 'International Commercial terms' implies its a series of sales terms which are used in the commercial transaction"),
'picking_policy': fields.selection([('direct', 'Partial Delivery'), ('one', 'Complete Delivery')],
'Picking Policy', required=True, help="""If you don't have enough stock available to deliver all at once, do you accept partial shipments or not?"""),
'order_policy': fields.selection([
@ -243,16 +243,16 @@ class sale_order(osv.osv):
- The 'Invoice on Order After Delivery' choice will generate the draft invoice based on sale order after all picking lists have been finished.
- The 'Invoice from the picking' choice is used to create an invoice during the picking process."""),
'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="Pricelist version for current sale order"),
'project_id': fields.many2one('account.analytic.account', 'Analytic Account', readonly=True, states={'draft': [('readonly', False)]}),
'project_id': fields.many2one('account.analytic.account', 'Analytic Account', readonly=True, states={'draft': [('readonly', False)]}, help="The analytic account related to a sale order"),
'order_line': fields.one2many('sale.order.line', 'order_id', 'Order Lines', readonly=True, states={'draft': [('readonly', False)]}),
'invoice_ids': fields.many2many('account.invoice', 'sale_order_invoice_rel', 'order_id', 'invoice_id', 'Invoices', 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.one2many('stock.picking', 'sale_id', 'Related Picking', readonly=True, help="This is the list of picking list that have been generated for this invoice"),
'shipped': fields.boolean('Picked', readonly=True),
'shipped': fields.boolean('Picked', readonly=True, help="It indicates that a picking has been done.It will set to True if the ordered quantities are available and the picking is done.If the ordered quantities are not available it generates a Purchase/Manufacturing order.Unless its Picking and Purchase/Manufacturing order are not in the done state it wont be set to True"),
'picked_rate': fields.function(_picked_rate, method=True, string='Picked', type='float'),
'invoiced_rate': fields.function(_invoiced_rate, method=True, string='Invoiced', type='float'),
'invoiced': fields.function(_invoiced, method=True, string='Paid',
fnct_search=_invoiced_search, type='boolean'),
fnct_search=_invoiced_search, type='boolean', help="It indicates that an invoice has been paid"),
'note': fields.text('Notes'),
'amount_untaxed': fields.function(_amount_all, method=True, digits_compute= dp.get_precision('Sale Price'), string='Untaxed Amount',
@ -260,19 +260,19 @@ class sale_order(osv.osv):
'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 10),
'sale.order.line': (_get_order, ['price_unit', 'tax_id', 'discount', 'product_uom_qty'], 10),
},
multi='sums'),
multi='sums', help="The amount without tax"),
'amount_tax': fields.function(_amount_all, method=True, digits_compute= dp.get_precision('Sale Price'), string='Taxes',
store = {
'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 10),
'sale.order.line': (_get_order, ['price_unit', 'tax_id', 'discount', 'product_uom_qty'], 10),
},
multi='sums'),
multi='sums', help="The tax amount"),
'amount_total': fields.function(_amount_all, method=True, digits_compute= dp.get_precision('Sale Price'), string='Total',
store = {
'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 10),
'sale.order.line': (_get_order, ['price_unit', 'tax_id', 'discount', 'product_uom_qty'], 10),
},
multi='sums'),
multi='sums', help="The total amount"),
'invoice_quantity': fields.selection([('order', 'Ordered Quantities'), ('procurement', 'Shipped Quantities')], 'Invoice on', help="The sale order will automatically create the invoice proposition (draft invoice). Ordered and delivered quantities may not be the same. You have to choose if you invoice based on ordered or shipped quantities. If the product is a service, shipped quantities means hours spent on the associated tasks.", required=True),
'payment_term': fields.many2one('account.payment.term', 'Payment Term'),

View File

@ -168,7 +168,7 @@
states="confirmed"
string="Make Invoice"
type="action"
icon="gtk-print" />
icon="terp-document-new" />
</group>
</page>
<page groups="base.group_extended" string="Extra Info">
@ -202,7 +202,7 @@
<field name="amount_untaxed" sum="Untaxed amount"/>
<field name="amount_tax"/>
<field name="amount_total"/>
<button name="button_dummy" states="draft" string="" type="object" icon="gtk-execute"/>
<button name="button_dummy" states="draft" string="Compute" type="object" icon="gtk-execute"/>
<button name="%(action_view_sale_advance_payment_inv)d" string="Deposit" type="action" icon="gtk-execute"/>
</group>
<group col="13" colspan="4">
@ -212,7 +212,7 @@
<button name="invoice_corrected" states="invoice_except" string="Invoice Corrected" icon="gtk-apply"/>
<button name="ship_recreate" states="shipping_except" string="Recreate Procurement" icon="gtk-ok"/>
<button name="ship_corrected" states="shipping_except" string="Procurement Corrected" icon="gtk-apply"/>
<button name="manual_invoice" states="manual" string="Create Invoice" icon="gtk-print"/>
<button name="manual_invoice" states="manual" string="Create Invoice" icon="terp-document-new"/>
<button name="ship_cancel" states="shipping_except" string="Cancel Order" icon="gtk-cancel"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="gtk-convert"/>
<button name="action_cancel" states="manual,progress" string="Cancel Order" type="object" icon="gtk-cancel"/>
@ -220,7 +220,7 @@
<button name="invoice_cancel" states="invoice_except" string="Cancel Order" icon="gtk-cancel"/>
</group>
</page>
<page string="Other data">
<page string="Other Information">
<group colspan="2" col="2" groups="base.group_extended" name="logistic">
<separator string="Logistic" colspan="2"/>
<field name="incoterm"/>
@ -248,7 +248,7 @@
<field colspan="4" name="note" nolabel="1"/>
</page>
<page string="History" groups="base.group_extended">
<separator colspan="4" string="Related invoices"/>
<separator colspan="4" string="Related Invoices"/>
<field colspan="4" name="invoice_ids" nolabel="1" context="{'form_view_ref':'account.invoice_form'}"/>
<field colspan="4" name="picking_ids" nolabel="1"/>
</page>
@ -263,9 +263,9 @@
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Sales Order">
<filter icon="terp-document-new" string="Quotations" domain="[('state','=','draft')]"/>
<filter icon="terp-check" string="Running" domain="[('state','in',('manual','progress'))]"/>
<filter icon="terp-gtk-go-back-rtl" string="Sales To Invoice" domain="[('state','=','manual')]"/>
<filter icon="terp-document-new" string="Quotations" domain="[('state','=','draft')]" help="Sales order which are in draft state"/>
<filter icon="terp-check" string="Running" domain="[('state','in',('manual','progress'))]" help="Sales order which are confirmed"/>
<filter icon="terp-gtk-go-back-rtl" string="Sales To Invoice" domain="[('state','=','manual')]" help="Sales order to be invoiced"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="partner_id" select="1"/>
@ -399,7 +399,7 @@
name="%(action_view_sale_order_line_make_invoice)d"
string="Make Invoice"
type="action"
icon="gtk-print" />
icon="terp-document-new" />
<group col="2" colspan="2">
<button name="button_done"
states="confirmed,exception"

View File

@ -25,3 +25,9 @@
"access_sale_open_invoice_manager","sale.open.invoice","model_sale_open_invoice","group_sale_manager",1,1,1,1
"access_product_product_sale_user","product.product.sale.user","model_product_product","group_sale_user",1,0,0,0
"access_sale_account_journal","account.journal sale order.user","account.model_account_journal","group_sale_user",1,0,0,0
"access_sale_make_invoice_user","sale.make.invoice","model_sale_make_invoice","group_sale_user",1,0,0,0
"access_sale_make_invoice_manager","sale.make.invoice","model_sale_make_invoice","group_sale_manager",1,1,1,1
"access_sale_order_by_clients_user","sale.order.by.clients","model_sale_order_by_clients","group_sale_user",1,0,0,0
"access_sale_order_by_clients_manager","sale.order.by.clients","model_sale_order_by_clients","group_sale_manager",1,1,1,1
"access_sales_by_regions_user ","sales.by.regions","model_sales_by_regions","group_sale_user",1,0,0,0
"access_sales_by_regions_manager","sales.by.regions","model_sales_by_regions","group_sale_manager",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
25 access_sale_open_invoice_manager sale.open.invoice model_sale_open_invoice group_sale_manager 1 1 1 1
26 access_product_product_sale_user product.product.sale.user model_product_product group_sale_user 1 0 0 0
27 access_sale_account_journal account.journal sale order.user account.model_account_journal group_sale_user 1 0 0 0
28 access_sale_make_invoice_user sale.make.invoice model_sale_make_invoice group_sale_user 1 0 0 0
29 access_sale_make_invoice_manager sale.make.invoice model_sale_make_invoice group_sale_manager 1 1 1 1
30 access_sale_order_by_clients_user sale.order.by.clients model_sale_order_by_clients group_sale_user 1 0 0 0
31 access_sale_order_by_clients_manager sale.order.by.clients model_sale_order_by_clients group_sale_manager 1 1 1 1
32 access_sales_by_regions_user sales.by.regions model_sales_by_regions group_sale_user 1 0 0 0
33 access_sales_by_regions_manager sales.by.regions model_sales_by_regions group_sale_manager 1 1 1 1

View File

@ -53,6 +53,8 @@ class sale_journal(osv.osv):
'state': fields.selection([
('draft','Draft'),
('open','Open'),
('cancel','Cancel'),
('confirm','Confirm'),
('done','Done'),
], 'State', required=True, readonly=True),
'note': fields.text('Note'),
@ -65,6 +67,7 @@ class sale_journal(osv.osv):
}
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:
@ -76,6 +79,7 @@ class sale_journal(osv.osv):
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:

View File

@ -78,10 +78,10 @@
<field name="state"/>
<group col="6" colspan="2">
<button name="button_open" string="Open Journal" states="draft" type="object" icon="gtk-open"/>
<button name="button_close" string="Close Journal" states="open" type="object" icon="gtk-close"/>
<button name="button_draft" string="Set to Draft" states="close,open" type="object" icon="gtk-convert"/>
<button name="button_close" string="Close Journal" states="open,confirm" type="object" icon="gtk-close"/>
<button name="button_draft" string="Set to Draft" states="close,open,cancel" type="object" icon="gtk-convert"/>
<button string="Confirm Sales" name="button_sale_confirm" states="draft,open" type="object" icon="gtk-execute"/>
<button string="Cancel Sales" name="button_sale_cancel" states="draft,open" type="object" icon="gtk-cancel"/>
<button string="Cancel Sales" name="button_sale_cancel" states="draft,open,confirm" type="object" icon="gtk-cancel"/>
</group>
</form>
</field>

View File

@ -8,3 +8,7 @@
"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_report_user","sale_journal.sale.journal.report","model_sale_journal_report","sale.group_sale_user",1,0,0,0
"access_sale_journal_report_manager","sale_journal.sale.journal.report","model_sale_journal_report","sale.group_sale_manager",1,1,1,1
"access_sale_journal_picking_report_user","sale_journal.sale.journal.picking.report","model_sale_journal_picking_report","sale.group_sale_user",1,0,0,0
"access_sale_journal_picking_report_manager","sale_journal.sale.journal.picking.report","model_sale_journal_picking_report","sale.group_sale_manager",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
8 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
9 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
10 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
11 access_sale_journal_report_user sale_journal.sale.journal.report model_sale_journal_report sale.group_sale_user 1 0 0 0
12 access_sale_journal_report_manager sale_journal.sale.journal.report model_sale_journal_report sale.group_sale_manager 1 1 1 1
13 access_sale_journal_picking_report_user sale_journal.sale.journal.picking.report model_sale_journal_picking_report sale.group_sale_user 1 0 0 0
14 access_sale_journal_picking_report_manager sale_journal.sale.journal.picking.report model_sale_journal_picking_report sale.group_sale_manager 1 1 1 1