[IMP]: Improved as per specifications.

bzr revid: uco@tinyerp.com-20120223123424-k8nc2efnvafo4cin
This commit is contained in:
Ujjvala Collins (OpenERP)
2012-02-23 18:04:24 +05:30
parent 5c93d738b2
commit 8efccd6a74
2 changed files with 19 additions and 95 deletions
+15 -34
View File
@@ -34,31 +34,6 @@ class sale_config_picking_policy(osv.osv_memory):
_inherit = 'res.config'
_columns = {
'name': fields.char('Name', size=64),
'sale_orders': fields.boolean('Based on Sales Orders',),
'deli_orders': fields.boolean('Based on Delivery Orders'),
'task_work': fields.boolean('Based on Tasks\' Work'),
'timesheet': fields.boolean('Based on Timesheet'),
'order_policy': fields.selection([
('manual', 'Invoice Based on Sales Orders'),
('picking', 'Invoice Based on Deliveries'),
], 'Main Method Based On', required=True, help="You can generate invoices based on sales orders or based on shippings."),
'charge_delivery': fields.boolean('Do you charge the delivery?'),
'picking_policy' : fields.boolean("Deliver all products at once?"),
'group_sale_pricelist_per_customer':fields.boolean("Activate pricelist to manage prices per customer "),
'group_sale_uom_per_product':fields.boolean("Allow different unit of measure per product"),
'group_sale_delivery_address':fields.boolean(" Allow delivery address different from invoice address"),
'group_sale_disc_per_sale_order_line':fields.boolean("Allow to apply discounts per sale order lines "),
'group_sale_notes_subtotal':fields.boolean("Allow notes and subtotals"),
'group_sale_alerts_per_customer_products':fields.boolean("Allow to define alerts by products or customers"),
'tax_value' : fields.float('Value'),
'tax_policy': fields.selection([
('no_tax', 'No Tax'),
('global_on_order', 'Global On Order'),
('on_order_line', 'On Order Lines'),
], 'Taxes'),
'sale_margin' : fields.boolean("Display Margin For Users"),
'sale_journal' : fields.boolean("Invoice_journal?"),
'analytic_user_function' : fields.boolean("Use specific User function on Contract/analytic accounts"),
'analytic_journal_billing_rate' : fields.boolean("Manage Different billing rates on contract/analytic accounts"),
'import_sugarcrm' : fields.boolean("Import data from sugarCRM?"),
@@ -82,10 +57,16 @@ class sale_config_picking_policy(osv.osv_memory):
'plugin_outlook': fields.boolean('Push your email from Outlook to an OpenERP document'),
}
def default_module_get(self, cr, uid, ids, context=None):
#TODO: Need to be implemented
print "Not Implemented!"
return {}
_defaults = {
'order_policy': 'manual',
'tax_policy': 'no_tax',
'type': 'pop',
'google_map': default_module_get,
'crm_caldav': default_module_get,
}
def onchange_server_type(self, cr, uid, ids, server_type=False, ssl=False):
@@ -100,13 +81,13 @@ class sale_config_picking_policy(osv.osv_memory):
values['port'] = port
return {'value':values}
def onchange_order(self, cr, uid, ids, sale, deli, context=None):
res = {}
if sale:
res.update({'order_policy': 'manual'})
elif deli:
res.update({'order_policy': 'picking'})
return {'value':res}
# def onchange_order(self, cr, uid, ids, sale, deli, context=None):
# res = {}
# if sale:
# res.update({'order_policy': 'manual'})
# elif deli:
# res.update({'order_policy': 'picking'})
# return {'value':res}
def execute(self, cr, uid, ids, context=None):
ir_values_obj = self.pool.get('ir.values')
@@ -1,65 +1,12 @@
<openerp>
<data>
<record id="view_config_picking_policy_1" model="ir.ui.view">
<record id="view_config_picking_policy" model="ir.ui.view">
<field name="name">Sales Application</field>
<field name="model">sale.config.picking_policy</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Sale Configuration">
<separator string="Picking and Invoice Policy" colspan="4"/>
<group colspan="4" col="8">
<group colspan="4" col="4">
<field name="sale_orders" on_change="onchange_order(sale_orders,deli_orders)"/>
<newline/>
<field name="deli_orders" on_change="onchange_order(sale_orders,deli_orders)"/>
<newline/>
<field name="task_work"/>
<newline/>
<field name="timesheet"/>
<newline/>
</group>
<group colspan="4" col="4">
<newline/>
<field name="order_policy" attrs="{'invisible':['|',('sale_orders','!=',True),('deli_orders','!=',True)]}"/>
<newline/>
<field name="charge_delivery" attrs="{'invisible':[('sale_orders','!=',True), ('deli_orders','!=',True)]}"/>
<newline/>
<field name="picking_policy" attrs="{'invisible':[('deli_orders','!=',True)]}"/>
<newline/>
</group>
</group>
<separator string="Sale Order" colspan="4"/>
<group colspan="4" col="8">
<group colspan="4" col="4">
<field name="group_sale_pricelist_per_customer"/>
<newline/>
<group colspan="4" col="4">
<field name="tax_policy" align="0.0"/>
<field name="tax_value" nolabel="1" align="0.0"/>
</group>
<newline/>
<field name="sale_margin"/>
<newline/>
<field name="group_sale_alerts_per_customer_products"/>
<newline/>
</group>
<group colspan="4" col="4">
<newline/>
<field name="group_sale_uom_per_product"/>
<newline/>
<field name="group_sale_delivery_address"/>
<newline/>
<field name="group_sale_disc_per_sale_order_line"/>
<newline/>
<field name="group_sale_notes_subtotal"/>
<newline/>
<field name="sale_journal"/>
<newline/>
</group>
</group>
<separator string="Contracts" colspan="4"/>
<group colspan="4" col="8">
<group colspan="4" col="4">
@@ -127,24 +74,20 @@
</group>
</group>
<group>
<button string="Cancel" icon="gtk-cancel" special="cancel" />
<button string="Apply" icon="gtk-apply" name="apply_cb" type="object" />
</group>
</form>
</field>
</record>
<record id="action_config_picking_policy" model="ir.actions.act_window">
<field name="name">Sales Application</field>
<field name="name">Configure different Sales Applications</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sale.config.picking_policy</field>
<field name="view_id" ref="view_config_picking_policy_1"/>
<field name="view_id" ref="view_config_picking_policy"/>
<field name="view_type">form</field>
<field name="view_mode">form</field>
</record>
<menuitem id="sale_menu_config_11" name="Sale" parent="base.menu_config" sequence="1" action="action_config_picking_policy"/>
<menuitem id="sale_menu_config_11" name="Sales" parent="base.menu_config" sequence="1" action="action_config_picking_policy"/>
</data>
</openerp>