New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[add] pos_default_invoice_active #212
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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,43 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:alt: License | ||
|
||
POS default invoice active | ||
========================== | ||
|
||
In POS configuration you can enable invoicing. | ||
|
||
When you do it the button "invoice" becomes available on the payment screen. | ||
|
||
With this module you'll have a flag to enable invoicing by default | ||
so that when you get to payment screen the invoice button is already active. | ||
|
||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/pos/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 | ||
`here <https://github.com/OCA/pos/issues/new?body=module:%20pos_default_invoice_active%0Aversion:%2010.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Simone Orsi <simone.orsi@camptocamp.com> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: http://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: http://odoo-community.org | ||
|
||
This module is maintained by the OCA. | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. | ||
|
||
To contribute to this module, please visit http://odoo-community.org. |
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 @@ | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2017-TODAY Camptocamp SA (<http://www.camptocamp.com>). | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
{ | ||
'name': 'POS Default invoice activate', | ||
'version': '10.0.1.0.0', | ||
'author': 'Camptocamp,Odoo Community Association (OCA)', | ||
'category': 'Sales Management', | ||
'depends': [ | ||
'point_of_sale', | ||
], | ||
'demo': [], | ||
'website': 'https://github.com/OCA/pos', | ||
'data': [ | ||
'views/assets.xml', | ||
'views/pos_config_view.xml', | ||
], | ||
'installable': True, | ||
'license': 'AGPL-3', | ||
} |
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 @@ | ||
from . import pos_config |
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 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2017-TODAY Camptocamp SA (<http://www.camptocamp.com>). | ||
# @author: Simone Orsi (https://twitter.com/simahawk) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
|
||
from odoo import fields, models | ||
|
||
|
||
class PosConfig(models.Model): | ||
_inherit = 'pos.config' | ||
|
||
iface_invoicing_active = fields.Boolean( | ||
string='Activate invoicing by default' | ||
) |
26 changes: 26 additions & 0 deletions
26
pos_default_invoice_active/static/src/js/pos_default_invoice_active.js
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,26 @@ | ||
/****************************************************************************** | ||
* Copyright (C) 2017-TODAY Camptocamp SA (<http://www.camptocamp.com>). | ||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
******************************************************************************/ | ||
|
||
odoo.define('pos_default_invoice_active.activate_invoicing', function (require) { | ||
"use strict"; | ||
|
||
var pos_models = require('point_of_sale.models'); | ||
var pos_screens = require('point_of_sale.screens'); | ||
|
||
// add `iface_invoicing_active` to loaded pos config's fields | ||
pos_models.load_fields("pos.config", "iface_invoicing_active"); | ||
|
||
pos_screens.PaymentScreenWidget.include({ | ||
show: function(){ | ||
this._super(); | ||
// activate invoicing | ||
// TODO: any better way to check if the button is already enabled? | ||
if (this.pos.config.iface_invoicing_active && !this.$('.js_invoice').hasClass('highlight')) { | ||
this.$('.js_invoice').trigger('click'); | ||
} | ||
}, | ||
}); | ||
|
||
}); |
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 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<template id="assets" inherit_id="point_of_sale.assets"> | ||
<xpath expr="." position="inside"> | ||
<script type="text/javascript" src="/pos_default_invoice_active/static/src/js/pos_default_invoice_active.js"></script> | ||
</xpath> | ||
</template> | ||
</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,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="view_pos_config_form" model="ir.ui.view"> | ||
<field name="name">pos.config.form.view default invoice on</field> | ||
<field name="model">pos.config</field> | ||
<field name="inherit_id" ref="point_of_sale.view_pos_config_form"/> | ||
<field name="arch" type="xml"> | ||
<field name="iface_invoicing" position="after"> | ||
<field name="iface_invoicing_active" attrs="{'invisible': [('iface_invoicing', '=', False)]}"/> | ||
</field> | ||
</field> | ||
</record> | ||
</odoo> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a better way would be to set the order as "To Invoice" when initializing it. I will try to find a way to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any update ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I proposed a fix in an other comment but I don't know what's the status of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry guys, I'm not working on this (well, our related project) since a while. Feel free to carry on 😉