[FIX] base : fixed traceback when print and then save document layout in SaleOrder.
In Sales > Order > SaleOrder > Print > Choose Document Layout > Save: when data is saved there is comes a traceback as write method is called directly on Save button. (sale_management) Hence write method should not be called and args passed returns an empty list. - we defined dummy method to be called on save Similarly, in TimeOff > Reporting > Report by Department > Print > Choose Document Layout > Save and Print : write_company_and_print_report method is called on Save and Print button (hr_holidays) -write method which is called inside write_company_and_print_report is removed as empty args list is passed. reference is taken from- https://github.com/odoo/odoo/commit/1ced3bfca457ac50845637bcd42a8e53bd7f088d opw:1973947 closes odoo/odoo#33454 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
This commit is contained in:
committed by
Raphael Collet
parent
370acf653f
commit
2192270914
@@ -248,19 +248,15 @@ class Company(models.Model):
|
||||
return self.env['res.config.settings'].open_company()
|
||||
|
||||
@api.multi
|
||||
def write_company_and_print_report(self, values):
|
||||
res = self.write(values)
|
||||
|
||||
report_name = values.get('default_report_name')
|
||||
active_ids = values.get('active_ids')
|
||||
active_model = values.get('active_model')
|
||||
def write_company_and_print_report(self):
|
||||
context = self.env.context
|
||||
report_name = context.get('default_report_name')
|
||||
active_ids = context.get('active_ids')
|
||||
active_model = context.get('active_model')
|
||||
if report_name and active_ids and active_model:
|
||||
docids = self.env[active_model].browse(active_ids)
|
||||
return (self.env['ir.actions.report'].search([('report_name', '=', report_name)], limit=1)
|
||||
.with_context(values)
|
||||
.report_action(docids))
|
||||
else:
|
||||
return res
|
||||
|
||||
@api.model
|
||||
def action_open_base_onboarding_company(self):
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
}"/>
|
||||
</div>
|
||||
<footer>
|
||||
<button string="Save" type="object" class="oe_highlight" name="write"/>
|
||||
<button string="Save" type="object" class="oe_highlight" special="save"/>
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
</footer>
|
||||
</xpath>
|
||||
@@ -161,7 +161,7 @@
|
||||
<field name="inherit_id" ref="base.view_company_report_form" />
|
||||
<field name="priority">1024</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//button[@name='write']" position="before" >
|
||||
<xpath expr="//button[@special='save']" position="before" >
|
||||
<button string="Save and Print" type="object" class="oe_highlight" name="write_company_and_print_report"/>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user