[IMP] Improved code by shifting the complete code to website_sale rather than doing in sale.
This commit is contained in:
parent
2df2f77818
commit
e5229ee8c3
|
@ -170,7 +170,6 @@ class sale_order(osv.osv):
|
|||
'client_order_ref': fields.char('Customer Reference', size=64),
|
||||
'state': fields.selection([
|
||||
('draft', 'Draft Quotation'),
|
||||
('shopping_cart', 'Shopping Cart'),
|
||||
('sent', 'Quotation Sent'),
|
||||
('cancel', 'Cancelled'),
|
||||
('waiting_date', 'Waiting Schedule'),
|
||||
|
|
|
@ -80,14 +80,14 @@
|
|||
<button name="action_quotation_send" string="Send by Email" type="object" states="sent,progress,manual" groups="base.group_user"/>
|
||||
<button name="print_quotation" string="Print" type="object" states="draft" class="oe_highlight" groups="base.group_user"/>
|
||||
<button name="print_quotation" string="Print" type="object" states="sent,progress,manual" groups="base.group_user"/>
|
||||
<button name="action_button_confirm" states="draft,shopping_cart" string="Confirm Sale" type="object" groups="base.group_user"/>
|
||||
<button name="action_button_confirm" states="draft" string="Confirm Sale" type="object" groups="base.group_user"/>
|
||||
<button name="action_button_confirm" states="sent" string="Confirm Sale" class="oe_highlight" type="object" groups="base.group_user"/>
|
||||
<button name="action_view_invoice" string="View Invoice" type="object" class="oe_highlight"
|
||||
attrs="{'invisible': [('invoice_exists', '=', False)]}" groups="base.group_user"/>
|
||||
<button name="%(action_view_sale_advance_payment_inv)d" string="Create Invoice"
|
||||
type="action" states="manual" class="oe_highlight" groups="base.group_user"/>
|
||||
<button name="copy_quotation" states="cancel" string="New Copy of Quotation" type="object"/>
|
||||
<button name="cancel" states="draft,shopping_cart,sent" string="Cancel Quotation" groups="base.group_user"/>
|
||||
<button name="cancel" states="draft,sent" string="Cancel Quotation" groups="base.group_user"/>
|
||||
<button name="action_cancel" states="manual,progress" string="Cancel Order" type="object" groups="base.group_user"/>
|
||||
<button name="invoice_cancel" states="invoice_except" string="Cancel Order" groups="base.group_user"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,sent,progress,done" statusbar_colors='{"invoice_except":"red","waiting_date":"blue"}'/>
|
||||
|
@ -277,7 +277,7 @@
|
|||
'search_default_my_sale_orders_filter': 1
|
||||
}
|
||||
</field>
|
||||
<field name="domain">[('state', 'not in', ('draft', 'shopping_cart', 'sent', 'cancel'))]</field>
|
||||
<field name="domain">[('state', 'not in', ('draft', 'sent', 'cancel'))]</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a quotation that can be converted into a sales
|
||||
|
@ -321,7 +321,7 @@
|
|||
<field name="view_id" ref="view_quotation_tree"/>
|
||||
<field name="view_mode">tree,form,calendar,graph</field>
|
||||
<field name="context">{'search_default_my_sale_orders_filter': 1}</field>
|
||||
<field name="domain">[('state','in',('draft','shopping_cart','sent','cancel'))]</field>
|
||||
<field name="domain">[('state','in',('draft','sent','cancel'))]</field>
|
||||
<field name="search_view_id" ref="view_sales_order_filter"/>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import uuid
|
||||
from openerp.osv import orm, fields
|
||||
from openerp.osv import orm, osv, fields
|
||||
from openerp.addons.web.http import request
|
||||
from openerp import SUPERUSER_ID
|
||||
|
||||
|
@ -147,7 +147,7 @@ class Website(orm.Model):
|
|||
quotation_values = self._ecommerce_get_quotation_values(cr, uid, context=context)
|
||||
quotation_values['user_id'] = False
|
||||
quotation_values['section_id'] = self.pool.get('crm.case.section').search(cr, SUPERUSER_ID, [('code', '=', 'SPC')], context=context)[0]
|
||||
# quotation_values['state'] = 'shopping_cart'
|
||||
quotation_values['state'] = 'shopping_cart'
|
||||
return SaleOrder.create(cr, SUPERUSER_ID, quotation_values, context=context)
|
||||
|
||||
def ecommerce_get_new_order(self, cr, uid, context=None):
|
||||
|
@ -222,3 +222,21 @@ class Website(orm.Model):
|
|||
|
||||
def ecommerce_get_product_domain(self):
|
||||
return [("sale_ok", "=", True),("product_variant_ids","!=",False)]
|
||||
|
||||
class sale_order(osv.osv):
|
||||
_inherit = "sale.order"
|
||||
|
||||
_columns = {
|
||||
'state': fields.selection([
|
||||
('draft', 'Draft Quotation'),
|
||||
('shopping_cart', 'Shopping Cart'),
|
||||
('sent', 'Quotation Sent'),
|
||||
('cancel', 'Cancelled'),
|
||||
('waiting_date', 'Waiting Schedule'),
|
||||
('progress', 'Sales Order'),
|
||||
('manual', 'Sale to Invoice'),
|
||||
('invoice_except', 'Invoice Exception'),
|
||||
('done', 'Done'),
|
||||
], 'Status', readonly=True,
|
||||
help="Gives the status of the quotation or sales order. \nThe exception status is automatically set when a cancel operation occurs in the processing of a document linked to the sales order. \nThe 'Waiting Schedule' status is set when the invoice is confirmed but waiting for the scheduler to run on the order date.", select=True),
|
||||
}
|
||||
|
|
|
@ -94,5 +94,25 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sale_order_form_state_button" model="ir.ui.view">
|
||||
<field name="name">sale.order.form.state.button</field>
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name='state' position="before">
|
||||
<button name="action_button_confirm" states="shopping_cart" string="Confirm Sale" type="object" groups="base.group_user"/>
|
||||
<button name="cancel" states="shopping_cart" string="Cancel Quotation" groups="base.group_user"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sale.action_orders" model="ir.actions.act_window">
|
||||
<field name="domain">[('state', 'not in', ('draft', 'shopping_cart', 'sent', 'cancel'))]</field>
|
||||
</record>
|
||||
|
||||
<record id="sale.action_quotations" model="ir.actions.act_window">
|
||||
<field name="domain">[('state','in',('draft','shopping_cart','sent','cancel'))]</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue