diff options
| author | Fabien Pinckaers <fp@tinyerp.com> | 2008-12-01 14:49:49 +0100 |
|---|---|---|
| committer | Fabien Pinckaers <fp@tinyerp.com> | 2008-12-01 14:49:49 +0100 |
| commit | ec4e3e2fc67fe3ad1d24b717c2875db5d754b1f2 (patch) | |
| tree | 53fa27277ec99bec1184168ce7583746c7ba144a | |
| parent | 3722781d3132712f7794564062fb4a8da20bcc30 (diff) | |
| parent | f4c0703b2d4bcf5e24e63a997658bb9ae9fe7c6a (diff) | |
merge
bzr revid: fp@tinyerp.com-20081201134949-vxjr9rcpbia24qfo
| -rw-r--r-- | addons/account/account.py | 8 | ||||
| -rw-r--r-- | addons/mrp_repair/mrp_repair.py | 2 | ||||
| -rw-r--r-- | addons/sale/sale.py | 36 | ||||
| -rw-r--r-- | addons/sale/sale_view.xml | 4 |
4 files changed, 38 insertions, 12 deletions
diff --git a/addons/account/account.py b/addons/account/account.py index 3df1dc622d1..8f1329cc30e 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2002,12 +2002,12 @@ class wizard_multi_charts_accounts(osv.osv_memory): 'python_compute_inv': tax.python_compute_inv, 'python_applicable': tax.python_applicable, 'tax_group':tax.tax_group, - 'base_code_id': tax.base_code_id and tax_code_template_ref[tax.base_code_id.id] or False, - 'tax_code_id': tax.tax_code_id and tax_code_template_ref[tax.tax_code_id.id] or False, + 'base_code_id': tax.base_code_id and ((tax.base_code_id.id in tax_code_template_ref) and tax_code_template_ref[tax.base_code_id.id]) or False, + 'tax_code_id': tax.tax_code_id and ((tax.tax_code_id.id in tax_code_template_ref) and tax_code_template_ref[tax.tax_code_id.id]) or False, 'base_sign': tax.base_sign, 'tax_sign': tax.tax_sign, - 'ref_base_code_id': tax.ref_base_code_id and tax_code_template_ref[tax.ref_base_code_id.id] or False, - 'ref_tax_code_id': tax.ref_tax_code_id and tax_code_template_ref[tax.ref_tax_code_id.id] or False, + 'ref_base_code_id': tax.ref_base_code_id and ((tax.ref_base_code_id.id in tax_code_template_ref) and tax_code_template_ref[tax.ref_base_code_id.id]) or False, + 'ref_tax_code_id': tax.ref_tax_code_id and ((tax.ref_tax_code_id.id in tax_code_template_ref) and tax_code_template_ref[tax.ref_tax_code_id.id]) or False, 'ref_base_sign': tax.ref_base_sign, 'ref_tax_sign': tax.ref_tax_sign, 'include_base_amount': tax.include_base_amount, diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index f395c911517..66353a7e168 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -499,7 +499,7 @@ class mrp_repair_line(osv.osv, ProductChangeMixin): } } stock_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Stock')])[0] - produc_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Default Production')])[0] + produc_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Production')])[0] to_invoice=False if guarantee_limit and today() > mx.DateTime.strptime(guarantee_limit, '%Y-%m-%d'): to_invoice=True diff --git a/addons/sale/sale.py b/addons/sale/sale.py index f51db0fa80d..49a96fe788a 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved # $Id$ # @@ -261,9 +261,9 @@ class sale_order(osv.osv): unlink_ids.append(s['id']) else: raise osv.except_osv(_('Invalid action !'), _('Cannot delete Sale Order(s) which are already confirmed !')) - return osv.osv.unlink(self, cr, uid, unlink_ids) - - + return osv.osv.unlink(self, cr, uid, unlink_ids) + + def onchange_shop_id(self, cr, uid, ids, shop_id): v={} if shop_id: @@ -296,6 +296,32 @@ class sale_order(osv.osv): payment_term = part.property_payment_term and part.property_payment_term.id or False return {'value':{'partner_invoice_id': addr['invoice'], 'partner_order_id':addr['contact'], 'partner_shipping_id':addr['delivery'], 'pricelist_id': pricelist, 'payment_term' : payment_term}} + def shipping_policy_change(self, cr, uid, ids, policy, context={}): + if not policy: + return {} + inv_qty = 'order' + if policy=='prepaid': + inv_qty = 'order' + elif policy=='picking': + inv_qty = 'procurement' + return {'value':{'invoice_quantity':inv_qty}} + + def write(self, cr, uid, ids, vals, context=None): + if vals.has_key('order_policy'): + if vals['order_policy']=='prepaid': + vals.update({'invoice_quantity':'order'}) + elif vals['order_policy']=='picking': + vals.update({'invoice_quantity':'procurement'}) + return super(sale_order, self).write(cr, uid, ids, vals, context=context) + + def create(self, cr, uid, vals, context={}): + if vals.has_key('order_policy'): + if vals['order_policy']=='prepaid': + vals.update({'invoice_quantity':'order'}) + if vals['order_policy']=='picking': + vals.update({'invoice_quantity':'procurement'}) + return super(sale_order, self).create(cr, uid, vals, context=context) + def button_dummy(self, cr, uid, ids, context={}): return True @@ -453,7 +479,7 @@ class sale_order(osv.osv): def test_state(self, cr, uid, ids, mode, *args): assert mode in ('finished', 'canceled'), _("invalid mode for test_state") finished = True - canceled = False + canceled = False notcanceled = False write_done_ids = [] write_cancel_ids = [] diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index d3f733d6ad6..b23567199bd 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -202,9 +202,9 @@ <field groups="base.group_extended" name="incoterm"/> <field groups="base.group_extended" name="picking_policy" required="True"/> <field name="user_id"/> - <field name="order_policy"/> + <field name="order_policy" on_change="shipping_policy_change(order_policy)"/> <field groups="base.group_extended" name="origin"/> - <field groups="base.group_extended" name="invoice_quantity" attrs="{'readonly':[('order_policy','=','prepaid')]}"/> + <field groups="base.group_extended" name="invoice_quantity" attrs="{'readonly':[('order_policy','=','prepaid'),('order_policy','=','picking')]}"/> <field name="payment_term"/> <separator colspan="4" string="Notes"/> <field colspan="4" name="note" nolabel="1"/> |
