~sebastien.beau/e-commerce-addons/oerp6.1-stable-refactor-onchange

« back to all changes in this revision

Viewing changes to sale_exceptions/sale.py

  • Committer: Sébastien Beau
  • Date: 2012-12-07 13:10:06 UTC
  • mfrom: (269.1.60 e-commerce-addons)
  • Revision ID: sebastien.beau@akretion.com-20121207131006-9k34tvjmc2n6ibc2
[MERGE] merge from cleanning branch, need to update the module before starting openerp also: please update openobject-extension too

base_sale_multichannels

    REFACTOR :
    - extract export of product and partner into separated module : base_sale_export_product, base_sale_export_partner
    - refactor stock export

    ADD :
    - add account_tax_group (need in prestashop, next step use it in magento) and link it on the product template refactor view
    - shipping address is now optionnal (if empty the invoice address is used, need for downloadable order)
    - add field ext_ref_line (need for keeping the link between OpenERP order line and external Order Line) and ext_ref_product (need for marketplace)


    REMOVE :
    - remove useless code (fonction is_install in the class ir_module_module.).
    Indeed I did it thinking of merging the abstraction in OpenERP server but this have been refused 
    - remove dead file report.py, report_view.xml

    FIX
    - fix product category export by adding the abstration _get_or_create_ext_category_ids_for_shop that will only get or automatically create the category for the current shop when we export a product (actually all category are exported without checking if they believe to the shop)
    - fix default value when importing order
    - fix function fields referential_id and type_name of sale.shop object and use store option correctly
    - fix specifique order import (with order number) from wizard
    - FIX Call the onchange correctly using args and kwargs


base_sale_report_synchronize
    REFACTOR
        - review totaly the push of invoice in external systeme

product_custom_attributes_shop
    FIX
        - fix text size bug
        - add missing security rule

product_link:
    FIX
        - fix visibility on product_id field depending of the view

sale_automatic_workflow :
    FIX
        - do not reconcile anymore when testing if the invoice is paid (it's was an ugly mistake of my part) use cron instead
    REACTOR
        - refactor the cron in order to commit after each step (invoice validation, reconcilation, picking validation...)

sale_execption :
    REFACTOR
        - field function main exception is now store correctly
        - refactor view and filter

sale_quick_payment :
    FIX
        - fix multi currency issue
        - fix error with period

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
import time
25
25
import netsvc
26
26
 
27
 
from osv import fields, osv
 
27
from openerp.osv.orm import Model
 
28
from openerp.osv import fields
 
29
from openerp.osv.osv import except_osv
28
30
from tools.safe_eval import safe_eval as eval
29
31
from tools.translate import _
30
32
 
31
 
class sale_exception(osv.osv):
 
33
class sale_exception(Model):
32
34
    _name = "sale.exception"
33
35
    _description = "Sale Exceptions"
34
36
    _columns = {
61
63
"""
62
64
    }
63
65
 
64
 
sale_exception()
65
 
 
66
 
class sale_order(osv.osv):
 
66
class sale_order(Model):
67
67
    _inherit = "sale.order"
68
68
 
 
69
    _order = 'main_exception_id asc, date_order desc, name desc'
 
70
 
69
71
    def _get_main_error(self, cr, uid, ids, name, args, context=None):
70
72
        res = {}
71
73
        for sale_order in self.browse(cr, uid, ids, context=context):
73
75
        return res
74
76
 
75
77
    _columns = {
76
 
        'main_exception_id': fields.function(_get_main_error, type='many2one',
77
 
                                             relation="sale.exception",
78
 
                                             string='Main Exception'),
 
78
        'main_exception_id': fields.function(_get_main_error,
 
79
                        type='many2one',
 
80
                        relation="sale.exception",
 
81
                        string='Main Exception',
 
82
                        store={
 
83
                            'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['exceptions_ids'], 10),
 
84
                        }),
79
85
        'exceptions_ids': fields.many2many('sale.exception', 'sale_order_exception_rel',
80
86
                                           'sale_order_id', 'exception_id',
81
87
                                           string='Exceptions'),
170
176
            eval(expr, space,
171
177
                 mode='exec', nocopy=True) # nocopy allows to return 'result'
172
178
        except Exception, e:
173
 
            raise osv.except_osv(_('Error'), _('Error when evaluating the sale exception rule :\n %s \n(%s)') %
 
179
            raise except_osv(_('Error'), _('Error when evaluating the sale exception rule :\n %s \n(%s)') %
174
180
                                 (rule.name, e))
175
181
        return space.get('failed', False)
176
182
 
197
203
            'ignore_exceptions': False,
198
204
        })
199
205
        return super(sale_order, self).copy(cr, uid, id, default=default, context=context)
200
 
 
201
 
sale_order()