Skip to content

Commit

Permalink
Merge 743ccae into dc020a3
Browse files Browse the repository at this point in the history
  • Loading branch information
bealdav committed Jan 10, 2020
2 parents dc020a3 + 743ccae commit bf99be4
Show file tree
Hide file tree
Showing 12 changed files with 605 additions and 0 deletions.
80 changes: 80 additions & 0 deletions pos_default_partner/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
=============================
Point Of Sale Default Partner
=============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github
:target: https://github.com/OCA/pos/tree/12.0/pos_default_partner
:alt: OCA/pos
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/pos-12-0/pos-12-0-pos_default_partner
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/184/12.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

Define a default partner for Point Of Sale order on each company.

**Table of contents**

.. contents::
:local:

Configuration
=============

Set default partner on POS settings

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 <https://github.com/OCA/pos/issues/new?body=module:%20pos_default_partner%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Akretion

Contributors
~~~~~~~~~~~~

* Akretion

* David Beal <david.beal@akretion.com>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

This module is part of the `OCA/pos <https://github.com/OCA/pos/tree/12.0/pos_default_partner>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions pos_default_partner/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
21 changes: 21 additions & 0 deletions pos_default_partner/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# copyright 2020 Akretion David BEAL
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Point Of Sale Default Partner",
"summary": "Add a default customer in pos order",
"license": "AGPL-3",
"version": "12.0.1.0.0",
"author": "Akretion,"
"Odoo Community Association (OCA)",
"maintainer": "Akretion",
"category": "Point of sale",
"depends": [
"point_of_sale",
],
"data": [
"views/config_view.xml"
],
"website": "https://github.com/OCA/pos",
"installable": True,
}
3 changes: 3 additions & 0 deletions pos_default_partner/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import company
from . import config
from . import pos_order
11 changes: 11 additions & 0 deletions pos_default_partner/models/company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# copyright 2020 Akretion David BEAL
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class ResCompany(models.Model):
_inherit = "res.company"

pos_default_partner_id = fields.Many2one(
comodel_name="res.partner", string="Default customer")
12 changes: 12 additions & 0 deletions pos_default_partner/models/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# copyright 2020 Akretion David BEAL
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

pos_default_partner_id = fields.Many2one(
comodel_name="res.partner", readonly=False,
related="company_id.pos_default_partner_id")
17 changes: 17 additions & 0 deletions pos_default_partner/models/pos_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# copyright 2020 Akretion David BEAL
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import api, models


class PosOrder(models.Model):
_inherit = "pos.order"

@api.model
def create(self, vals):
if not vals.get("partner_id"):
company_id = vals.get("company_id") or self.env.user.company_id.id
partner = self.env["res.company"].browse(company_id).pos_default_partner_id
if partner:
vals["partner_id"] = partner.id
return super().create(vals)
1 change: 1 addition & 0 deletions pos_default_partner/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Set default partner on POS settings
3 changes: 3 additions & 0 deletions pos_default_partner/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Akretion

* David Beal <david.beal@akretion.com>
1 change: 1 addition & 0 deletions pos_default_partner/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Define a default partner for Point Of Sale order on each company.

0 comments on commit bf99be4

Please sign in to comment.