[IMP] commission_simple: validation from list view
This commit is contained in:
@@ -63,7 +63,7 @@ class CommissionResult(models.Model):
|
|||||||
return super().unlink()
|
return super().unlink()
|
||||||
|
|
||||||
def draft2done(self):
|
def draft2done(self):
|
||||||
self.write({'state': 'done'})
|
self.filtered(lambda x: x.state == 'draft').write({'state': 'done'})
|
||||||
|
|
||||||
def backtodraft(self):
|
def backtodraft(self):
|
||||||
self.write({'state': 'draft'})
|
self.write({'state': 'draft'})
|
||||||
|
|||||||
@@ -72,6 +72,13 @@
|
|||||||
<field name="model">commission.result</field>
|
<field name="model">commission.result</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree decoration-info="state == 'draft'">
|
<tree decoration-info="state == 'draft'">
|
||||||
|
<header>
|
||||||
|
<button
|
||||||
|
name="draft2done"
|
||||||
|
type="object"
|
||||||
|
string="Validate"
|
||||||
|
/>
|
||||||
|
</header>
|
||||||
<field name="date_range_id" optional="show"/>
|
<field name="date_range_id" optional="show"/>
|
||||||
<field name="date_start" optional="hide"/>
|
<field name="date_start" optional="hide"/>
|
||||||
<field name="date_end" optional="hide"/>
|
<field name="date_end" optional="hide"/>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class CommissionResult(models.Model):
|
|||||||
|
|
||||||
def draft2done(self):
|
def draft2done(self):
|
||||||
for result in self:
|
for result in self:
|
||||||
if result.assign_type == 'agent':
|
if result.state == "draft" and result.assign_type == 'agent':
|
||||||
if not result.purchase_id:
|
if not result.purchase_id:
|
||||||
vals = result._prepare_purchase_order()
|
vals = result._prepare_purchase_order()
|
||||||
po = self.env['purchase.order'].create(vals)
|
po = self.env['purchase.order'].create(vals)
|
||||||
|
|||||||
Reference in New Issue
Block a user