~ecommerce-addons-core-editors/e-commerce-addons/github-6.1

« back to all changes in this revision

Viewing changes to base_sale_multichannels/sale.py

  • Committer: Sébastien Beau
  • Date: 2013-06-17 09:36:28 UTC
  • mto: This revision was merged to the branch mainline in revision 286.
  • Revision ID: git-v1:872114dde6adecf3c1a3aa69e6c7e791c1a151a3
[FIX] sale_exceptions: fix help message, thanks to Stefan Rijnhart (Therp)

Show diffs side-by-side

added added

removed removed

Lines of Context:
402
402
        LEFT JOIN delivery_carrier
403
403
                  ON delivery_carrier.id = stock_picking.carrier_id
404
404
        WHERE sale_order.shop_id = %(shop_id)s
405
 
              AND (
406
 
                  ir_model_data.referential_id is Null
407
 
                  OR ir_model_data.referential_id != %(referential_id)s
408
 
              )
 
405
              AND ir_model_data.res_id ISNULL
409
406
              AND stock_picking.state = 'done'
410
407
              AND stock_picking.type = 'out'
411
408
              AND NOT stock_picking.do_not_export
418
415
                 stock_picking.backorder_id
419
416
        ORDER BY sale_order.id ASC,
420
417
                 COALESCE(stock_picking.backorder_id, NULL, 0) ASC"""
421
 
        params = {'shop_id': shop.id, 'referential_id': shop.referential_id.id}
 
418
        params = {'shop_id': shop.id}
422
419
        return query, params
423
420
 
424
421
    def export_shipping(self, cr, uid, ids, context):
726
723
        vals = self._get_payment_information(cr, uid, external_session, order_id, resource, context=context)
727
724
        if vals.get('paid'):
728
725
            if not vals.get('journal_id'):
729
 
                external_session.logger.warning(_("No journal found for payment method %s. Can not create payment.")%vals['payment_method'])
 
726
                external_session.logger.warning(_("Not journal found for payment method %s. Can not create payment")%vals['payment_method'])
730
727
                vals['paid'] = False
731
728
            else:
732
729
                self.pay_sale_order(cr, uid, order_id, vals['journal_id'], vals['amount'], vals['date'], context=context)
823
820
    def _get_special_fields(self, cr, uid, context=None):
824
821
        return [
825
822
            {
826
 
            'key': 'shipping',
827
823
            'price_unit_tax_excluded' : 'shipping_amount_tax_excluded',
828
824
            'price_unit_tax_included' : 'shipping_amount_tax_included',
829
825
            'tax_rate_field' : 'shipping_tax_rate',
830
826
            'product_ref' : ('base_sale_multichannels', 'product_product_shipping'),
831
827
            },
832
828
            {
833
 
            'key': 'cash_on_delivery',
834
829
            'tax_rate_field' : 'cash_on_delivery_taxe_rate',
835
830
            'price_unit_tax_excluded' : 'cash_on_delivery_amount_tax_excluded',
836
831
            'price_unit_tax_included' : 'cash_on_delivery_amount_tax_included',
837
832
            'product_ref' : ('base_sale_multichannels', 'product_product_cash_on_delivery'),
838
833
            },
839
834
            {
840
 
            'key': 'gift_certificate',
841
835
            'price_unit_tax_excluded' : 'gift_certificates_amount', #gift certificate doesn't have any tax
842
836
            'price_unit_tax_included' : 'gift_certificates_amount',
843
837
            'product_ref' : ('base_sale_multichannels', 'product_product_gift'),
865
859
                    del vals[option[key]]
866
860
            return vals #if there is not price, we have nothing to import
867
861
 
868
 
        product_id = False
869
 
        # shipping product should be the one of the delivery method
870
 
        # otherwise, it uses the default one
871
 
        if option.get('key') == 'shipping' and vals.get('carrier_id'):
872
 
            carrier = self.pool.get('delivery.carrier').browse(cr, uid, vals['carrier_id'], context=context)
873
 
            product_id = carrier.product_id.id
874
 
        if not product_id:
875
 
            model_data_obj = self.pool.get('ir.model.data')
876
 
            dummy, product_id = model_data_obj.get_object_reference(cr, uid, *option['product_ref'])
877
 
 
 
862
        model_data_obj = self.pool.get('ir.model.data')
 
863
        model, product_id = model_data_obj.get_object_reference(cr, uid, *option['product_ref'])
878
864
        product = self.pool.get('product.product').browse(cr, uid, product_id, context)
879
865
 
880
866
        extra_line = {