Skip to content

Commit

Permalink
Merge pull request #5 from Eficent/11.0-purchase_exception-imp
Browse files Browse the repository at this point in the history
[11.0][purchase_exception] small fixes
  • Loading branch information
mourad-ehm authored Nov 23, 2017
2 parents 8bc22fc + 4cfb9ce commit d1f8c5e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 31 deletions.
10 changes: 5 additions & 5 deletions purchase_exception/models/purchase.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,18 @@ def onchange_ignore_exception(self):

@api.multi
def button_confirm(self):
if self.detect_exceptions():
if self.detect_exceptions() and not self.ignore_exception:
return self._popup_exceptions()
else:
return super(PurchaseOrder, self).button_confirm()

@api.multi
def button_draft(self):
res = super(PurchaseOrder, self).button_draft()
orders = self.filtered(lambda s: s.ignore_exception)
orders.write({
'ignore_exception': False,
})
for rec in self:
rec.exception_ids = False
rec.main_exception_id = False
rec.ignore_exception = False
return res

def _purchase_get_lines(self):
Expand Down
2 changes: 2 additions & 0 deletions purchase_exception/wizard/purchase_exception_confirm.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ class PurchaseExceptionConfirm(models.TransientModel):
def action_confirm(self):
self.ensure_one()
if self.ignore:
self.related_model_id.button_draft()
self.related_model_id.ignore_exception = True
self.related_model_id.button_confirm()
return super(PurchaseExceptionConfirm, self).action_confirm()
28 changes: 2 additions & 26 deletions purchase_exception/wizard/purchase_exception_confirm_view.xml
Original file line number Diff line number Diff line change
@@ -1,36 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_purchase_exception_confirm" model="ir.ui.view">
<field name="name">Purchase Exceptions</field>
<field name="model">purchase.exception.confirm</field>
<field name="arch" type="xml">
<form string="Blocked in draft due to exceptions">
<group>
<field name="exception_ids" nolabel="1" colspan="4">
<tree string="Purchase Exceptions">
<field name="name"/>
<field name="description"/>
</tree>
</field>
</group>
<newline/>
<field name="ignore"
groups='base_exception.group_exception_rule_manager'/>
<footer>
<button name="action_confirm" string="_Close"
colspan="1" type="object" class="btn-primary" />
</footer>
</form>
</field>
</record>

<record id="action_purchase_exception_confirm" model="ir.actions.act_window">
<field name="name">Blocked in draft due to exceptions</field>
<field name="name">Outstanding exceptions to manage</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">purchase.exception.confirm</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_purchase_exception_confirm"/>
<field name="view_id" ref="base_exception.view_exception_rule_confirm"/>
<field name="target">new</field>
</record>
</odoo>

0 comments on commit d1f8c5e

Please sign in to comment.