~carlosmarqs/openerp/magentoopenerpconnect

« back to all changes in this revision

Viewing changes to magentoerpconnect_magento_invoice/account.py

  • Committer: Sébastien Beau
  • Date: 2012-12-07 13:18:05 UTC
  • mfrom: (676.2.39 magentoerpconnect)
  • Revision ID: sebastien.beau@akretion.com-20121207131805-o4tgotytj3ku580m
[MERGE] merge with cleaning branch, please do not forget to update dependency, product-extra-addons, openobject-extention, e-commerce-adddons. 

magentoerpconnect :
- REFACTOR
    - refactor the invoice syncronisation 
        2 modules are available, 1 for using Magento Invoice, one for using OpenERP invoice
        moreover if invoice syncronisation failed try to map if an existing one already exist : fonction => map_magento_order 
    - refactor view for compatibility in multi-e-commerce solution
    - NAME REFACTOR : by default use only name if you need to use the lastname and firstname please first update magentoerpconnect and them install magentoerpconnect_partner_surname. DO IT ON A DATABASE TEST BEFORE. If you have any trouble please open a bug on lp
    - use new api for moving the category and updating the stock information

    ADD
        - add reporting when exporting stock level

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- encoding: utf-8 -*-
 
2
###############################################################################
 
3
#
 
4
#   magentoerpconnect_magento_invoice for OpenERP
 
5
#   Copyright (C) 2012-TODAY Akretion <http://www.akretion.com>. All Rights Reserved
 
6
#   @author Sébastien BEAU <sebastien.beau@akretion.com>
 
7
#   This program is free software: you can redistribute it and/or modify
 
8
#   it under the terms of the GNU Affero General Public License as
 
9
#   published by the Free Software Foundation, either version 3 of the
 
10
#   License, or (at your option) any later version.
 
11
#
 
12
#   This program is distributed in the hope that it will be useful,
 
13
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
#   GNU Affero General Public License for more details.
 
16
#
 
17
#   You should have received a copy of the GNU Affero General Public License
 
18
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
#
 
20
###############################################################################
 
21
 
 
22
 
 
23
from openerp.osv.orm import Model
 
24
 
 
25
class account_invoice(Model):
 
26
    _inherit = "account.invoice"
 
27
 
 
28
    def action_move_create(self, cr, uid, ids, context=None):
 
29
        if context is None:
 
30
            context = {'lang': 'en_US'}
 
31
        for invoice in self.browse(cr, uid, ids, context=context):
 
32
            ext_invoice_id = self._export_one_invoice(cr, uid, invoice, context=context)
 
33
            invoice.write({'internal_number': ext_invoice_id}, context=context)
 
34
        return super(account_invoice, self).action_move_create(cr, uid, ids, context=context)
 
35