feat: extend sale.order, stock.picking, account.move, res.partner with WooCommerce fields
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -9,3 +9,7 @@ from . import woo_conflict
|
|||||||
from . import woo_tax_map
|
from . import woo_tax_map
|
||||||
from . import woo_pricelist_map
|
from . import woo_pricelist_map
|
||||||
from . import woo_return
|
from . import woo_return
|
||||||
|
from . import sale_order
|
||||||
|
from . import stock_picking
|
||||||
|
from . import account_move
|
||||||
|
from . import res_partner
|
||||||
|
|||||||
12
fusion-woo-odoo/fusion_woocommerce/models/account_move.py
Normal file
12
fusion-woo-odoo/fusion_woocommerce/models/account_move.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
from odoo import models, fields
|
||||||
|
|
||||||
|
|
||||||
|
class AccountMove(models.Model):
|
||||||
|
_inherit = 'account.move'
|
||||||
|
|
||||||
|
woo_order_id = fields.Many2one('woo.order', string='WooCommerce Order')
|
||||||
|
is_woo_invoice = fields.Boolean(compute='_compute_is_woo_invoice', string='Is WC Invoice')
|
||||||
|
|
||||||
|
def _compute_is_woo_invoice(self):
|
||||||
|
for move in self:
|
||||||
|
move.is_woo_invoice = bool(move.woo_order_id)
|
||||||
13
fusion-woo-odoo/fusion_woocommerce/models/res_partner.py
Normal file
13
fusion-woo-odoo/fusion_woocommerce/models/res_partner.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
from odoo import models, fields, api
|
||||||
|
|
||||||
|
|
||||||
|
class ResPartner(models.Model):
|
||||||
|
_inherit = 'res.partner'
|
||||||
|
|
||||||
|
woo_customer_ids = fields.One2many('woo.customer', 'partner_id', string='WooCommerce Links')
|
||||||
|
is_woo_customer = fields.Boolean(compute='_compute_is_woo_customer', string='Is WC Customer', store=True)
|
||||||
|
|
||||||
|
@api.depends('woo_customer_ids')
|
||||||
|
def _compute_is_woo_customer(self):
|
||||||
|
for partner in self:
|
||||||
|
partner.is_woo_customer = bool(partner.woo_customer_ids)
|
||||||
12
fusion-woo-odoo/fusion_woocommerce/models/sale_order.py
Normal file
12
fusion-woo-odoo/fusion_woocommerce/models/sale_order.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
from odoo import models, fields
|
||||||
|
|
||||||
|
|
||||||
|
class SaleOrder(models.Model):
|
||||||
|
_inherit = 'sale.order'
|
||||||
|
|
||||||
|
woo_bind_ids = fields.One2many('woo.order', 'sale_order_id', string='WooCommerce Orders')
|
||||||
|
woo_order_count = fields.Integer(compute='_compute_woo_order_count', string='WC Orders')
|
||||||
|
|
||||||
|
def _compute_woo_order_count(self):
|
||||||
|
for order in self:
|
||||||
|
order.woo_order_count = len(order.woo_bind_ids)
|
||||||
16
fusion-woo-odoo/fusion_woocommerce/models/stock_picking.py
Normal file
16
fusion-woo-odoo/fusion_woocommerce/models/stock_picking.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
from odoo import models, fields
|
||||||
|
|
||||||
|
|
||||||
|
class StockPicking(models.Model):
|
||||||
|
_inherit = 'stock.picking'
|
||||||
|
|
||||||
|
woo_tracking_number = fields.Char(string='WC Tracking Number')
|
||||||
|
woo_carrier_id = fields.Many2one('woo.shipping.carrier', string='WC Shipping Carrier')
|
||||||
|
woo_shipment_ids = fields.One2many('woo.shipment', 'picking_id', string='WC Shipments')
|
||||||
|
is_woo_delivery = fields.Boolean(compute='_compute_is_woo_delivery', string='Is WC Delivery')
|
||||||
|
|
||||||
|
def _compute_is_woo_delivery(self):
|
||||||
|
for picking in self:
|
||||||
|
picking.is_woo_delivery = bool(picking.woo_shipment_ids) or bool(
|
||||||
|
picking.sale_id and picking.sale_id.woo_bind_ids
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user