-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.0.1.0.0] stock_picking_invoice_journal_policy
- Loading branch information
Showing
10 changed files
with
190 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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
============================================ | ||
Create Invoice From Picking's Journal Policy | ||
============================================ | ||
|
||
|
||
Installation | ||
============ | ||
|
||
To install this module, you need to: | ||
|
||
1. Clone the branch 8.0 of the repository https://github.com/open-synergy/opnsynid-stock-logistics-warehouse | ||
2. Add the path to this repository in your configuration (addons-path) | ||
3. Update the module list | ||
4. Go to menu *Setting -> Modules -> Local Modules* | ||
5. Search For *Create Invoice From Picking's Journal Policy* | ||
6. Install the module | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/open-synergy/opnsynid-stock-logistics-warehouse/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us smashing it by providing a detailed | ||
and welcomed feedback. | ||
|
||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Michael Viriyananda <viriyananda.michael@gmail.com> | ||
* Andhitia Rama <andhitia.r@gmail.com> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://opensynergy-indonesia.com/logo.png | ||
:alt: OpenSynergy Indonesia | ||
:target: https://opensynergy-indonesia.com | ||
|
||
This module is maintained by the OpenSynergy Indonesia. |
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 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2019 OpenSynergy Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2019 OpenSynergy Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
# pylint: disable=locally-disabled, manifest-required-author | ||
{ | ||
"name": "Create Invoice From Picking's Journal Policy", | ||
"version": "8.0.1.0.0", | ||
"category": "Stock Management", | ||
"website": "https://opensynergy-indonesia.com", | ||
"author": "OpenSynergy Indonesia", | ||
"license": "AGPL-3", | ||
"installable": True, | ||
"depends": [ | ||
"stock_account", | ||
], | ||
"data": [ | ||
"wizards/stock_invoice_onshipping.xml", | ||
"views/stock_picking_type_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,7 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2019 OpenSynergy Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import ( | ||
stock_picking_type, | ||
) |
21 changes: 21 additions & 0 deletions
21
stock_picking_invoice_journal_policy/models/stock_picking_type.py
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,21 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2017 OpenSynergy Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from openerp import models, fields | ||
|
||
|
||
class StockPickingType(models.Model): | ||
_inherit = "stock.picking.type" | ||
|
||
allowed_invoice_journal_ids = fields.Many2many( | ||
string="Allowed Invoice Journals", | ||
comodel_name="account.journal", | ||
relation="rel_stock_picking_type_2_invoice_journal", | ||
column1="stock_picking_id", | ||
column2="journal_id", | ||
) | ||
default_invoice_journal_id = fields.Many2one( | ||
string="Default Invoice Journal", | ||
comodel_name="account.journal", | ||
) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions
20
stock_picking_invoice_journal_policy/views/stock_picking_type_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,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<openerp> | ||
<data> | ||
<record id="stock_picking_type_view_form" model="ir.ui.view"> | ||
<field name="name">Stock Picking Type Policy Form</field> | ||
<field name="model">stock.picking.type</field> | ||
<field name="inherit_id" ref="stock.view_picking_type_form"/> | ||
<field name="arch" type="xml"> | ||
<data> | ||
<xpath expr="//sheet/group[1]" position="after"> | ||
<group name="invoice_policy" string="Invoice Policy" colspan="4" col="2"> | ||
<field name="allowed_invoice_journal_ids" widget="many2many_tags"/> | ||
<field name="default_invoice_journal_id"/> | ||
</group> | ||
</xpath> | ||
</data> | ||
</field> | ||
</record> | ||
</data> | ||
</openerp> |
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,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2019 OpenSynergy Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import stock_invoice_onshipping |
38 changes: 38 additions & 0 deletions
38
stock_picking_invoice_journal_policy/wizards/stock_invoice_onshipping.py
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,38 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2018 OpenSynergy Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from openerp import models, api, fields | ||
|
||
|
||
class StockInvoiceOnshipping(models.TransientModel): | ||
_inherit = "stock.invoice.onshipping" | ||
|
||
@api.model | ||
def _default_stock_picking_id(self): | ||
active_ids = self._context.get("active_ids", []) | ||
if len(active_ids) > 0: | ||
return active_ids[0] | ||
else: | ||
return False | ||
|
||
stock_picking_id = fields.Many2one( | ||
string="Stock Picking", | ||
comodel_name="stock.picking", | ||
default=lambda self: self._default_stock_picking_id(), | ||
) | ||
allowed_invoice_journal_ids = fields.Many2many( | ||
string="Allowed Invoice Journals", | ||
comodel_name="account.journal", | ||
related="stock_picking_id.picking_type_id.allowed_invoice_journal_ids", | ||
) | ||
|
||
@api.onchange("stock_picking_id") | ||
def onchange_journal_id(self): | ||
self.journal_id = False | ||
if self.stock_picking_id: | ||
picking = self.stock_picking_id | ||
if picking.picking_type_id: | ||
picking_type = picking.picking_type_id | ||
if picking_type.default_invoice_journal_id: | ||
self.journal_id = picking_type.default_invoice_journal_id |
23 changes: 23 additions & 0 deletions
23
stock_picking_invoice_journal_policy/wizards/stock_invoice_onshipping.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,23 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<openerp> | ||
<data> | ||
<record id="stock_invoice_onshipping_view_form" model="ir.ui.view"> | ||
<field name="name">stock.invoice.onshipping form</field> | ||
<field name="model">stock.invoice.onshipping</field> | ||
<field name="mode">extension</field> | ||
<field name="inherit_id" ref="stock_account.view_stock_invoice_onshipping"/> | ||
<field name="arch" type="xml"> | ||
<data> | ||
<xpath expr="//field[@name='journal_id']" position="before"> | ||
<field name="stock_picking_id" invisible="1"/> | ||
<field name="allowed_invoice_journal_ids" widget="many2many_tags" invisible="1"/> | ||
</xpath> | ||
<xpath expr="//field[@name='journal_id']" position="attributes"> | ||
<attribute name="domain">[('id','in',allowed_invoice_journal_ids[0][2])]</attribute> | ||
<attribute name="on_change"/> | ||
</xpath> | ||
</data> | ||
</field> | ||
</record> | ||
</data> | ||
</openerp> |