|
@ -18,12 +18,12 @@ |
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
|
# |
|
|
# |
|
|
############################################################################## |
|
|
############################################################################## |
|
|
|
|
|
|
|
|
from openerp.osv import orm |
|
|
from openerp.osv import orm |
|
|
from openerp import netsvc |
|
|
from openerp import netsvc |
|
|
from openerp.report.report_sxw import rml_parse |
|
|
from openerp.report.report_sxw import rml_parse |
|
|
from report_assembler import PDFReportAssembler |
|
|
from report_assembler import PDFReportAssembler |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def register_report(name, model, parser=rml_parse): |
|
|
def register_report(name, model, parser=rml_parse): |
|
|
"""Register the report into the services""" |
|
|
"""Register the report into the services""" |
|
|
name = 'report.%s' % name |
|
|
name = 'report.%s' % name |
|
@ -72,8 +72,7 @@ class ReportAssembleXML(orm.Model): |
|
|
cursor, |
|
|
cursor, |
|
|
user, |
|
|
user, |
|
|
ids, |
|
|
ids, |
|
|
context |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
context) |
|
|
return res |
|
|
return res |
|
|
|
|
|
|
|
|
def create(self, cursor, user, vals, context=None): |
|
|
def create(self, cursor, user, vals, context=None): |
|
@ -83,19 +82,18 @@ class ReportAssembleXML(orm.Model): |
|
|
# I really look forward to virtual functions :S |
|
|
# I really look forward to virtual functions :S |
|
|
register_report( |
|
|
register_report( |
|
|
vals['report_name'], |
|
|
vals['report_name'], |
|
|
vals['model'], |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
vals['model']) |
|
|
return res |
|
|
return res |
|
|
|
|
|
|
|
|
def write(self, cr, uid, ids, vals, context=None): |
|
|
def write(self, cr, uid, ids, vals, context=None): |
|
|
"Edit report and manage its registration" |
|
|
"Edit report and manage its registration" |
|
|
if isinstance(ids, (int, long)): |
|
|
if isinstance(ids, (int, long)): |
|
|
ids = [ids,] |
|
|
|
|
|
|
|
|
ids = [ids] |
|
|
for rep in self.browse(cr, uid, ids, context=context): |
|
|
for rep in self.browse(cr, uid, ids, context=context): |
|
|
if rep.report_type != 'assemblage': |
|
|
if rep.report_type != 'assemblage': |
|
|
continue |
|
|
continue |
|
|
if vals.get('report_name', False) and \ |
|
|
|
|
|
vals['report_name'] != rep.report_name: |
|
|
|
|
|
|
|
|
if (vals.get('report_name', False) |
|
|
|
|
|
and vals['report_name'] != rep.report_name): |
|
|
report_name = vals['report_name'] |
|
|
report_name = vals['report_name'] |
|
|
else: |
|
|
else: |
|
|
report_name = rep.report_name |
|
|
report_name = rep.report_name |
|
|