Browse Source

[ADD] pos_invoicing_from_picking

pull/63/head
Daniel-CA 9 years ago
parent
commit
2c0d25c7c2
  1. 50
      pos_invoicing_from_picking/README.rst
  2. 6
      pos_invoicing_from_picking/__init__.py
  3. 20
      pos_invoicing_from_picking/__openerp__.py
  4. 6
      pos_invoicing_from_picking/models/__init__.py
  5. 21
      pos_invoicing_from_picking/models/point_of_sale.py
  6. 25
      pos_invoicing_from_picking/models/stock.py
  7. 3
      pos_invoicing_from_picking/oca_dependencies.txt
  8. 14
      pos_invoicing_from_picking/views/point_of_sale_view.xml

50
pos_invoicing_from_picking/README.rst

@ -0,0 +1,50 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License
==========================
PoS invoicing from picking
==========================
This module allows to invoice from stock picking PoS sale orders.
Usage
=====
To use this module, you need to go to PoS backend sale orders and use the
picking button to create a picking to be invoiced.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/184/8.0
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_invoicing_from_picking%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Contributors
------------
* Daniel Campos <danielcampos@avanzosc.es>
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
* Ana Juaristi <ajuaristio@gmail.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.

6
pos_invoicing_from_picking/__init__.py

@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# (c) 2015 Daniel Campos <danielcampos@avanzosc.es> - Avanzosc S.L.
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import models

20
pos_invoicing_from_picking/__openerp__.py

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# (c) 2015 Daniel Campos <danielcampos@avanzosc.es> - Avanzosc S.L.
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
"name": "POS invoicing from picking",
"version": "8.0.1.0.0",
'author': 'OdooMRP team',
'website': "http://www.odoomrp.com",
'license': 'AGPL-3',
'contributors': ["Daniel Campos <danielcampos@avanzosc.es>",
"Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>",
"Ana Juaristi <ajuaristio@gmail.com>"],
"depends": ['point_of_sale', 'stock_account',
'stock_picking_invoice_link'],
"category": "POS",
"data": ['views/point_of_sale_view.xml'
],
"installable": True
}

6
pos_invoicing_from_picking/models/__init__.py

@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# (c) 2015 Daniel Campos <danielcampos@avanzosc.es> - Avanzosc S.L.
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import point_of_sale
from . import stock

21
pos_invoicing_from_picking/models/point_of_sale.py

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# (c) 2015 Daniel Campos <danielcampos@avanzosc.es> - Avanzosc S.L.
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, api, exceptions, _
class PosOrder(models.Model):
_inherit = 'pos.order'
@api.multi
def action_confirm_picking(self):
for order in self:
if not order.partner_id:
raise exceptions.Warning(
_('Customer must be selected to invoice from picking'))
if not self.picking_id:
order.create_picking()
pick = order.picking_id
pick.invoice_state = '2binvoiced'
order.state = 'invoiced'

25
pos_invoicing_from_picking/models/stock.py

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# (c) 2015 Daniel Campos <danielcampos@avanzosc.es> - Avanzosc S.L.
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, api
class StockPicking(models.Model):
_inherit = 'stock.picking'
@api.multi
def action_invoice_create(self, journal_id, group=False,
type='out_invoice'):
res = super(StockPicking, self).action_invoice_create(
journal_id, group=group, type=type)
for picking in self:
pos_order_obj = self.env['pos.order']
picking_type_id = self.env.ref('point_of_sale.picking_type_posout')
if picking_type_id.id == picking.picking_type_id.id:
pos_order = pos_order_obj.search(
[('picking_id', '=', picking.id)], limit=1)
if pos_order:
pos_order.invoice_id = picking.invoice_id
pos_order.invoice_id.origin += ' / ' + pos_order.name
return res

3
pos_invoicing_from_picking/oca_dependencies.txt

@ -0,0 +1,3 @@
# list the OCA project dependencies, one per line
# add a github url if you need a forked version
stock-logistics-workflow https://github.com/OCA/stock-logistics-workflow.git

14
pos_invoicing_from_picking/views/point_of_sale_view.xml

@ -0,0 +1,14 @@
<openerp>
<data>
<record id="pos_order_ext_form_view" model="ir.ui.view">
<field name="name">pos.order.ext.form</field>
<field name="model">pos.order</field>
<field name="inherit_id" ref="point_of_sale.view_pos_pos_form" />
<field name="arch" type="xml">
<button string="Payment" position="after">
<button name="action_confirm_picking" string="Invoice Picking" class="oe_highlight" type="object" states="draft" />
</button>
</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save