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_sale_stock | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/l10n_in_sale_stock')
| -rw-r--r-- | addons/l10n_in_sale_stock/__init__.py | 4 | ||||
| -rw-r--r-- | addons/l10n_in_sale_stock/__manifest__.py | 29 | ||||
| -rw-r--r-- | addons/l10n_in_sale_stock/models/__init__.py | 5 | ||||
| -rw-r--r-- | addons/l10n_in_sale_stock/models/sale_order.py | 16 | ||||
| -rw-r--r-- | addons/l10n_in_sale_stock/models/stock_warehouse.py | 10 | ||||
| -rw-r--r-- | addons/l10n_in_sale_stock/views/stock_warehouse_views.xml | 13 |
6 files changed, 77 insertions, 0 deletions
diff --git a/addons/l10n_in_sale_stock/__init__.py b/addons/l10n_in_sale_stock/__init__.py new file mode 100644 index 00000000..dc5e6b69 --- /dev/null +++ b/addons/l10n_in_sale_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_sale_stock/__manifest__.py b/addons/l10n_in_sale_stock/__manifest__.py new file mode 100644 index 00000000..94e11e0b --- /dev/null +++ b/addons/l10n_in_sale_stock/__manifest__.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +{ + 'name': "India Sales and Warehouse Management", + + 'summary': """ + Define default sales journal on the warehouse""", + + 'description': """ + Define default sales journal on the warehouse, + help you to choose correct sales journal on the sales order when + you change the warehouse. + useful when you setup the multiple GSTIN units. + """, + + 'author': "Odoo", + 'website': "https://www.odoo.com", + 'category': 'Accounting/Localizations/Sale', + 'version': '0.1', + + 'depends': ['l10n_in_sale', 'l10n_in_stock'], + + 'data': [ + 'views/stock_warehouse_views.xml', + ], + 'auto_install': True, + 'license': 'LGPL-3', +} diff --git a/addons/l10n_in_sale_stock/models/__init__.py b/addons/l10n_in_sale_stock/models/__init__.py new file mode 100644 index 00000000..fcfd6a14 --- /dev/null +++ b/addons/l10n_in_sale_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 sale_order +from . import stock_warehouse diff --git a/addons/l10n_in_sale_stock/models/sale_order.py b/addons/l10n_in_sale_stock/models/sale_order.py new file mode 100644 index 00000000..653724eb --- /dev/null +++ b/addons/l10n_in_sale_stock/models/sale_order.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import models, fields, api + + +class SaleOrder(models.Model): + _inherit = "sale.order" + + @api.depends('company_id','warehouse_id') + def _compute_l10n_in_journal_id(self): + super()._compute_l10n_in_journal_id() + for order in self: + if order.l10n_in_company_country_code == 'IN': + if order.warehouse_id.l10n_in_sale_journal_id: + order.l10n_in_journal_id = order.warehouse_id.l10n_in_sale_journal_id.id diff --git a/addons/l10n_in_sale_stock/models/stock_warehouse.py b/addons/l10n_in_sale_stock/models/stock_warehouse.py new file mode 100644 index 00000000..190e0b27 --- /dev/null +++ b/addons/l10n_in_sale_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_sale_journal_id = fields.Many2one('account.journal', string="Sale Journal") diff --git a/addons/l10n_in_sale_stock/views/stock_warehouse_views.xml b/addons/l10n_in_sale_stock/views/stock_warehouse_views.xml new file mode 100644 index 00000000..0329dc01 --- /dev/null +++ b/addons/l10n_in_sale_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_sale_journal_id" domain="[('company_id', '=', company_id), ('type','=','sale')]" options="{'no_create': True}"/> + </xpath> + </field> + </record> +</odoo> |
