Skip to content
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

[IMP] allow change state of invoices on child companies linked to doc… #12

Merged
merged 1 commit into from
Jun 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions purchase_multic_fix/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models
from openerp import models, fields


class AccountInvoice(models.Model):
_inherit = "account.invoice"
class AccountInvoiceLine(models.Model):
_inherit = "account.invoice.line"

# this is tu fix when you are on a child company on an invoice linked to
# a PO of the parent company
purchase_id = fields.Many2one(
related_sudo=True,
)

# al final este arreglo no fue necesario por cambios en _onchange_company
# de account_multic_fix
Expand Down
8 changes: 7 additions & 1 deletion purchase_multic_fix/purchase.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, api, _
from openerp import models, api, fields, _


class purchase_order(models.Model):
Expand All @@ -22,6 +22,12 @@ def check_company(self):
class purchase_order_line(models.Model):
_inherit = "purchase.order.line"

# this is tu fix when you are on a child company and you change state of an
# invoice linked to a PO of parent company (validate it, set as paid, etc)
qty_invoiced = fields.Float(
compute_sudo=True,
)

@api.onchange('product_id')
def onchange_product_id(self):
res = super(purchase_order_line, self).onchange_product_id()
Expand Down
6 changes: 6 additions & 0 deletions sale_multic_fix/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ def _prepare_invoice(self):
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"

# this is tu fix when you are on a child company and you change state of an
# invoice linked to a SO of parent company (validate it, set as paid, etc)
qty_invoiced = fields.Float(
compute_sudo=True,
)

@api.multi
def _prepare_invoice_line(self, qty):
"""
Expand Down