-
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.
- Loading branch information
1 parent
630bedb
commit aa97b1d
Showing
10 changed files
with
165 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# Copyright 2023 OpenSynergy Indonesia | ||
# Copyright 2023 PT. Simetri Sinergi Indonesia | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from . import ( | ||
models | ||
) |
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,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright 2022 OpenSynergy Indonesia | ||
Copyright 2022 PT. Simetri Sinergi Indonesia | ||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). --> | ||
<odoo> | ||
<data noupdate="1"> | ||
|
||
<record id="purchase_order_type_normal" model="purchase_order_type"> | ||
<field name="name">Normal</field> | ||
<field name="code">T0001</field> | ||
</record> | ||
|
||
</data> | ||
</odoo> |
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,24 @@ | ||
# Copyright 2023 OpenSynergy Indonesia | ||
# Copyright 2023 PT. Simetri Sinergi Indonesia | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
import logging | ||
|
||
|
||
def migrate(cr, version): | ||
if not version: | ||
return | ||
logger = logging.getLogger(__name__) | ||
logger.info("Updating purchase_order...") | ||
cr.execute( | ||
""" | ||
UPDATE | ||
purchase_order po | ||
SET | ||
type_id = t.id | ||
FROM purchase_order_type t | ||
WHERE | ||
t.code = 'T0001' | ||
AND po.type_id IS NULL; | ||
""" | ||
) | ||
logger.info("Successfully updated purchase_order tables") |
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,8 @@ | ||
# Copyright 2023 OpenSynergy Indonesia | ||
# Copyright 2023 PT. Simetri Sinergi Indonesia | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from . import ( | ||
purchase_order_type, | ||
purchase_order, | ||
) |
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,20 @@ | ||
# Copyright 2023 OpenSynergy Indonesia | ||
# Copyright 2023 PT. Simetri Sinergi Indonesia | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from odoo import api, fields, models, _ | ||
from odoo.exceptions import ValidationError | ||
|
||
|
||
class PurchaseOrder(models.Model): | ||
_inherit = 'purchase.order' | ||
|
||
type_id = fields.Many2one( | ||
comodel_name='purchase_order_type', | ||
string='Type', | ||
required=True, | ||
readonly=True, | ||
states={ | ||
"draft": [("readonly", False)], | ||
}, | ||
) |
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,15 @@ | ||
# Copyright 2023 OpenSynergy Indonesia | ||
# Copyright 2023 PT. Simetri Sinergi Indonesia | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from odoo import api, fields, models, _ | ||
from odoo.exceptions import ValidationError | ||
|
||
|
||
class PurchaseOrderType(models.Model): | ||
_name = "purchase_order_type" | ||
_inherit = [ | ||
'mixin.master_data', | ||
] | ||
_description = "Purchase Order Type" | ||
_field_name_string = "Purchase Order Type" |
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,2 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_purchase_order_type_all,purchase_order_type - all,model_purchase_order_type,,1,1,1,1 |
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,63 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- Copyright 2023 OpenSynergy Indonesia | ||
Copyright 2023 PT. Simetri Sinergi Indonesia | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl-3.0-standalone.html). --> | ||
<odoo> | ||
|
||
<record id="purchase_order_type_view_search" model="ir.ui.view"> | ||
<field name="name">purchase_order_type search</field> | ||
<field name="model">purchase_order_type</field> | ||
<field | ||
name="inherit_id" | ||
ref="ssi_master_data_mixin.mixin_master_data_view_search" | ||
/> | ||
<field name="mode">primary</field> | ||
<field name="arch" type="xml"> | ||
<data> | ||
</data> | ||
</field> | ||
</record> | ||
|
||
<record id="purchase_order_type_view_tree" model="ir.ui.view"> | ||
<field name="name">purchase_order_type tree</field> | ||
<field name="model">purchase_order_type</field> | ||
<field | ||
name="inherit_id" | ||
ref="ssi_master_data_mixin.mixin_master_data_view_tree" | ||
/> | ||
<field name="mode">primary</field> | ||
<field name="arch" type="xml"> | ||
<data /> | ||
</field> | ||
</record> | ||
|
||
<record id="purchase_order_type_view_form" model="ir.ui.view"> | ||
<field name="name">purchase_order_type form</field> | ||
<field name="model">purchase_order_type</field> | ||
<field | ||
name="inherit_id" | ||
ref="ssi_master_data_mixin.mixin_master_data_view_form" | ||
/> | ||
<field name="mode">primary</field> | ||
<field name="arch" type="xml"> | ||
<data> | ||
</data> | ||
</field> | ||
</record> | ||
|
||
<record id="purchase_order_type_action" model="ir.actions.act_window"> | ||
<field name="name">Purchase Order Types</field> | ||
<field name="type">ir.actions.act_window</field> | ||
<field name="res_model">purchase_order_type</field> | ||
<field name="view_mode">tree,form</field> | ||
</record> | ||
|
||
<menuitem | ||
id="purchase_order_type_menu" | ||
name="Purchase Order Types" | ||
parent="purchase.menu_purchase_config" | ||
action="purchase_order_type_action" | ||
sequence="10" | ||
/> | ||
|
||
</odoo> |
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