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 | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/l10n_in_purchase_stock')
6 files changed, 76 insertions, 0 deletions
diff --git a/addons/l10n_in_purchase_stock/__init__.py b/addons/l10n_in_purchase_stock/__init__.py new file mode 100644 index 00000000..dc5e6b69 --- /dev/null +++ b/addons/l10n_in_purchase_stock/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import models diff --git a/addons/l10n_in_purchase_stock/__manifest__.py b/addons/l10n_in_purchase_stock/__manifest__.py new file mode 100644 index 00000000..133b4d78 --- /dev/null +++ b/addons/l10n_in_purchase_stock/__manifest__.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +{ + 'name': "India Purchase and Warehouse Management", + + 'summary': """ + Define default purchase journal on the warehouse""", + + 'description': """ + Define default purchase journal on the warehouse, + help you to choose correct purchase journal on the purchase order when + you change the picking operation. + useful when you setup the multiple GSTIN units. + """, + + 'author': "Odoo", + 'website': "https://www.odoo.com", + 'category': 'Accounting/Localizations/Purchase', + 'version': '1.0', + + 'depends': ['l10n_in_purchase', 'l10n_in_stock'], + + 'data': [ + 'views/stock_warehouse_views.xml', + ], + 'auto_install': True, + 'license': 'LGPL-3', +} 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") diff --git a/addons/l10n_in_purchase_stock/views/stock_warehouse_views.xml b/addons/l10n_in_purchase_stock/views/stock_warehouse_views.xml new file mode 100644 index 00000000..69df7c9b --- /dev/null +++ b/addons/l10n_in_purchase_stock/views/stock_warehouse_views.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <record id="view_stock_warehouse_inherit_l10n_in_stock" model="ir.ui.view"> + <field name="name">stock.warehouse.form.inherit.l10n.in.stock</field> + <field name="model">stock.warehouse</field> + <field name="inherit_id" ref="stock.view_warehouse"/> + <field name="arch" type="xml"> + <xpath expr="//field[@name='partner_id']" position="after"> + <field name="l10n_in_purchase_journal_id" domain="[('company_id', '=', company_id), ('type','=','purchase')]" options="{'no_create': True}"/> + </xpath> + </field> + </record> +</odoo> |
