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

« back to all changes in this revision

Viewing changes to base_sale_report_synchronizer/invoice.py

  • Committer: sebastien beau
  • Date: 2012-08-21 13:57:44 UTC
  • mto: (269.1.1)
  • mto: This revision was merged to the branch mainline in revision 273.
  • Revision ID: git-v1:5a17b67295468f3c90564a729144ebc41da38618
[REF] refactor/clean code due to orm change in 6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.     #
19
19
#                                                                             #
20
20
###############################################################################
21
 
from osv import osv, fields
22
 
from tools.translate import _
 
21
from openerp.osv.orm import Model
 
22
from openerp.osv.osv import except_osv
 
23
from openerp.tools.translate import _
23
24
from base_external_referentials.external_osv import ExternalSession
24
25
import os
25
26
 
26
 
class account_invoice(osv.osv):
 
27
class account_invoice(Model):
27
28
    _inherit='account.invoice'
28
29
    
29
30
    def _export_one_resource(self, cr, uid, external_session, invoice_id, context=None):
38
39
        invoice_number = invoice.number.replace('/', '-')
39
40
        invoice_path = self._get_invoice_path(cr, uid, external_session, invoice, context=context)
40
41
        if not external_session.sync_from_object.invoice_report:
41
 
            raise osv.except_osv(_("User Error"), _("You must define a report for the invoice for your sale shop"))
 
42
            raise except_osv(_("User Error"), _("You must define a report for the invoice for your sale shop"))
42
43
        report_name = "report.%s"%external_session.sync_from_object.invoice_report.report_name
43
44
        if not hasattr(external_session, 'file_session'):
44
45
            external_session.file_session = ExternalSession(