-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Menambahkan fungsi copy term
- Loading branch information
Showing
7 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ | |
|
||
from . import ( | ||
models, | ||
wizards, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Copyright 2024 OpenSynergy Indonesia | ||
# Copyright 2024 PT. Simetri Sinergi Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import ( | ||
copy_quotation_term, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Copyright 2024 OpenSynergy Indonesia | ||
# Copyright 2024 PT. Simetri Sinergi Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class CopyQuotationTerm(models.TransientModel): | ||
_name = "copy_quotation_term" | ||
_description = "Copy Quotation Term" | ||
|
||
name = fields.Char( | ||
string="Term", | ||
required=True, | ||
) | ||
sequence = fields.Integer( | ||
string="Sequence", | ||
required=True, | ||
default=5, | ||
) | ||
term_id = fields.Many2one( | ||
string="Payment Term", | ||
comodel_name="service.quotation_fix_item_payment_term", | ||
required=False, | ||
default=lambda self: self._default_term_id(), | ||
) | ||
set_qty = fields.Boolean( | ||
string="Set Qty All Items", | ||
default=False, | ||
) | ||
quantity = fields.Float( | ||
string="Quanity", | ||
default=0.0, | ||
) | ||
|
||
@api.model | ||
def _default_term_id(self): | ||
return self.env.context.get("active_id", False) | ||
|
||
def action_confirm(self): | ||
self.ensure_one() | ||
new_term = self.term_id.copy( | ||
{ | ||
"name": self.name, | ||
"sequence": self.sequence, | ||
} | ||
) | ||
new_term.detail_ids.write( | ||
{ | ||
"uom_quantity": self.quantity, | ||
} | ||
) |
42 changes: 42 additions & 0 deletions
42
ssi_service_quotation/wizards/copy_quotation_term_views.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
|
||
<record id="copy_quotation_term_view_form" model="ir.ui.view"> | ||
<field name="name">Copy Term</field> | ||
<field name="model">copy_quotation_term</field> | ||
<field name="arch" type="xml"> | ||
<form> | ||
<group name="group_1" colspan="4" col="2"> | ||
<field name="term_id" invisible="0" required="1" /> | ||
<field name="name" /> | ||
<field name="sequence" /> | ||
<field name="set_qty" widget="boolean_toggle" /> | ||
<field | ||
name="quantity" | ||
attrs="{'invisible':[('set_qty','=',False)], 'required': [('set_qty','=',True)]}" | ||
/> | ||
</group> | ||
<footer> | ||
<button | ||
string="Confirm" | ||
name="action_confirm" | ||
type="object" | ||
class="oe_highlight" | ||
confirm="Are you sure?" | ||
/> | ||
or | ||
<button string="Cancel" class="oe_link" special="cancel" /> | ||
</footer> | ||
</form> | ||
</field> | ||
</record> | ||
|
||
<record id="copy_quotation_term_action" model="ir.actions.act_window"> | ||
<field name="name">Copy Term</field> | ||
<field name="res_model">copy_quotation_term</field> | ||
<field name="view_mode">form</field> | ||
<field name="view_id" ref="copy_quotation_term_view_form" /> | ||
<field name="target">new</field> | ||
</record> | ||
|
||
</odoo> |