<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">
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')
})
if use_new_cursor:
cr.commit()
- print 'Cursor Close', cr
cr.close()
return {}
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')
})
if use_new_cursor:
cr.commit()
- print 'Cursor Close', cr
cr.close()
return {}
procurement_order()
"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
"""
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):
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)]},
'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 " \
'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'),
<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"/>
<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">
<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>
<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"/>
<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>
'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 = {
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")
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 = {
<field name="minimum_planned_date"/>
<field name="origin"/>
<field name="state"/>
- </tree>
+ </tree>
</field>
<separator colspan="4" string=""/>
<group col="8" colspan="4">
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),
('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([
- 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',
'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'),
states="confirmed"
string="Make Invoice"
type="action"
- icon="gtk-print" />
+ icon="terp-document-new" />
</group>
</page>
<page groups="base.group_extended" string="Extra Info">
<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">
<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"/>
<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"/>
<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>
<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"/>
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"
"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
'state': fields.selection([
('draft','Draft'),
('open','Open'),
+ ('cancel','Cancel'),
+ ('confirm','Confirm'),
('done','Done'),
], 'State', required=True, readonly=True),
'note': fields.text('Note'),
}
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:
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:
<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>
"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
+++ /dev/null
-# -*- 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 time
-from mx import DateTime
-class sale_order_dates(osv.osv):
- _inherit = 'sale.order'
- _name = 'sale.order'
-
- def _get_effective_date(self, cr, uid, ids, name, arg, context={}):
- res = {}
- dates_list = []
- for order in self.browse(cr, uid, ids):
- dates_list = []
- for pick in order.picking_ids:
- dates_list.append(pick.date)
- if dates_list:
- res[order.id] = min(dates_list)
- else:
- res[order.id] =False
- return res
-
- def _get_commitment_date(self, cr, uid, ids, name, arg, context={}):
- res = {}
- dates_list = []
- for order in self.browse(cr, uid, ids):
- dates_list = []
- for line in order.order_line:
- dt=DateTime.strptime(order.date_order, '%Y-%m-%d') + DateTime.RelativeDateTime(days=line.delay or 0.0)
- dt_s = dt.strftime('%Y-%m-%d')
- dates_list.append(dt_s)
- if dates_list:
- res[order.id] = min(dates_list)
- return res
-
- _columns = {
- 'commitment_date': fields.function(_get_commitment_date, method=True,store=True, type='date', string='Commitment Date'),
- 'requested_date': fields.date('Requested Date'),
- 'effective_date': fields.function(_get_effective_date, method=True, type='date', store=True,string='Effective Date'),
- }
-sale_order_dates()
-"""
- - date_commitment: min(fields.function using delay on SO lines +
- date_order)
- - date_requested: fields.date
- - Effective date: fields.function the first picking done.
-"""
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
--- /dev/null
+# -*- 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 time
+from mx import DateTime
+class sale_order_dates(osv.osv):
+ _inherit = 'sale.order'
+ _name = 'sale.order'
+
+ def _get_effective_date(self, cr, uid, ids, name, arg, context={}):
+ res = {}
+ dates_list = []
+ for order in self.browse(cr, uid, ids):
+ dates_list = []
+ for pick in order.picking_ids:
+ dates_list.append(pick.date)
+ if dates_list:
+ res[order.id] = min(dates_list)
+ else:
+ res[order.id] =False
+ return res
+
+ def _get_commitment_date(self, cr, uid, ids, name, arg, context={}):
+ res = {}
+ dates_list = []
+ for order in self.browse(cr, uid, ids):
+ dates_list = []
+ for line in order.order_line:
+ dt=DateTime.strptime(order.date_order, '%Y-%m-%d') + DateTime.RelativeDateTime(days=line.delay or 0.0)
+ dt_s = dt.strftime('%Y-%m-%d')
+ dates_list.append(dt_s)
+ if dates_list:
+ res[order.id] = min(dates_list)
+ return res
+
+ _columns = {
+ 'commitment_date': fields.function(_get_commitment_date, method=True,store=True, type='date', string='Commitment Date'),
+ 'requested_date': fields.date('Requested Date'),
+ 'effective_date': fields.function(_get_effective_date, method=True, type='date', store=True,string='Effective Date'),
+ }
+sale_order_dates()
+"""
+ - date_commitment: min(fields.function using delay on SO lines +
+ date_order)
+ - date_requested: fields.date
+ - Effective date: fields.function the first picking done.
+"""
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
--- /dev/null
+<?xml version="1.0"?>
+<openerp>
+ <data>
+
+ <record id="view_sale_orderfor" model="ir.ui.view">
+ <field name="name">sale.order.form.inherit5</field>
+ <field name="model">sale.order</field>
+ <field name="type">form</field>
+ <field name="inherit_id" ref="sale.view_order_form"/>
+ <field name="arch" type="xml">
+ <field name="date_confirm" position="after">
+ <field name="commitment_date"/>
+ <field name="effective_date"/>
+ <field name="requested_date"/>
+ </field>
+ </field>
+ </record>
+
+
+ </data>
+</openerp>
+++ /dev/null
-<?xml version="1.0"?>
-<openerp>
- <data>
-
- <record id="view_sale_orderfor" model="ir.ui.view">
- <field name="name">sale.order.form.inherit5</field>
- <field name="model">sale.order</field>
- <field name="type">form</field>
- <field name="inherit_id" ref="sale.view_order_form"/>
- <field name="arch" type="xml">
- <field name="date_confirm" position="after">
- <field name="commitment_date"/>
- <field name="effective_date"/>
- <field name="requested_date"/>
- </field>
- </field>
- </record>
-
-
- </data>
-</openerp>