diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /addons/l10n_in_purchase_stock/models | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/l10n_in_purchase_stock/models')
| -rw-r--r-- | addons/l10n_in_purchase_stock/models/__init__.py | 5 | ||||
| -rw-r--r-- | addons/l10n_in_purchase_stock/models/purchase_order.py | 15 | ||||
| -rw-r--r-- | addons/l10n_in_purchase_stock/models/stock_warehouse.py | 10 |
3 files changed, 30 insertions, 0 deletions
diff --git a/addons/l10n_in_purchase_stock/models/__init__.py b/addons/l10n_in_purchase_stock/models/__init__.py new file mode 100644 index 00000000..b1a8586e --- /dev/null +++ b/addons/l10n_in_purchase_stock/models/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import purchase_order +from . import stock_warehouse diff --git a/addons/l10n_in_purchase_stock/models/purchase_order.py b/addons/l10n_in_purchase_stock/models/purchase_order.py new file mode 100644 index 00000000..3278769c --- /dev/null +++ b/addons/l10n_in_purchase_stock/models/purchase_order.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import models, fields, api + + +class PurchaseOrder(models.Model): + _inherit = "purchase.order" + + @api.onchange('company_id', 'picking_type_id') + def l10n_in_onchange_company_id(self): + if self.picking_type_id.warehouse_id and self.picking_type_id.warehouse_id.l10n_in_purchase_journal_id: + self.l10n_in_journal_id = self.picking_type_id.warehouse_id.l10n_in_purchase_journal_id.id + else: + super().l10n_in_onchange_company_id() diff --git a/addons/l10n_in_purchase_stock/models/stock_warehouse.py b/addons/l10n_in_purchase_stock/models/stock_warehouse.py new file mode 100644 index 00000000..5fa743e3 --- /dev/null +++ b/addons/l10n_in_purchase_stock/models/stock_warehouse.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import models, fields, api + + +class Stock(models.Model): + _inherit = 'stock.warehouse' + + l10n_in_purchase_journal_id = fields.Many2one('account.journal', string="Purchase Journal") |
